parent
42fb26475c
commit
95db3dc0e3
20 changed files with 47 additions and 101 deletions
|
@ -14,9 +14,11 @@ import me.night.nullvalkyrie.commands.*;
|
|||
import me.night.nullvalkyrie.database.DatabaseManager;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
public static Dotenv env;
|
||||
public static MongoDatabase database;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
EnchantmentManager.register();
|
||||
|
|
|
@ -1,37 +1,25 @@
|
|||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import net.minecraft.network.protocol.game.PacketPlayOutOpenWindow;
|
||||
import net.minecraft.server.level.EntityPlayer;
|
||||
import net.minecraft.world.inventory.Containers;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_19_R1.util.CraftChatMessage;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AnvilCommand extends Command {
|
||||
|
||||
public AnvilCommand() {
|
||||
super(
|
||||
"anvil",
|
||||
new String[]{"av"},
|
||||
"Open anvil",
|
||||
""
|
||||
);
|
||||
super("anvil", new String[]{"av"}, "Open anvil", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
CraftPlayer craftPlayer = (CraftPlayer) player;
|
||||
// EntityPlayer entityPlayer = craftPlayer.getHandle();
|
||||
// int id = 0;
|
||||
// PacketPlayOutOpenWindow OpenWindow = new PacketPlayOutOpenWindow(id, Containers.h, CraftChatMessage.fromStringOrNull("Test"));
|
||||
// PlayerConnection playerConnection = entityPlayer.b;
|
||||
// playerConnection.a(OpenWindow);
|
||||
if (sender instanceof Player player) {
|
||||
Inventory av = Bukkit.createInventory(null, InventoryType.ANVIL, "AV");
|
||||
player.openInventory(av);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,18 +15,12 @@ import java.util.List;
|
|||
public class ArmorCommand extends Command {
|
||||
|
||||
public ArmorCommand() {
|
||||
super(
|
||||
"armor",
|
||||
new String[]{},
|
||||
"Give you a set of armor",
|
||||
""
|
||||
);
|
||||
super("armor", new String[]{}, "Give you a set of armor", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (sender instanceof Player player) {
|
||||
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
|
||||
LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta();
|
||||
helmetdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Helmet");
|
||||
|
|
|
@ -13,9 +13,10 @@ public class BetaCommand extends Command {
|
|||
|
||||
@Override
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
if (sender instanceof Player player) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, String[] args) {
|
||||
return null;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandMap;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.defaults.BukkitCommand;
|
||||
|
@ -39,6 +38,8 @@ public abstract class Command extends BukkitCommand {
|
|||
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
|
||||
return onTabComplete(sender, args);
|
||||
}
|
||||
|
||||
public abstract void onCommand(CommandSender sender, String[] args);
|
||||
|
||||
public abstract List<String> onTabComplete(CommandSender sender, String[] args);
|
||||
}
|
||||
|
|
|
@ -8,18 +8,12 @@ import java.util.List;
|
|||
public class CraftCommand extends Command {
|
||||
|
||||
public CraftCommand() {
|
||||
super(
|
||||
"craft",
|
||||
new String[]{"ct", "crafting", "craftingtable"},
|
||||
"Open crafting table",
|
||||
""
|
||||
);
|
||||
super("craft", new String[]{"ct", "crafting", "craftingtable"}, "Open crafting table", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (sender instanceof Player player) {
|
||||
player.openWorkbench(null, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,18 +7,12 @@ import java.util.List;
|
|||
|
||||
public class EnchantingCommand extends Command {
|
||||
public EnchantingCommand() {
|
||||
super(
|
||||
"enchant",
|
||||
new String[]{"et", "enchanting", "enchantingtable"},
|
||||
"Open enchanting table",
|
||||
""
|
||||
);
|
||||
super("enchant", new String[]{"et", "enchanting", "enchantingtable"}, "Open enchanting table", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (sender instanceof Player player) {
|
||||
player.openEnchanting(player.getLocation(), true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,23 +10,13 @@ import java.util.List;
|
|||
|
||||
public class HologramCommand extends Command {
|
||||
public HologramCommand() {
|
||||
super(
|
||||
"hologram",
|
||||
new String[]{},
|
||||
"Spawn a hologram",
|
||||
""
|
||||
);
|
||||
super("hologram", new String[]{}, "Spawn a hologram", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
String[] ar = new String[]{
|
||||
ChatColor.AQUA + "Hi",
|
||||
ChatColor.DARK_PURPLE + "What",
|
||||
ChatColor.GOLD + "Hello World"
|
||||
};
|
||||
if (sender instanceof Player player) {
|
||||
String[] ar = new String[]{ChatColor.AQUA + "Hi", ChatColor.DARK_PURPLE + "What", ChatColor.GOLD + "Hello World"};
|
||||
Location location = player.getLocation();
|
||||
for (String line : ar) {
|
||||
ArmorStand stand = location.getWorld().spawn(location.subtract(0, 0.3, 0), ArmorStand.class, armorStand -> {
|
||||
|
|
|
@ -11,18 +11,12 @@ import java.util.List;
|
|||
|
||||
public class MessageCommand extends Command {
|
||||
public MessageCommand() {
|
||||
super(
|
||||
"message",
|
||||
new String[]{"msg"},
|
||||
"Send message to someone",
|
||||
""
|
||||
);
|
||||
super("message", new String[]{"msg"}, "Send message to someone", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (sender instanceof Player player) {
|
||||
if (args.length >= 2) {
|
||||
if (Bukkit.getPlayerExact(args[0]) != null) {
|
||||
Player target = Bukkit.getPlayerExact(args[0]);
|
||||
|
|
|
@ -14,12 +14,7 @@ import static me.night.nullvalkyrie.miners.CryptoMiner.generate;
|
|||
public class MinerCommand extends Command {
|
||||
|
||||
public MinerCommand() {
|
||||
super(
|
||||
"miner",
|
||||
new String[]{"m", "miners"},
|
||||
"Miner list",
|
||||
""
|
||||
);
|
||||
super("miner", new String[]{"m", "miners"}, "Miner list", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,12 +15,7 @@ import java.util.List;
|
|||
public class RankCommand extends Command {
|
||||
|
||||
public RankCommand() {
|
||||
super(
|
||||
"rank",
|
||||
new String[]{},
|
||||
"Set rank of players",
|
||||
"nv.rank.add"
|
||||
);
|
||||
super("rank", new String[]{}, "Set rank of players", "nv.rank.add");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,12 +7,7 @@ import java.util.List;
|
|||
|
||||
public class TestCommand extends Command {
|
||||
public TestCommand() {
|
||||
super(
|
||||
"test",
|
||||
new String[]{},
|
||||
"Test",
|
||||
""
|
||||
);
|
||||
super("test", new String[]{}, "Test", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,18 +13,12 @@ public class VanishCommand extends Command {
|
|||
private final List<UUID> vanished = new ArrayList<>();
|
||||
|
||||
public VanishCommand() {
|
||||
super(
|
||||
"vanish",
|
||||
new String[]{},
|
||||
"Turn yourself into invisible",
|
||||
""
|
||||
);
|
||||
super("vanish", new String[]{}, "Turn yourself into invisible", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCommand(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (sender instanceof Player player) {
|
||||
if (vanished.contains(player.getUniqueId())) {
|
||||
vanished.remove(player.getUniqueId());
|
||||
for (Player target : Bukkit.getOnlinePlayers()) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
package me.night.nullvalkyrie.discord;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import net.dv8tion.jda.api.JDA;
|
||||
import net.dv8tion.jda.api.JDABuilder;
|
||||
|
@ -9,9 +10,11 @@ import javax.security.auth.login.LoginException;
|
|||
|
||||
public class DiscordClientManager {
|
||||
private JDA jda;
|
||||
|
||||
public DiscordClientManager() {
|
||||
register();
|
||||
}
|
||||
|
||||
public void register() {
|
||||
JDABuilder builder = JDABuilder.createDefault(Main.env.get("DISCORD_TOKEN"));
|
||||
builder.setActivity(Activity.streaming("cath.exe", "https://www.youtube.com/watch?v=YSKDu1gKntY"));
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
|||
public class CustomEnchantment extends Enchantment {
|
||||
private final String name;
|
||||
private final int max;
|
||||
|
||||
public CustomEnchantment(String namespace, String name, int lvl) {
|
||||
super(NamespacedKey.minecraft(namespace));
|
||||
this.name = name;
|
||||
|
|
|
@ -6,24 +6,25 @@ import java.lang.reflect.Field;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class EnchantmentManager {
|
||||
public static final Enchantment ThunderBolt = new CustomEnchantment("thunderbolt", "ThunderBolt", 5);
|
||||
public static final Enchantment SmeltingTouch = new CustomEnchantment("smelting-touch", "Smelting Touch", 1);
|
||||
|
||||
public static void register() {
|
||||
List<Enchantment> enchants = new ArrayList<>();
|
||||
enchants.add(ThunderBolt);
|
||||
enchants.add(SmeltingTouch);
|
||||
List<Boolean> registeredList = new ArrayList<>();
|
||||
for (Enchantment enchant : enchants) {
|
||||
registeredList.add(Arrays.stream(Enchantment.values()).collect(Collectors.toList()).contains(enchant));
|
||||
registeredList.add(Arrays.stream(Enchantment.values()).toList().contains(enchant));
|
||||
}
|
||||
for (int counter = 0; counter < registeredList.size(); counter++) {
|
||||
if (!registeredList.get(counter)) registerEnchantment(enchants.get(counter));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void registerEnchantment(Enchantment en) {
|
||||
try {
|
||||
try {
|
||||
|
|
|
@ -9,15 +9,19 @@ import java.util.UUID;
|
|||
public class AnimatedSideBar {
|
||||
private static final Map<UUID, Integer> Tasks = new HashMap<>();
|
||||
private final UUID uuid;
|
||||
|
||||
public AnimatedSideBar(UUID uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public void setID(int id) {
|
||||
Tasks.put(uuid, id);
|
||||
}
|
||||
|
||||
public boolean hasID() {
|
||||
return Tasks.containsKey(uuid);
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
Bukkit.getScheduler().cancelTask(Tasks.get(uuid));
|
||||
}
|
||||
|
|
|
@ -3,10 +3,7 @@ package me.night.nullvalkyrie.ui;
|
|||
import org.bukkit.ChatColor;
|
||||
|
||||
public enum Rank {
|
||||
OWNER(ChatColor.DARK_RED + "<OWNER>"),
|
||||
ADMIN(ChatColor.RED + "<ADMIN>"),
|
||||
SPECIAL(ChatColor.GOLD + "<SPECIAL>"),
|
||||
ROOKIE(ChatColor.DARK_GREEN + "<ROOKIE>");
|
||||
OWNER(ChatColor.DARK_RED + "<OWNER>"), ADMIN(ChatColor.RED + "<ADMIN>"), SPECIAL(ChatColor.GOLD + "<SPECIAL>"), ROOKIE(ChatColor.DARK_GREEN + "<ROOKIE>");
|
||||
|
||||
private final String display;
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ public class SideBarManager {
|
|||
Scoreboard board = player.getScoreboard();
|
||||
Objective obj;
|
||||
if (board.getObjective("Vanadium") != null) obj = board.getObjective("Vanadium");
|
||||
else obj = board.registerNewObjective("Vanadium", Criteria.DUMMY, ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
|
||||
else
|
||||
obj = board.registerNewObjective("Vanadium", Criteria.DUMMY, ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
|
||||
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
Score hypens = obj.getScore(ChatColor.GOLD + "=-=-=-=-=-=-=-=");
|
||||
hypens.setScore(9);
|
||||
|
@ -58,11 +59,13 @@ public class SideBarManager {
|
|||
board = new AnimatedSideBar(player.getUniqueId());
|
||||
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(main, new Runnable() {
|
||||
int count = 0;
|
||||
|
||||
public void animate(String str) {
|
||||
Scoreboard board = player.getScoreboard();
|
||||
Objective objective;
|
||||
if (board.getObjective("Vanadium") != null) objective = board.getObjective("Vanadium");
|
||||
else objective = board.registerNewObjective("Vanadium", Criteria.DUMMY, ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
|
||||
else
|
||||
objective = board.registerNewObjective("Vanadium", Criteria.DUMMY, ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
|
||||
objective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
objective.setDisplayName(Util.color(str));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue