diff --git a/src/main/java/me/night/nullvalkyrie/Main.java b/src/main/java/me/night/nullvalkyrie/Main.java index 79a0c9b..94fdc31 100644 --- a/src/main/java/me/night/nullvalkyrie/Main.java +++ b/src/main/java/me/night/nullvalkyrie/Main.java @@ -1,6 +1,5 @@ package me.night.nullvalkyrie; -import com.mongodb.client.MongoDatabase; import io.github.cdimascio.dotenv.Dotenv; import me.night.nullvalkyrie.events.listeners.*; import me.night.nullvalkyrie.tasks.AlwaysDayTask; @@ -18,7 +17,6 @@ import org.bukkit.plugin.java.JavaPlugin; public final class Main extends JavaPlugin { public static Dotenv env; - public static MongoDatabase database; @Override public void onEnable() { diff --git a/src/main/java/me/night/nullvalkyrie/commands/Command.java b/src/main/java/me/night/nullvalkyrie/commands/Command.java index 328a61d..04f43b6 100644 --- a/src/main/java/me/night/nullvalkyrie/commands/Command.java +++ b/src/main/java/me/night/nullvalkyrie/commands/Command.java @@ -4,6 +4,7 @@ import org.bukkit.Bukkit; import org.bukkit.command.CommandMap; import org.bukkit.command.CommandSender; import org.bukkit.command.defaults.BukkitCommand; +import org.jetbrains.annotations.NotNull; import java.lang.reflect.Field; import java.util.Arrays; @@ -29,13 +30,13 @@ public abstract class Command extends BukkitCommand { } @Override - public boolean execute(CommandSender sender, String commandLabel, String[] args) { + public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, String[] args) { onCommand(sender, args); return false; } @Override - public List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { + public @NotNull List tabComplete(@NotNull CommandSender sender, @NotNull String alias, String[] args) throws IllegalArgumentException { return onTabComplete(sender, args); } diff --git a/src/main/java/me/night/nullvalkyrie/entities/holograms/PerPlayerHologram.java b/src/main/java/me/night/nullvalkyrie/entities/holograms/PerPlayerHologram.java index 04b63a7..4bfc98a 100644 --- a/src/main/java/me/night/nullvalkyrie/entities/holograms/PerPlayerHologram.java +++ b/src/main/java/me/night/nullvalkyrie/entities/holograms/PerPlayerHologram.java @@ -23,16 +23,15 @@ public class PerPlayerHologram { } } private void spawnLine(double y, Player player, String line) { - EntityPlayer splayer = ((CraftPlayer) player).getHandle(); - EntityArmorStand stand = new EntityArmorStand(splayer.s, player.getLocation().getX(), y, player.getLocation().getZ()); // creating armor stand by location and s(stands for nms world) - stand.j(true); // set invisible - PlayerConnection connection = splayer.b; //connection - connection.a(new PacketPlayOutSpawnEntity(stand)); // sending packet to spawn the armor stand - DataWatcher watcher = stand.ai(); // ai = getDataWatcher - Optional optional = Optional.of(IChatBaseComponent.a(line)); //according to wiki.vg, setting the custom name requires Optional if you are using mojang mappings, however i cant find out what a stands for, just find a method that returns ChatComponent which takes string as a parameter - watcher.b(new DataWatcherObject<>(2, DataWatcherRegistry.f), optional); // f = ChatComponent, here we putting the optional into the datawatcher - watcher.b(new DataWatcherObject<>(3, DataWatcherRegistry.i), true); // i = boolean, we setting show custom name to true - // watcher.b = set - connection.a(new PacketPlayOutEntityMetadata(stand.ae(), watcher, true)); // sending packet to update the metadata, ae=getEntityId + EntityPlayer p = ((CraftPlayer) player).getHandle(); + EntityArmorStand stand = new EntityArmorStand(p.s, player.getLocation().getX(), y, player.getLocation().getZ()); + stand.j(true); + PlayerConnection connection = p.b; + connection.a(new PacketPlayOutSpawnEntity(stand)); + DataWatcher watcher = stand.ai(); + Optional optional = Optional.of(IChatBaseComponent.a(line)); + watcher.b(new DataWatcherObject<>(2, DataWatcherRegistry.f), optional); + watcher.b(new DataWatcherObject<>(3, DataWatcherRegistry.i), true); + connection.a(new PacketPlayOutEntityMetadata(stand.ae(), watcher, true)); } } diff --git a/src/main/java/me/night/nullvalkyrie/ui/inventory/InventoryListener.java b/src/main/java/me/night/nullvalkyrie/ui/inventory/InventoryListener.java index dc09eae..b00f89f 100644 --- a/src/main/java/me/night/nullvalkyrie/ui/inventory/InventoryListener.java +++ b/src/main/java/me/night/nullvalkyrie/ui/inventory/InventoryListener.java @@ -18,7 +18,7 @@ import java.util.Collections; import java.util.List; public class InventoryListener implements Listener { - RandomCollection randomCollection; + private final RandomCollection randomCollection; public InventoryListener() { randomCollection = new RandomCollection<>(); for (Items e : Items.values()) { diff --git a/src/main/java/me/night/nullvalkyrie/ui/inventory/Miner.java b/src/main/java/me/night/nullvalkyrie/ui/inventory/Miner.java index 7b68196..ccdd6a8 100644 --- a/src/main/java/me/night/nullvalkyrie/ui/inventory/Miner.java +++ b/src/main/java/me/night/nullvalkyrie/ui/inventory/Miner.java @@ -14,7 +14,7 @@ import java.util.Date; import java.util.List; public class Miner extends GUIManager { - public static String title = ChatColor.DARK_AQUA + "Crypto Miners"; + public static final String title = ChatColor.DARK_AQUA + "Crypto Miners"; @Override public void UI(Player player) { init(45, title); diff --git a/src/main/java/me/night/nullvalkyrie/ui/player/SideBarManager.java b/src/main/java/me/night/nullvalkyrie/ui/player/SideBarManager.java index 183d58b..9442b0e 100644 --- a/src/main/java/me/night/nullvalkyrie/ui/player/SideBarManager.java +++ b/src/main/java/me/night/nullvalkyrie/ui/player/SideBarManager.java @@ -7,7 +7,6 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.scoreboard.*; -import org.bukkit.scoreboard.Scoreboard; import java.util.UUID;