This commit is contained in:
NK 2022-12-19 16:23:58 +00:00
parent fb5ac1851d
commit c89d48910c
6 changed files with 15 additions and 18 deletions

View file

@ -1,6 +1,5 @@
package me.night.nullvalkyrie; package me.night.nullvalkyrie;
import com.mongodb.client.MongoDatabase;
import io.github.cdimascio.dotenv.Dotenv; import io.github.cdimascio.dotenv.Dotenv;
import me.night.nullvalkyrie.events.listeners.*; import me.night.nullvalkyrie.events.listeners.*;
import me.night.nullvalkyrie.tasks.AlwaysDayTask; import me.night.nullvalkyrie.tasks.AlwaysDayTask;
@ -18,7 +17,6 @@ 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;
@Override @Override
public void onEnable() { public void onEnable() {

View file

@ -4,6 +4,7 @@ import org.bukkit.Bukkit;
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;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Arrays; import java.util.Arrays;
@ -29,13 +30,13 @@ public abstract class Command extends BukkitCommand {
} }
@Override @Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) { public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, String[] args) {
onCommand(sender, args); onCommand(sender, args);
return false; return false;
} }
@Override @Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { public @NotNull List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, String[] args) throws IllegalArgumentException {
return onTabComplete(sender, args); return onTabComplete(sender, args);
} }

View file

@ -23,16 +23,15 @@ public class PerPlayerHologram {
} }
} }
private void spawnLine(double y, Player player, String line) { private void spawnLine(double y, Player player, String line) {
EntityPlayer splayer = ((CraftPlayer) player).getHandle(); EntityPlayer p = ((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) EntityArmorStand stand = new EntityArmorStand(p.s, player.getLocation().getX(), y, player.getLocation().getZ());
stand.j(true); // set invisible stand.j(true);
PlayerConnection connection = splayer.b; //connection PlayerConnection connection = p.b;
connection.a(new PacketPlayOutSpawnEntity(stand)); // sending packet to spawn the armor stand connection.a(new PacketPlayOutSpawnEntity(stand));
DataWatcher watcher = stand.ai(); // ai = getDataWatcher DataWatcher watcher = stand.ai();
Optional<IChatBaseComponent> optional = Optional.of(IChatBaseComponent.a(line)); //according to wiki.vg, setting the custom name requires Optional<ChatComponent> 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 Optional<IChatBaseComponent> optional = Optional.of(IChatBaseComponent.a(line));
watcher.b(new DataWatcherObject<>(2, DataWatcherRegistry.f), optional); // f = ChatComponent, here we putting the optional<ChatComponent> into the datawatcher watcher.b(new DataWatcherObject<>(2, DataWatcherRegistry.f), optional);
watcher.b(new DataWatcherObject<>(3, DataWatcherRegistry.i), true); // i = boolean, we setting show custom name to true watcher.b(new DataWatcherObject<>(3, DataWatcherRegistry.i), true);
// watcher.b = set connection.a(new PacketPlayOutEntityMetadata(stand.ae(), watcher, true));
connection.a(new PacketPlayOutEntityMetadata(stand.ae(), watcher, true)); // sending packet to update the metadata, ae=getEntityId
} }
} }

View file

@ -18,7 +18,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
public class InventoryListener implements Listener { public class InventoryListener implements Listener {
RandomCollection<String> randomCollection; private final RandomCollection<String> randomCollection;
public InventoryListener() { public InventoryListener() {
randomCollection = new RandomCollection<>(); randomCollection = new RandomCollection<>();
for (Items e : Items.values()) { for (Items e : Items.values()) {

View file

@ -14,7 +14,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
public class Miner extends GUIManager { 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 @Override
public void UI(Player player) { public void UI(Player player) {
init(45, title); init(45, title);

View file

@ -7,7 +7,6 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scoreboard.*; import org.bukkit.scoreboard.*;
import org.bukkit.scoreboard.Scoreboard;
import java.util.UUID; import java.util.UUID;