Revert "formatting"

This reverts commit 432e5b70b0.
This commit is contained in:
NK 2022-12-03 10:46:22 +00:00
parent 432e5b70b0
commit 42fb26475c
20 changed files with 101 additions and 47 deletions

View file

@ -14,11 +14,9 @@ import me.night.nullvalkyrie.commands.*;
import me.night.nullvalkyrie.database.DatabaseManager; import me.night.nullvalkyrie.database.DatabaseManager;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public final class Main extends JavaPlugin { public final class Main extends JavaPlugin {
public static Dotenv env; public static Dotenv env;
public static MongoDatabase database; public static MongoDatabase database;
@Override @Override
public void onEnable() { public void onEnable() {
EnchantmentManager.register(); EnchantmentManager.register();

View file

@ -1,25 +1,37 @@
package me.night.nullvalkyrie.commands; package me.night.nullvalkyrie.commands;
import org.bukkit.Bukkit; import net.minecraft.network.protocol.game.PacketPlayOutOpenWindow;
import net.minecraft.server.level.EntityPlayer;
import net.minecraft.world.inventory.Containers;
import org.bukkit.command.CommandSender; 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.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import java.util.List; import java.util.List;
public class AnvilCommand extends Command { public class AnvilCommand extends Command {
public AnvilCommand() { public AnvilCommand() {
super("anvil", new String[]{"av"}, "Open anvil", ""); super(
"anvil",
new String[]{"av"},
"Open anvil",
""
);
} }
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (sender instanceof Player player) { if (sender instanceof Player) {
Inventory av = Bukkit.createInventory(null, InventoryType.ANVIL, "AV"); Player player = (Player) sender;
player.openInventory(av); 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);
} }
} }

View file

@ -15,12 +15,18 @@ import java.util.List;
public class ArmorCommand extends Command { public class ArmorCommand extends Command {
public ArmorCommand() { public ArmorCommand() {
super("armor", new String[]{}, "Give you a set of armor", ""); super(
"armor",
new String[]{},
"Give you a set of armor",
""
);
} }
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (sender instanceof Player player) { if (sender instanceof Player) {
Player player = (Player) sender;
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET); ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta(); LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta();
helmetdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Helmet"); helmetdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Helmet");

View file

@ -13,10 +13,9 @@ public class BetaCommand extends Command {
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (sender instanceof Player player) { if (sender instanceof Player) {
} }
} }
@Override @Override
public List<String> onTabComplete(CommandSender sender, String[] args) { public List<String> onTabComplete(CommandSender sender, String[] args) {
return null; return null;

View file

@ -1,6 +1,7 @@
package me.night.nullvalkyrie.commands; package me.night.nullvalkyrie.commands;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandMap; import org.bukkit.command.CommandMap;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.defaults.BukkitCommand; import org.bukkit.command.defaults.BukkitCommand;
@ -38,8 +39,6 @@ public abstract class Command extends BukkitCommand {
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
return onTabComplete(sender, args); return onTabComplete(sender, args);
} }
public abstract void onCommand(CommandSender sender, String[] args); public abstract void onCommand(CommandSender sender, String[] args);
public abstract List<String> onTabComplete(CommandSender sender, String[] args); public abstract List<String> onTabComplete(CommandSender sender, String[] args);
} }

View file

@ -8,12 +8,18 @@ import java.util.List;
public class CraftCommand extends Command { public class CraftCommand extends Command {
public CraftCommand() { public CraftCommand() {
super("craft", new String[]{"ct", "crafting", "craftingtable"}, "Open crafting table", ""); super(
"craft",
new String[]{"ct", "crafting", "craftingtable"},
"Open crafting table",
""
);
} }
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (sender instanceof Player player) { if (sender instanceof Player) {
Player player = (Player) sender;
player.openWorkbench(null, true); player.openWorkbench(null, true);
} }
} }

View file

@ -7,12 +7,18 @@ import java.util.List;
public class EnchantingCommand extends Command { public class EnchantingCommand extends Command {
public EnchantingCommand() { public EnchantingCommand() {
super("enchant", new String[]{"et", "enchanting", "enchantingtable"}, "Open enchanting table", ""); super(
"enchant",
new String[]{"et", "enchanting", "enchantingtable"},
"Open enchanting table",
""
);
} }
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (sender instanceof Player player) { if (sender instanceof Player) {
Player player = (Player) sender;
player.openEnchanting(player.getLocation(), true); player.openEnchanting(player.getLocation(), true);
} }
} }

View file

@ -10,13 +10,23 @@ import java.util.List;
public class HologramCommand extends Command { public class HologramCommand extends Command {
public HologramCommand() { public HologramCommand() {
super("hologram", new String[]{}, "Spawn a hologram", ""); super(
"hologram",
new String[]{},
"Spawn a hologram",
""
);
} }
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (sender instanceof Player player) { if (sender instanceof Player) {
String[] ar = new String[]{ChatColor.AQUA + "Hi", ChatColor.DARK_PURPLE + "What", ChatColor.GOLD + "Hello World"}; Player player = (Player) sender;
String[] ar = new String[]{
ChatColor.AQUA + "Hi",
ChatColor.DARK_PURPLE + "What",
ChatColor.GOLD + "Hello World"
};
Location location = player.getLocation(); Location location = player.getLocation();
for (String line : ar) { for (String line : ar) {
ArmorStand stand = location.getWorld().spawn(location.subtract(0, 0.3, 0), ArmorStand.class, armorStand -> { ArmorStand stand = location.getWorld().spawn(location.subtract(0, 0.3, 0), ArmorStand.class, armorStand -> {

View file

@ -11,12 +11,18 @@ import java.util.List;
public class MessageCommand extends Command { public class MessageCommand extends Command {
public MessageCommand() { public MessageCommand() {
super("message", new String[]{"msg"}, "Send message to someone", ""); super(
"message",
new String[]{"msg"},
"Send message to someone",
""
);
} }
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (sender instanceof Player player) { if (sender instanceof Player) {
Player player = (Player) sender;
if (args.length >= 2) { if (args.length >= 2) {
if (Bukkit.getPlayerExact(args[0]) != null) { if (Bukkit.getPlayerExact(args[0]) != null) {
Player target = Bukkit.getPlayerExact(args[0]); Player target = Bukkit.getPlayerExact(args[0]);

View file

@ -14,7 +14,12 @@ import static me.night.nullvalkyrie.miners.CryptoMiner.generate;
public class MinerCommand extends Command { public class MinerCommand extends Command {
public MinerCommand() { public MinerCommand() {
super("miner", new String[]{"m", "miners"}, "Miner list", ""); super(
"miner",
new String[]{"m", "miners"},
"Miner list",
""
);
} }
@Override @Override

View file

@ -15,7 +15,12 @@ import java.util.List;
public class RankCommand extends Command { public class RankCommand extends Command {
public RankCommand() { public RankCommand() {
super("rank", new String[]{}, "Set rank of players", "nv.rank.add"); super(
"rank",
new String[]{},
"Set rank of players",
"nv.rank.add"
);
} }

View file

@ -7,7 +7,12 @@ import java.util.List;
public class TestCommand extends Command { public class TestCommand extends Command {
public TestCommand() { public TestCommand() {
super("test", new String[]{}, "Test", ""); super(
"test",
new String[]{},
"Test",
""
);
} }
@Override @Override

View file

@ -13,12 +13,18 @@ public class VanishCommand extends Command {
private final List<UUID> vanished = new ArrayList<>(); private final List<UUID> vanished = new ArrayList<>();
public VanishCommand() { public VanishCommand() {
super("vanish", new String[]{}, "Turn yourself into invisible", ""); super(
"vanish",
new String[]{},
"Turn yourself into invisible",
""
);
} }
@Override @Override
public void onCommand(CommandSender sender, String[] args) { public void onCommand(CommandSender sender, String[] args) {
if (sender instanceof Player player) { if (sender instanceof Player) {
Player player = (Player) sender;
if (vanished.contains(player.getUniqueId())) { if (vanished.contains(player.getUniqueId())) {
vanished.remove(player.getUniqueId()); vanished.remove(player.getUniqueId());
for (Player target : Bukkit.getOnlinePlayers()) { for (Player target : Bukkit.getOnlinePlayers()) {

View file

@ -1,5 +1,4 @@
package me.night.nullvalkyrie.discord; package me.night.nullvalkyrie.discord;
import me.night.nullvalkyrie.Main; import me.night.nullvalkyrie.Main;
import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.JDABuilder;
@ -10,11 +9,9 @@ import javax.security.auth.login.LoginException;
public class DiscordClientManager { public class DiscordClientManager {
private JDA jda; private JDA jda;
public DiscordClientManager() { public DiscordClientManager() {
register(); register();
} }
public void register() { public void register() {
JDABuilder builder = JDABuilder.createDefault(Main.env.get("DISCORD_TOKEN")); JDABuilder builder = JDABuilder.createDefault(Main.env.get("DISCORD_TOKEN"));
builder.setActivity(Activity.streaming("cath.exe", "https://www.youtube.com/watch?v=YSKDu1gKntY")); builder.setActivity(Activity.streaming("cath.exe", "https://www.youtube.com/watch?v=YSKDu1gKntY"));

View file

@ -9,7 +9,6 @@ import org.jetbrains.annotations.NotNull;
public class CustomEnchantment extends Enchantment { public class CustomEnchantment extends Enchantment {
private final String name; private final String name;
private final int max; private final int max;
public CustomEnchantment(String namespace, String name, int lvl) { public CustomEnchantment(String namespace, String name, int lvl) {
super(NamespacedKey.minecraft(namespace)); super(NamespacedKey.minecraft(namespace));
this.name = name; this.name = name;

View file

@ -6,25 +6,24 @@ import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
public class EnchantmentManager { public class EnchantmentManager {
public static final Enchantment ThunderBolt = new CustomEnchantment("thunderbolt", "ThunderBolt", 5); public static final Enchantment ThunderBolt = new CustomEnchantment("thunderbolt", "ThunderBolt", 5);
public static final Enchantment SmeltingTouch = new CustomEnchantment("smelting-touch", "Smelting Touch", 1); public static final Enchantment SmeltingTouch = new CustomEnchantment("smelting-touch", "Smelting Touch", 1);
public static void register() { public static void register() {
List<Enchantment> enchants = new ArrayList<>(); List<Enchantment> enchants = new ArrayList<>();
enchants.add(ThunderBolt); enchants.add(ThunderBolt);
enchants.add(SmeltingTouch); enchants.add(SmeltingTouch);
List<Boolean> registeredList = new ArrayList<>(); List<Boolean> registeredList = new ArrayList<>();
for (Enchantment enchant : enchants) { for (Enchantment enchant : enchants) {
registeredList.add(Arrays.stream(Enchantment.values()).toList().contains(enchant)); registeredList.add(Arrays.stream(Enchantment.values()).collect(Collectors.toList()).contains(enchant));
} }
for (int counter = 0; counter < registeredList.size(); counter++) { for (int counter = 0; counter < registeredList.size(); counter++) {
if (!registeredList.get(counter)) registerEnchantment(enchants.get(counter)); if (!registeredList.get(counter)) registerEnchantment(enchants.get(counter));
} }
} }
public static void registerEnchantment(Enchantment en) { public static void registerEnchantment(Enchantment en) {
try { try {
try { try {

View file

@ -9,19 +9,15 @@ import java.util.UUID;
public class AnimatedSideBar { public class AnimatedSideBar {
private static final Map<UUID, Integer> Tasks = new HashMap<>(); private static final Map<UUID, Integer> Tasks = new HashMap<>();
private final UUID uuid; private final UUID uuid;
public AnimatedSideBar(UUID uuid) { public AnimatedSideBar(UUID uuid) {
this.uuid = uuid; this.uuid = uuid;
} }
public void setID(int id) { public void setID(int id) {
Tasks.put(uuid, id); Tasks.put(uuid, id);
} }
public boolean hasID() { public boolean hasID() {
return Tasks.containsKey(uuid); return Tasks.containsKey(uuid);
} }
public void stop() { public void stop() {
Bukkit.getScheduler().cancelTask(Tasks.get(uuid)); Bukkit.getScheduler().cancelTask(Tasks.get(uuid));
} }

View file

@ -3,7 +3,10 @@ package me.night.nullvalkyrie.ui;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
public enum Rank { 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; private final String display;

View file

@ -25,8 +25,7 @@ public class SideBarManager {
Scoreboard board = player.getScoreboard(); Scoreboard board = player.getScoreboard();
Objective obj; Objective obj;
if (board.getObjective("Vanadium") != null) obj = board.getObjective("Vanadium"); if (board.getObjective("Vanadium") != null) obj = board.getObjective("Vanadium");
else else obj = board.registerNewObjective("Vanadium", Criteria.DUMMY, ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
obj = board.registerNewObjective("Vanadium", Criteria.DUMMY, ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
obj.setDisplaySlot(DisplaySlot.SIDEBAR); obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score hypens = obj.getScore(ChatColor.GOLD + "=-=-=-=-=-=-=-="); Score hypens = obj.getScore(ChatColor.GOLD + "=-=-=-=-=-=-=-=");
hypens.setScore(9); hypens.setScore(9);
@ -59,13 +58,11 @@ public class SideBarManager {
board = new AnimatedSideBar(player.getUniqueId()); board = new AnimatedSideBar(player.getUniqueId());
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(main, new Runnable() { taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(main, new Runnable() {
int count = 0; int count = 0;
public void animate(String str) { public void animate(String str) {
Scoreboard board = player.getScoreboard(); Scoreboard board = player.getScoreboard();
Objective objective; Objective objective;
if (board.getObjective("Vanadium") != null) objective = board.getObjective("Vanadium"); if (board.getObjective("Vanadium") != null) objective = board.getObjective("Vanadium");
else else objective = board.registerNewObjective("Vanadium", Criteria.DUMMY, ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
objective = board.registerNewObjective("Vanadium", Criteria.DUMMY, ChatColor.AQUA.toString() + ChatColor.BOLD + ">> Vanadium <<");
objective.setDisplaySlot(DisplaySlot.SIDEBAR); objective.setDisplaySlot(DisplaySlot.SIDEBAR);
objective.setDisplayName(Util.color(str)); objective.setDisplayName(Util.color(str));
} }

View file

@ -5,7 +5,7 @@ api-version: 1.18
authors: [ NightKaly, Leocthl ] authors: [ NightKaly, Leocthl ]
description: Null Valkyrie description: Null Valkyrie
website: https://github.com/night0721/nullvalkyrie website: https://github.com/night0721/nullvalkyrie
depend: [ ProtocolLib ] depend: [ProtocolLib]
permissions: permissions:
nv.command.use: nv.command.use:
default: true default: true