diff --git a/src/main/java/me/night/nullvalkyrie/Main.java b/src/main/java/me/night/nullvalkyrie/Main.java index ccf670b..6635e0c 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 io.github.cdimascio.dotenv.Dotenv; import me.night.nullvalkyrie.events.listeners.*; import me.night.nullvalkyrie.tasks.AlwaysDayTask; import me.night.nullvalkyrie.ui.inventory.InventoryListener; @@ -8,7 +7,6 @@ import me.night.nullvalkyrie.database.NPCDataManager; import me.night.nullvalkyrie.discord.DiscordClientManager; import me.night.nullvalkyrie.util.enchantments.EnchantmentManager; import me.night.nullvalkyrie.ui.player.ScoreboardListener; -import me.night.nullvalkyrie.util.*; import me.night.nullvalkyrie.commands.*; import me.night.nullvalkyrie.database.DatabaseManager; import org.bukkit.*; @@ -16,13 +14,10 @@ import org.bukkit.plugin.java.JavaPlugin; public final class Main extends JavaPlugin { - public static Dotenv env; @Override public void onEnable() { EnchantmentManager.register(); - new FileManager(); - env = Dotenv.configure().directory("E:\\Files\\SB\\plugins\\NullValkyrie").filename(".env").load(); new DatabaseManager(); new CommandManager(); Bukkit.getPluginManager().registerEvents(new ServerEvents(), this); diff --git a/src/main/java/me/night/nullvalkyrie/commands/MinerCommand.java b/src/main/java/me/night/nullvalkyrie/commands/MinerCommand.java index cfed762..28f422a 100644 --- a/src/main/java/me/night/nullvalkyrie/commands/MinerCommand.java +++ b/src/main/java/me/night/nullvalkyrie/commands/MinerCommand.java @@ -11,7 +11,6 @@ import org.bukkit.util.StringUtil; import java.util.*; -import static me.night.nullvalkyrie.entities.miners.CryptoMiner.generate; public class MinerCommand extends Command { @@ -28,8 +27,6 @@ public class MinerCommand extends Command { } if (args[0].equalsIgnoreCase("list")) { new Miner().UI(player); - int seconds = (int) (new Date().getTime() - MinerDataManager.getLastClaim(1)) / 1000; - generate(50, seconds); } else if (args[0].equalsIgnoreCase("new")) { String name = args[2]; MinerType type = MinerType.getByName(args[1]); @@ -43,6 +40,8 @@ public class MinerCommand extends Command { } else if (args[0].equalsIgnoreCase("claim")) { MinerDataManager.setLastClaim(args[1]); player.sendMessage(ChatColor.GREEN + "Claimed"); + int seconds = (int) (new Date().getTime() - MinerDataManager.getLastClaim(1)) / 1000; + CryptoMiner.generate(50, seconds); } } } diff --git a/src/main/java/me/night/nullvalkyrie/commands/UtilCommand.java b/src/main/java/me/night/nullvalkyrie/commands/UtilCommand.java index 1d231dd..614fafa 100644 --- a/src/main/java/me/night/nullvalkyrie/commands/UtilCommand.java +++ b/src/main/java/me/night/nullvalkyrie/commands/UtilCommand.java @@ -44,7 +44,7 @@ public class UtilCommand extends Command { HashMap hh = CustomWeaponsDataManager.getWeapons(); ArrayList cc = new ArrayList<>(); for (String s : hh.keySet()) { - HashMap item = (HashMap) hh.get(s); + @SuppressWarnings("unchecked") HashMap item = (HashMap) hh.get(s); if (Objects.equals(item.get("Type"), "Util")) { cc.add((String) item.get("Name")); } diff --git a/src/main/java/me/night/nullvalkyrie/commands/WeaponCommand.java b/src/main/java/me/night/nullvalkyrie/commands/WeaponCommand.java index 98bd465..f953e6e 100644 --- a/src/main/java/me/night/nullvalkyrie/commands/WeaponCommand.java +++ b/src/main/java/me/night/nullvalkyrie/commands/WeaponCommand.java @@ -46,7 +46,7 @@ public class WeaponCommand extends Command { HashMap hh = CustomWeaponsDataManager.getWeapons(); ArrayList cc = new ArrayList<>(); for (String s : hh.keySet()) { - HashMap item = (HashMap) hh.get(s); + @SuppressWarnings("unchecked") HashMap item = (HashMap) hh.get(s); if (Objects.equals(item.get("Type"), "Weapon")) { cc.add((String) item.get("Name")); } diff --git a/src/main/java/me/night/nullvalkyrie/database/CustomWeaponsDataManager.java b/src/main/java/me/night/nullvalkyrie/database/CustomWeaponsDataManager.java index 665a546..4b6e151 100644 --- a/src/main/java/me/night/nullvalkyrie/database/CustomWeaponsDataManager.java +++ b/src/main/java/me/night/nullvalkyrie/database/CustomWeaponsDataManager.java @@ -9,12 +9,11 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; - +@SuppressWarnings("unchecked") public class CustomWeaponsDataManager { - - public static HashMap getWeapon(String itemName) { + public HashMap getWeapon(String itemName) { HashMap item = new HashMap<>(); - try (MongoCursor cursor = DatabaseManager.getCustomWeaponsDB().find(Filters.eq("Name", itemName)).cursor()) { + try (MongoCursor cursor = new DatabaseManager().getCustomWeaponsDB().find(Filters.eq("Name", itemName)).cursor()) { while (cursor.hasNext()) { Document doc = cursor.next(); String name = doc.getString("Name"); @@ -26,8 +25,7 @@ public class CustomWeaponsDataManager { HashMap prop = new HashMap<>(); abi.put("Name", ability.getString("Name")); List details = new ArrayList<>(); - if (ability.get("Details") != null) - details.addAll((List) ability.get("Details")); + if (ability.get("Details") != null) details.addAll((List) ability.get("Details")); abi.put("Details", details); for (String a : properties.keySet()) prop.put(a, properties.get(a)); lores.put("Ability", abi); @@ -40,8 +38,7 @@ public class CustomWeaponsDataManager { for (String a : attributes.keySet()) attr.put(a, attributes.get(a)); Document pdc = (Document) doc.get("PDC"); HashMap pdcdata = new HashMap<>(); - if (pdc != null) - for (String a : pdc.keySet()) pdcdata.put(a, pdc.get(a)); + if (pdc != null) for (String a : pdc.keySet()) pdcdata.put(a, pdc.get(a)); Document recipe = (Document) doc.get("Recipes"); HashMap recipes = new HashMap<>(); if (recipe != null) { @@ -71,7 +68,7 @@ public class CustomWeaponsDataManager { public static HashMap getWeapons() { HashMap list = new HashMap<>(); - try (MongoCursor cursor = DatabaseManager.getCustomWeaponsDB().find().cursor()) { + try (MongoCursor cursor = new DatabaseManager().getCustomWeaponsDB().find().cursor()) { while (cursor.hasNext()) { Document doc = cursor.next(); HashMap item = new HashMap<>(); @@ -84,8 +81,7 @@ public class CustomWeaponsDataManager { HashMap prop = new HashMap<>(); abi.put("Name", ability.getString("Name")); List details = new ArrayList<>(); - if (ability.get("Details") != null) - details.addAll((List) ability.get("Details")); + if (ability.get("Details") != null) details.addAll((List) ability.get("Details")); abi.put("Details", details); for (String a : properties.keySet()) prop.put(a, properties.get(a)); lores.put("Ability", abi); diff --git a/src/main/java/me/night/nullvalkyrie/database/DatabaseManager.java b/src/main/java/me/night/nullvalkyrie/database/DatabaseManager.java index 7dde2a8..8275c0f 100644 --- a/src/main/java/me/night/nullvalkyrie/database/DatabaseManager.java +++ b/src/main/java/me/night/nullvalkyrie/database/DatabaseManager.java @@ -1,37 +1,36 @@ package me.night.nullvalkyrie.database; import com.mongodb.client.*; -import me.night.nullvalkyrie.Main; import org.bson.Document; public class DatabaseManager { public static MongoDatabase database; public DatabaseManager() { - database = MongoClients.create(Main.env.get("MONGODB_URI")).getDatabase("NullValkyrie"); + database = MongoClients.create(System.getenv("MONGODB_URI")).getDatabase("NullValkyrie"); } - public static MongoCollection getMinersDB() { + public MongoCollection getMinersDB() { return database.getCollection("miners"); } - public static MongoCollection getShopsDB() { + public MongoCollection getShopsDB() { return database.getCollection("shops"); } - public static MongoCollection getRanksDB() { + public MongoCollection getRanksDB() { return database.getCollection("ranks"); } - public static MongoCollection getNPCsDB() { + public MongoCollection getNPCsDB() { return database.getCollection("npcs"); } - public static MongoCollection getUsersDB() { + public MongoCollection getUsersDB() { return database.getCollection("users"); } - public static MongoCollection getCustomWeaponsDB() { + public MongoCollection getCustomWeaponsDB() { return database.getCollection("custom_weapons"); } diff --git a/src/main/java/me/night/nullvalkyrie/database/MinerDataManager.java b/src/main/java/me/night/nullvalkyrie/database/MinerDataManager.java index 1b9f740..79a36ce 100644 --- a/src/main/java/me/night/nullvalkyrie/database/MinerDataManager.java +++ b/src/main/java/me/night/nullvalkyrie/database/MinerDataManager.java @@ -11,27 +11,27 @@ import java.util.HashMap; public class MinerDataManager { public static void setMiner(String name, MinerType type, int level, double rate, boolean enabled, long lastclaim) { Document newDocument = new Document(); - newDocument.put("ID", DatabaseManager.getMinersDB().countDocuments() + 1); + newDocument.put("ID", new DatabaseManager().getMinersDB().countDocuments() + 1); newDocument.put("Name", name); newDocument.put("Material", type.getName()); newDocument.put("Level", level); newDocument.put("Rate", rate); newDocument.put("Enabled", enabled); newDocument.put("LastClaim", lastclaim); - DatabaseManager.getMinersDB().insertOne(newDocument); + new DatabaseManager().getMinersDB().insertOne(newDocument); } public static void setLastClaim(String name) { - Document document = DatabaseManager.getMinersDB().find(new Document("Name", name)).first(); + Document document = new DatabaseManager().getMinersDB().find(new Document("Name", name)).first(); if (document != null) { Bson updated = new Document("LastClaim", System.currentTimeMillis()); Bson update = new Document("$set", updated); - DatabaseManager.getMinersDB().updateOne(document, update); + new DatabaseManager().getMinersDB().updateOne(document, update); } } public static long getLastClaim(long id) { - Document doc = DatabaseManager.getMinersDB().find(new Document("ID", id)).first(); + Document doc = new DatabaseManager().getMinersDB().find(new Document("ID", id)).first(); if (doc != null) { for (String key : doc.keySet()) { if (key.equals("LastClaim")) return (long) doc.get(key); @@ -41,7 +41,7 @@ public class MinerDataManager { } public static CryptoMiner getMiner(long id) { - Document doc = DatabaseManager.getMinersDB().find(new Document("ID", id)).first(); + Document doc = new DatabaseManager().getMinersDB().find(new Document("ID", id)).first(); if (doc != null) { return new CryptoMiner(doc.getString("Name"), MinerType.getByName(doc.getString("Material")), doc.getInteger("Level"), doc.getDouble("Rate"), doc.getLong("LastClaim")); } @@ -50,7 +50,7 @@ public class MinerDataManager { public static HashMap getMiners() { HashMap list = new HashMap<>(); - try (MongoCursor cursor = DatabaseManager.getMinersDB().find().cursor()) { + try (MongoCursor cursor = new DatabaseManager().getMinersDB().find().cursor()) { while (cursor.hasNext()) { Document doc = cursor.next(); list.put(doc.getLong("ID"), new CryptoMiner(doc.getString("Name"), MinerType.getByName(doc.getString("Material")), doc.getInteger("Level"), doc.getDouble("Rate"), doc.getLong("LastClaim"))); diff --git a/src/main/java/me/night/nullvalkyrie/database/NPCDataManager.java b/src/main/java/me/night/nullvalkyrie/database/NPCDataManager.java index 1238f6d..5724f95 100644 --- a/src/main/java/me/night/nullvalkyrie/database/NPCDataManager.java +++ b/src/main/java/me/night/nullvalkyrie/database/NPCDataManager.java @@ -11,7 +11,7 @@ import java.util.List; public class NPCDataManager { public static void setNPC(String name, int x, int y, int z, int pitch, int yaw, String world, String texture, String signature) { - Document document = DatabaseManager.getNPCsDB().find(new Document("Name", name)).first(); + Document document = new DatabaseManager().getNPCsDB().find(new Document("Name", name)).first(); if (document != null) { System.out.println("A NPC with this name already exist"); } else { @@ -25,13 +25,13 @@ public class NPCDataManager { newDocument.put("world", world); newDocument.put("texture", texture); newDocument.put("signature", signature); - DatabaseManager.getNPCsDB().insertOne(newDocument); + new DatabaseManager().getNPCsDB().insertOne(newDocument); } } public static void reloadNPC() { List> npcList = new ArrayList<>(); - try (MongoCursor cursor = DatabaseManager.getNPCsDB().find().cursor()) { + try (MongoCursor cursor = new DatabaseManager().getNPCsDB().find().cursor()) { while (cursor.hasNext()) { Document document = cursor.next(); HashMap npc = new HashMap<>(); diff --git a/src/main/java/me/night/nullvalkyrie/database/RankDataManager.java b/src/main/java/me/night/nullvalkyrie/database/RankDataManager.java index 29c9f5d..1a0489a 100644 --- a/src/main/java/me/night/nullvalkyrie/database/RankDataManager.java +++ b/src/main/java/me/night/nullvalkyrie/database/RankDataManager.java @@ -2,6 +2,7 @@ package me.night.nullvalkyrie.database; import com.mongodb.client.MongoCursor; import me.night.nullvalkyrie.enums.Rank; +import me.night.nullvalkyrie.ui.player.ScoreboardListener; import org.bson.Document; import org.bson.conversions.Bson; import org.bukkit.Bukkit; @@ -9,31 +10,29 @@ import org.bukkit.entity.Player; import java.util.UUID; -import static me.night.nullvalkyrie.ui.player.ScoreboardListener.nameTagManager; - public class RankDataManager { - public static void setRank(UUID uuid, Rank rank) { - Document document = DatabaseManager.getRanksDB().find(new Document("UUID", uuid.toString())).first(); + public static void setRank(UUID uuid, Rank rank, ScoreboardListener... listener) { + Document document = new DatabaseManager().getRanksDB().find(new Document("UUID", uuid.toString())).first(); if (document != null) { Bson updated = new Document("Rank", rank.name()); Bson update = new Document("$set", updated); - DatabaseManager.getRanksDB().updateOne(document, update); + new DatabaseManager().getRanksDB().updateOne(document, update); } else { Document newDocument = new Document(); newDocument.put("UUID", uuid.toString()); newDocument.put("Rank", rank.name()); - DatabaseManager.getRanksDB().insertOne(newDocument); + new DatabaseManager().getRanksDB().insertOne(newDocument); } for (Player player : Bukkit.getOnlinePlayers()) { if (player.hasPlayedBefore()) { - nameTagManager.removeTag(player); - nameTagManager.newTag(player); + listener[0].nameTagManager.removeTag(player); + listener[0].nameTagManager.newTag(player); } } } public static Rank getRank(UUID uuid) { - try (MongoCursor cursor = DatabaseManager.getRanksDB().find(new Document("UUID", uuid.toString())).cursor()) { + try (MongoCursor cursor = new DatabaseManager().getRanksDB().find(new Document("UUID", uuid.toString())).cursor()) { while (cursor.hasNext()) { Document doc = cursor.next(); for (String key : doc.keySet()) { diff --git a/src/main/java/me/night/nullvalkyrie/database/ShopDataManager.java b/src/main/java/me/night/nullvalkyrie/database/ShopDataManager.java index 9e0e585..d3a1422 100644 --- a/src/main/java/me/night/nullvalkyrie/database/ShopDataManager.java +++ b/src/main/java/me/night/nullvalkyrie/database/ShopDataManager.java @@ -8,7 +8,7 @@ import java.util.HashMap; public class ShopDataManager { public static HashMap getItems() { HashMap list = new HashMap<>(); - try (MongoCursor cursor = DatabaseManager.getShopsDB().find().cursor()) { + try (MongoCursor cursor = new DatabaseManager().getShopsDB().find().cursor()) { while (cursor.hasNext()) { Document doc = cursor.next(); list.put(doc.getString("Name"), doc.getInteger("Price")); diff --git a/src/main/java/me/night/nullvalkyrie/database/UserDataManager.java b/src/main/java/me/night/nullvalkyrie/database/UserDataManager.java index 4a9e7f8..ab03af9 100644 --- a/src/main/java/me/night/nullvalkyrie/database/UserDataManager.java +++ b/src/main/java/me/night/nullvalkyrie/database/UserDataManager.java @@ -7,34 +7,34 @@ import org.bson.conversions.Bson; import java.util.HashMap; public class UserDataManager { - public static void createUserBank(String uuid) { + public void createUserBank(String uuid) { Document document = new Document(); document.put("UUID", uuid); document.put("Bank", 0); - DatabaseManager.getUsersDB().insertOne(document); + new DatabaseManager().getUsersDB().insertOne(document); } - public static void updateUserBank(String uuid, Integer coins) { - Document document = DatabaseManager.getUsersDB().find(new Document("UUID", uuid)).first(); + public void updateUserBank(String uuid, Integer coins, ScoreboardListener... listener) { + Document document = new DatabaseManager().getUsersDB().find(new Document("UUID", uuid)).first(); if (document != null) { Integer coinsBefore = document.getInteger("Bank"); Bson updated = new Document("Bank", coins + coinsBefore); Bson update = new Document("$set", updated); - DatabaseManager.getUsersDB().updateOne(document, update); - ScoreboardListener.sideBarManager.addBank(uuid, coins); + new DatabaseManager().getUsersDB().updateOne(document, update); + listener[0].sideBarManager.addBank(uuid, coins); } else { Document doc = new Document(); doc.put("UUID", uuid); doc.put("Bank", coins); - DatabaseManager.getUsersDB().insertOne(doc); - ScoreboardListener.sideBarManager.addBank(uuid, coins); + new DatabaseManager().getUsersDB().insertOne(doc); + listener[0].sideBarManager.addBank(uuid, coins); } } - public static HashMap getUser(String uuid) { - Document document = DatabaseManager.getUsersDB().find(new Document("UUID", uuid)).first(); + public HashMap getUser(String uuid) { + Document document = new DatabaseManager().getUsersDB().find(new Document("UUID", uuid)).first(); if (document != null) { HashMap map = new HashMap<>(); for (String key : document.keySet()) map.put(key, document.get(key)); diff --git a/src/main/java/me/night/nullvalkyrie/discord/DiscordClientManager.java b/src/main/java/me/night/nullvalkyrie/discord/DiscordClientManager.java index 8247a06..c49494d 100644 --- a/src/main/java/me/night/nullvalkyrie/discord/DiscordClientManager.java +++ b/src/main/java/me/night/nullvalkyrie/discord/DiscordClientManager.java @@ -1,6 +1,5 @@ package me.night.nullvalkyrie.discord; -import me.night.nullvalkyrie.Main; import net.dv8tion.jda.api.JDA; import net.dv8tion.jda.api.JDABuilder; import net.dv8tion.jda.api.entities.Activity; @@ -15,10 +14,11 @@ public class DiscordClientManager { } public void register() { - JDABuilder builder = JDABuilder.createDefault(Main.env.get("DISCORD_TOKEN")); + JDABuilder builder = JDABuilder.createDefault(System.getenv("DISCORD_TOKEN")); builder.setActivity(Activity.streaming("cath.exe", "https://www.youtube.com/watch?v=YSKDu1gKntY")); try { JDA jda = builder.build(); + System.out.println(jda.getSelfUser().getName()); } catch (LoginException e) { e.printStackTrace(); } diff --git a/src/main/java/me/night/nullvalkyrie/entities/items/CustomItemManager.java b/src/main/java/me/night/nullvalkyrie/entities/items/CustomItemManager.java index 37c1c2e..405bf7e 100644 --- a/src/main/java/me/night/nullvalkyrie/entities/items/CustomItemManager.java +++ b/src/main/java/me/night/nullvalkyrie/entities/items/CustomItemManager.java @@ -1,6 +1,7 @@ package me.night.nullvalkyrie.entities.items; import me.night.nullvalkyrie.Main; +import me.night.nullvalkyrie.database.CustomWeaponsDataManager; import me.night.nullvalkyrie.enums.Rarity; import me.night.nullvalkyrie.util.Util; import org.bukkit.Bukkit; @@ -15,23 +16,21 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.persistence.PersistentDataContainer; import org.bukkit.persistence.PersistentDataType; -import java.io.File; import java.util.*; -import static me.night.nullvalkyrie.database.CustomWeaponsDataManager.getWeapon; - public class CustomItemManager { public static final HashMap keys = new HashMap<>(); + @SuppressWarnings("unchecked") public static ItemStack produceItem(String itemName) { - HashMap weapon = getWeapon(itemName); + HashMap weapon = new CustomWeaponsDataManager().getWeapon(itemName); ItemStack item = new ItemStack((Material) weapon.get("Material")); List propertiesList = new ArrayList<>(); List itemAbility = new ArrayList<>(); HashMap enchants = (HashMap) weapon.get("Enchants"); HashMap attributes = (HashMap) weapon.get("Attributes"); for (String enchant : enchants.keySet()) - item.addUnsafeEnchantment(Enchantment.getByKey(NamespacedKey.minecraft(enchant)), (Integer) enchants.get(enchant)); + item.addUnsafeEnchantment(Objects.requireNonNull(Enchantment.getByKey(NamespacedKey.minecraft(enchant))), (Integer) enchants.get(enchant)); HashMap lore = (HashMap) weapon.get("Lore"); HashMap ability = (HashMap) lore.get("Ability"); HashMap properties = (HashMap) lore.get("Properties"); @@ -113,10 +112,4 @@ public class CustomItemManager { if (Bukkit.getRecipe(nsk) != null) Bukkit.removeRecipe(nsk); Bukkit.addRecipe(recipe); } - - public static void updateYamlFilesToPlugin(String path) { - File file = new File(Main.getPlugin(Main.class).getDataFolder(), path); - if (!file.exists()) Main.getPlugin(Main.class).saveResource(path, true); - else Main.getPlugin(Main.class).saveResource(path, true); - } } diff --git a/src/main/java/me/night/nullvalkyrie/ui/player/ScoreboardListener.java b/src/main/java/me/night/nullvalkyrie/ui/player/ScoreboardListener.java index 6135e18..33f8a8e 100644 --- a/src/main/java/me/night/nullvalkyrie/ui/player/ScoreboardListener.java +++ b/src/main/java/me/night/nullvalkyrie/ui/player/ScoreboardListener.java @@ -1,6 +1,7 @@ package me.night.nullvalkyrie.ui.player; import me.night.nullvalkyrie.database.RankDataManager; +import me.night.nullvalkyrie.database.UserDataManager; import me.night.nullvalkyrie.enums.Rank; import me.night.nullvalkyrie.entities.npcs.NPCManager; import org.bukkit.Bukkit; @@ -12,12 +13,11 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; -import static me.night.nullvalkyrie.database.UserDataManager.createUserBank; - +@SuppressWarnings("ConstantConditions") public class ScoreboardListener implements Listener { - public static NameTagManager nameTagManager; - public static SideBarManager sideBarManager; + public NameTagManager nameTagManager; + public SideBarManager sideBarManager; private final BelowNameManager belowNameManager; public ScoreboardListener() { @@ -31,8 +31,8 @@ public class ScoreboardListener implements Listener { Player player = e.getPlayer(); if (!player.hasPlayedBefore()) { e.getPlayer().sendTitle(ChatColor.RED + "Welcome to Vanadium!", ChatColor.GREEN + "LOL", 20, 100, 20); - RankDataManager.setRank(player.getUniqueId(), Rank.ROOKIE); - createUserBank(e.getPlayer().getUniqueId().toString()); + RankDataManager.setRank(player.getUniqueId(), Rank.ROOKIE, this); + new UserDataManager().createUserBank(e.getPlayer().getUniqueId().toString()); } e.getPlayer().setPlayerListHeaderFooter(ChatColor.AQUA + "You are playing on " + ChatColor.GREEN + "127.0.0.1", ChatColor.GOLD + "Ranks, boosters, & more!" + ChatColor.AQUA + "127.0.0.1"); nameTagManager.setNametags(player); 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 9442b0e..8951407 100644 --- a/src/main/java/me/night/nullvalkyrie/ui/player/SideBarManager.java +++ b/src/main/java/me/night/nullvalkyrie/ui/player/SideBarManager.java @@ -10,6 +10,7 @@ import org.bukkit.scoreboard.*; import java.util.UUID; +@SuppressWarnings("ConstantConditions") public class SideBarManager { private int taskID; public AnimatedSideBar board = null; @@ -42,7 +43,7 @@ public class SideBarManager { else bankTeam = board.registerNewTeam("Bank"); bankTeam.addEntry(ChatColor.BOLD.toString()); bankTeam.setPrefix(ChatColor.BLUE + "Bank: "); - bankTeam.setSuffix(ChatColor.YELLOW + UserDataManager.getUser(player.getUniqueId().toString()).get("Bank").toString()); + bankTeam.setSuffix(ChatColor.YELLOW + new UserDataManager().getUser(player.getUniqueId().toString()).get("Bank").toString()); obj.getScore(ChatColor.BOLD.toString()).setScore(3); player.setScoreboard(board); } @@ -91,6 +92,6 @@ public class SideBarManager { public void addBank(String uuid, Integer amount) { UUID uid = UUID.fromString(uuid); - Bukkit.getPlayer(uid).getScoreboard().getTeam("Bank").setSuffix(ChatColor.YELLOW.toString() + UserDataManager.getUser(uuid).get("Bank") + ChatColor.WHITE + "+(" + amount + ")"); + Bukkit.getPlayer(uid).getScoreboard().getTeam("Bank").setSuffix(ChatColor.YELLOW.toString() + new UserDataManager().getUser(uuid).get("Bank") + ChatColor.WHITE + "+(" + amount + ")"); } } diff --git a/src/main/java/me/night/nullvalkyrie/util/FileManager.java b/src/main/java/me/night/nullvalkyrie/util/FileManager.java deleted file mode 100644 index 4c3521f..0000000 --- a/src/main/java/me/night/nullvalkyrie/util/FileManager.java +++ /dev/null @@ -1,9 +0,0 @@ -package me.night.nullvalkyrie.util; - -import static me.night.nullvalkyrie.entities.items.CustomItemManager.updateYamlFilesToPlugin; - -public class FileManager { - public FileManager() { - updateYamlFilesToPlugin(".env"); - } -} diff --git a/src/main/java/me/night/nullvalkyrie/util/enchantments/EnchantmentManager.java b/src/main/java/me/night/nullvalkyrie/util/enchantments/EnchantmentManager.java index db86428..0187c24 100644 --- a/src/main/java/me/night/nullvalkyrie/util/enchantments/EnchantmentManager.java +++ b/src/main/java/me/night/nullvalkyrie/util/enchantments/EnchantmentManager.java @@ -9,7 +9,8 @@ import java.util.Arrays; import java.util.List; public class EnchantmentManager { - public static List enchants = new ArrayList<>(); + public static final List enchants = new ArrayList<>(); + public static void register() { List registeredList = new ArrayList<>(); for (Enchantments enchantment : Enchantments.values()) {