diff --git a/api/src/main/java/net/momirealms/customfishing/api/util/ReflectionUtils.java b/api/src/main/java/net/momirealms/customfishing/api/util/ReflectionUtils.java index abcf3a4c..5283a8de 100644 --- a/api/src/main/java/net/momirealms/customfishing/api/util/ReflectionUtils.java +++ b/api/src/main/java/net/momirealms/customfishing/api/util/ReflectionUtils.java @@ -37,22 +37,7 @@ public class ReflectionUtils { public static Class bukkitClass; public static void load() { - // spigot map - try { - Class bar = Class.forName("net.minecraft.network.protocol.game.PacketPlayOutBoss"); - Field remove = bar.getDeclaredField("f"); - remove.setAccessible(true); - removeBossBarPacket = remove.get(null); - Class packetBossClassF = Class.forName("net.minecraft.network.protocol.game.PacketPlayOutBoss$f"); - progressConstructor = packetBossClassF.getDeclaredConstructor(float.class); - progressConstructor.setAccessible(true); - Class packetBossClassE = Class.forName("net.minecraft.network.protocol.game.PacketPlayOutBoss$e"); - updateConstructor = packetBossClassE.getDeclaredConstructor(MinecraftReflection.getIChatBaseComponentClass()); - updateConstructor.setAccessible(true); - iChatComponentMethod = MinecraftReflection.getChatSerializerClass().getMethod("a", String.class); - iChatComponentMethod.setAccessible(true); - } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException | NoSuchMethodException e1) { - // mojmap + if (CustomFishingPlugin.get().getVersionManager().isMojmap()) { try { Class bar = Class.forName("net.minecraft.network.protocol.game.ClientboundBossEventPacket"); Field remove = bar.getDeclaredField("REMOVE_OPERATION"); @@ -64,13 +49,29 @@ public class ReflectionUtils { Class packetBossClassE = Class.forName("net.minecraft.network.protocol.game.ClientboundBossEventPacket$UpdateNameOperation"); updateConstructor = packetBossClassE.getDeclaredConstructor(MinecraftReflection.getIChatBaseComponentClass()); updateConstructor.setAccessible(true); - iChatComponentMethod = MinecraftReflection.getChatSerializerClass().getMethod("fromJson", String.class); + Class craftChatMessageClass = Class.forName("org.bukkit.craftbukkit.util.CraftChatMessage"); + iChatComponentMethod = craftChatMessageClass.getDeclaredMethod("fromJSON", String.class); iChatComponentMethod.setAccessible(true); - } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException | NoSuchMethodException e2) { - LogUtils.severe("Error occurred when loading reflections", e2); - e2.printStackTrace(); + } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException | NoSuchMethodException exception) { + LogUtils.severe("Error occurred when loading reflections", exception); + } + } else { + try { + Class bar = Class.forName("net.minecraft.network.protocol.game.PacketPlayOutBoss"); + Field remove = bar.getDeclaredField("f"); + remove.setAccessible(true); + removeBossBarPacket = remove.get(null); + Class packetBossClassF = Class.forName("net.minecraft.network.protocol.game.PacketPlayOutBoss$f"); + progressConstructor = packetBossClassF.getDeclaredConstructor(float.class); + progressConstructor.setAccessible(true); + Class packetBossClassE = Class.forName("net.minecraft.network.protocol.game.PacketPlayOutBoss$e"); + updateConstructor = packetBossClassE.getDeclaredConstructor(MinecraftReflection.getIChatBaseComponentClass()); + updateConstructor.setAccessible(true); + iChatComponentMethod = MinecraftReflection.getChatSerializerClass().getMethod("a", String.class); + iChatComponentMethod.setAccessible(true); + } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException | NoSuchMethodException exception) { + LogUtils.severe("Error occurred when loading reflections", exception); } - return; } if (CustomFishingPlugin.get().getVersionManager().isSpigot()) return; try { @@ -82,11 +83,8 @@ public class ReflectionUtils { gsonInstance = gsonMethod.invoke(null); gsonDeserializeMethod = gsonComponentSerializerImplClass.getMethod("deserialize", String.class); gsonDeserializeMethod.setAccessible(true); - } catch (ClassNotFoundException exception) { + } catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException exception) { LogUtils.severe("Error occurred when loading reflections", exception); - exception.printStackTrace(); - } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { - throw new RuntimeException(e); } } } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index ca022ea9..cc7d9a9e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,17 +2,17 @@ plugins { id("java") id("application") id("maven-publish") - id("com.github.johnrengelman.shadow") version "8.1.1" + id("io.github.goooler.shadow") version "8.1.7" } allprojects { - version = "2.1.6.1" + version = "2.2.0" apply() apply(plugin = "java") apply(plugin = "application") - apply(plugin = "com.github.johnrengelman.shadow") + apply(plugin = "io.github.goooler.shadow") apply(plugin = "org.gradle.maven-publish") application { diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 156ac1ab..93a55d56 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -1,15 +1,12 @@ dependencies { // server - compileOnly("dev.folia:folia-api:1.20.1-R0.1-SNAPSHOT") + compileOnly("dev.folia:folia-api:1.20.4-R0.1-SNAPSHOT") // packet compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0") // command - compileOnly("dev.jorel:commandapi-bukkit-core:9.4.0") - - // nbt - compileOnly("de.tr7zw:item-nbt-api:2.12.4") + compileOnly("dev.jorel:commandapi-bukkit-core:9.4.1") // bStats compileOnly("org.bstats:bstats-bukkit:3.0.2") @@ -51,9 +48,7 @@ dependencies { compileOnly("dev.aurelium:auraskills-api-bukkit:2.0.0-SNAPSHOT") compileOnly("com.github.MilkBowl:VaultAPI:1.7") compileOnly("org.betonquest:betonquest:2.0.0") - compileOnly("xyz.xenondevs.invui:invui:1.30") compileOnly("com.github.Xiao-MoMi:Custom-Crops:3.4.4.1") - compileOnly("com.github.Xiao-MoMi:BiomeAPI:0.6") compileOnly("org.apache.commons:commons-lang3:3.14.0") // local jars @@ -65,17 +60,32 @@ dependencies { compileOnly(files("libs/notquests-5.17.1.jar")) compileOnly(files("libs/zaphkiel-2.0.24.jar")) - // api module - implementation(project(":api")) { - exclude("de.tr7zw") + // GUI + implementation("xyz.xenondevs.invui:invui:1.30") { + exclude("org.jetbrains", "annotations") } + // nbt + implementation("de.tr7zw:item-nbt-api:2.12.4") + + // api module + implementation(project(":api")) + + // sparrow heart + implementation("com.github.Xiao-MoMi:Sparrow-Heart:0.16") + // adventure - compileOnly("net.kyori:adventure-api:4.16.0") + implementation("net.kyori:adventure-api:4.17.0") + implementation("net.kyori:adventure-text-minimessage:4.17.0") + implementation("net.kyori:adventure-text-serializer-gson:4.17.0") { + exclude("com.google.code.gson", "gson") + } + implementation("net.kyori:adventure-platform-bukkit:4.3.2") } tasks { shadowJar { + exclude("org.jetbrains:annotations:*") relocate ("org.apache.commons.pool2", "net.momirealms.customfishing.libraries.commonspool2") relocate ("org.apache.commons.lang3", "net.momirealms.customfishing.libraries.lang3") relocate ("com.mysql", "net.momirealms.customfishing.libraries.mysql") @@ -90,7 +100,11 @@ tasks { relocate ("dev.jorel.commandapi", "net.momirealms.customfishing.libraries.commandapi") relocate ("dev.dejvokep.boostedyaml", "net.momirealms.customfishing.libraries.boostedyaml") relocate ("org.bstats", "net.momirealms.customfishing.libraries.bstats") - relocate ("net.momirealms.biomeapi", "net.momirealms.customfishing.libraries.biomeapi") + relocate ("net.momirealms.sparrow.heart", "net.momirealms.customfishing.libraries.heart") relocate ("xyz.xenondevs", "net.momirealms.customfishing.libraries") } } + +tasks.withType { + options.encoding = "UTF-8" +} \ No newline at end of file diff --git a/plugin/src/main/java/net/momirealms/customfishing/CustomFishingPluginImpl.java b/plugin/src/main/java/net/momirealms/customfishing/CustomFishingPluginImpl.java index abb448a7..5cb7bb1e 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/CustomFishingPluginImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/CustomFishingPluginImpl.java @@ -21,7 +21,7 @@ import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolManager; import com.comphenix.protocol.events.PacketContainer; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.event.CustomFishingReloadEvent; import net.momirealms.customfishing.api.util.LogUtils; @@ -64,8 +64,9 @@ import org.bukkit.event.HandlerList; import org.jetbrains.annotations.NotNull; import java.io.File; -import java.lang.reflect.Field; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; public class CustomFishingPluginImpl extends CustomFishingPlugin { @@ -80,17 +81,14 @@ public class CustomFishingPluginImpl extends CustomFishingPlugin { @Override public void onLoad() { + this.versionManager = new VersionManagerImpl(this); this.dependencyManager = new DependencyManagerImpl(this, new ReflectionClassPathAppender(this.getClassLoader())); this.dependencyManager.loadDependencies(new ArrayList<>( List.of( Dependency.GSON, Dependency.SLF4J_API, Dependency.SLF4J_SIMPLE, - Dependency.COMMAND_API, Dependency.BOOSTED_YAML, - Dependency.ADVENTURE_BUNDLE, - Dependency.BIOME_API, - Dependency.NBT_API, Dependency.EXP4J, Dependency.MYSQL_DRIVER, Dependency.MARIADB_DRIVER, @@ -105,9 +103,7 @@ public class CustomFishingPluginImpl extends CustomFishingPlugin { Dependency.BSTATS_BASE, Dependency.HIKARI, Dependency.BSTATS_BUKKIT, - Dependency.INV_UI, - Dependency.INV_UI_ACCESS, - Dependency.INV_UI_NMS + versionManager.isMojmap() ? Dependency.COMMAND_API_MOJMAP : Dependency.COMMAND_API ) )); } @@ -115,12 +111,12 @@ public class CustomFishingPluginImpl extends CustomFishingPlugin { @Override public void onEnable() { protocolManager = ProtocolLibrary.getProtocolManager(); - this.versionManager = new VersionManagerImpl(this); + NBTUtils.disableNBTAPILogs(); ReflectionUtils.load(); this.actionManager = new ActionManagerImpl(this); - this.adventure = new AdventureManagerImpl(this); + this.adventure = new AdventureHelper(this); this.bagManager = new BagManagerImpl(this); this.blockManager = new BlockManagerImpl(this); this.commandManager = new CommandManagerImpl(this); @@ -155,7 +151,7 @@ public class CustomFishingPluginImpl extends CustomFishingPlugin { @Override public void onDisable() { - if (this.adventure != null) ((AdventureManagerImpl) this.adventure).close(); + if (this.adventure != null) ((AdventureHelper) this.adventure).close(); if (this.bagManager != null) ((BagManagerImpl) this.bagManager).disable(); if (this.blockManager != null) ((BlockManagerImpl) this.blockManager).disable(); if (this.effectManager != null) ((EffectManagerImpl) this.effectManager).disable(); diff --git a/plugin/src/main/java/net/momirealms/customfishing/adventure/AdventureManagerImpl.java b/plugin/src/main/java/net/momirealms/customfishing/adventure/AdventureHelper.java similarity index 98% rename from plugin/src/main/java/net/momirealms/customfishing/adventure/AdventureManagerImpl.java rename to plugin/src/main/java/net/momirealms/customfishing/adventure/AdventureHelper.java index 56358855..9a0279bf 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/adventure/AdventureManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/adventure/AdventureHelper.java @@ -41,12 +41,12 @@ import org.bukkit.entity.Player; import java.lang.reflect.InvocationTargetException; -public class AdventureManagerImpl implements AdventureManager { +public class AdventureHelper implements AdventureManager { private final BukkitAudiences adventure; private static AdventureManager instance; - public AdventureManagerImpl(CustomFishingPlugin plugin) { + public AdventureHelper(CustomFishingPlugin plugin) { this.adventure = BukkitAudiences.create(plugin); instance = this; } diff --git a/plugin/src/main/java/net/momirealms/customfishing/command/CommandManagerImpl.java b/plugin/src/main/java/net/momirealms/customfishing/command/CommandManagerImpl.java index a3da89ef..7bbe1497 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/command/CommandManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/command/CommandManagerImpl.java @@ -24,7 +24,7 @@ import dev.jorel.commandapi.arguments.EntitySelectorArgument; import dev.jorel.commandapi.arguments.StringArgument; import dev.jorel.commandapi.arguments.UUIDArgument; import net.momirealms.customfishing.CustomFishingPluginImpl; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.manager.CommandManager; import net.momirealms.customfishing.api.util.LogUtils; @@ -47,36 +47,34 @@ public class CommandManagerImpl implements CommandManager { @Override public void load() { - if (!plugin.getVersionManager().isMojmap()) { - if (!CommandAPI.isLoaded()) - CommandAPI.onLoad(new CommandAPIBukkitConfig(plugin).silentLogs(true)); - new CommandAPICommand("customfishing") - .withAliases("cfishing") - .withPermission("customfishing.admin") - .withSubcommands( - getReloadCommand(), - getOpenCommand(), - getAboutCommand(), - GUIEditorCommand.INSTANCE.getEditorCommand(), - DataCommand.INSTANCE.getDataCommand(), - CompetitionCommand.INSTANCE.getCompetitionCommand(), - ItemCommand.INSTANCE.getItemCommand(), - DebugCommand.INSTANCE.getDebugCommand(), - StatisticsCommand.INSTANCE.getStatisticsCommand() - ) + if (!CommandAPI.isLoaded()) + CommandAPI.onLoad(new CommandAPIBukkitConfig(plugin).silentLogs(true)); + new CommandAPICommand("customfishing") + .withAliases("cfishing") + .withPermission("customfishing.admin") + .withSubcommands( + getReloadCommand(), + getOpenCommand(), + getAboutCommand(), + GUIEditorCommand.INSTANCE.getEditorCommand(), + DataCommand.INSTANCE.getDataCommand(), + CompetitionCommand.INSTANCE.getCompetitionCommand(), + ItemCommand.INSTANCE.getItemCommand(), + DebugCommand.INSTANCE.getDebugCommand(), + StatisticsCommand.INSTANCE.getStatisticsCommand() + ) + .register(); + if (plugin.getMarketManager().isEnable()) { + new CommandAPICommand("sellfish") + .withPermission("customfishing.sellfish") + .executesPlayer((player, args) -> { + if (plugin.getMarketManager().isEnable()) + plugin.getMarketManager().openMarketGUI(player); + }) .register(); - if (plugin.getMarketManager().isEnable()) { - new CommandAPICommand("sellfish") - .withPermission("customfishing.sellfish") - .executesPlayer((player, args) -> { - if (plugin.getMarketManager().isEnable()) - plugin.getMarketManager().openMarketGUI(player); - }) - .register(); - } - if (plugin.getBagManager().isEnabled()) { - FishingBagCommand.INSTANCE.getBagCommand().register(); - } + } + if (plugin.getBagManager().isEnabled()) { + FishingBagCommand.INSTANCE.getBagCommand().register(); } } @@ -89,7 +87,7 @@ public class CommandManagerImpl implements CommandManager { .executes((sender, args) -> { long time = System.currentTimeMillis(); plugin.reload(); - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Reload.replace("{time}", String.valueOf(System.currentTimeMillis()-time))); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Reload.replace("{time}", String.valueOf(System.currentTimeMillis()-time))); }); } @@ -107,7 +105,7 @@ public class CommandManagerImpl implements CommandManager { boolean silence = args.getOrDefault("-s","").equals("-s"); for (Player player : players) { plugin.getMarketManager().openMarketGUI(player); - if (!silence) AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Market_GUI_Open.replace("{player}", player.getName())); + if (!silence) AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Market_GUI_Open.replace("{player}", player.getName())); } }), new CommandAPICommand("market-uuid") @@ -119,7 +117,7 @@ public class CommandManagerImpl implements CommandManager { boolean silence = args.getOrDefault("-s","").equals("-s"); if (player == null) return; plugin.getMarketManager().openMarketGUI(player); - if (!silence) AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Market_GUI_Open.replace("{player}", player.getName())); + if (!silence) AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Market_GUI_Open.replace("{player}", player.getName())); }) ); } @@ -136,7 +134,7 @@ public class CommandManagerImpl implements CommandManager { Inventory inventory = plugin.getBagManager().getOnlineBagInventory(player.getUniqueId()); if (inventory != null) { player.openInventory(inventory); - if (!silence) AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Fishing_Bag_Open.replace("{player}", player.getName())); + if (!silence) AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Fishing_Bag_Open.replace("{player}", player.getName())); } else { LogUtils.warn("Player " + player.getName() + "'s bag data has not been loaded."); } @@ -153,7 +151,7 @@ public class CommandManagerImpl implements CommandManager { Inventory inventory = plugin.getBagManager().getOnlineBagInventory(uuid); if (inventory != null) { player.openInventory(inventory); - if (!silence) AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Fishing_Bag_Open.replace("{player}", player.getName())); + if (!silence) AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Fishing_Bag_Open.replace("{player}", player.getName())); } else { LogUtils.warn("Player " + player.getName() + "'s bag data has not been loaded."); } @@ -165,11 +163,11 @@ public class CommandManagerImpl implements CommandManager { private CommandAPICommand getAboutCommand() { return new CommandAPICommand("about").executes((sender, args) -> { - AdventureManagerImpl.getInstance().sendMessage(sender, "<#00BFFF>\uD83C\uDFA3 CustomFishing - <#87CEEB>" + CustomFishingPlugin.getInstance().getVersionManager().getPluginVersion()); - AdventureManagerImpl.getInstance().sendMessage(sender, "<#B0C4DE>A fishing plugin that provides innovative mechanics and powerful loot system"); - AdventureManagerImpl.getInstance().sendMessage(sender, "<#DA70D6>\uD83E\uDDEA Author: <#FFC0CB>XiaoMoMi"); - AdventureManagerImpl.getInstance().sendMessage(sender, "<#FF7F50>\uD83D\uDD25 Contributors: <#FFA07A>0ft3n, <#FFA07A>Peng_Lx, <#FFA07A>Masaki, <#FFA07A>g2213swo"); - AdventureManagerImpl.getInstance().sendMessage(sender, "<#FFD700>⭐ Document <#A9A9A9>| <#FAFAD2>⛏ Github <#A9A9A9>| <#48D1CC>\uD83D\uDD14 Polymart"); + AdventureHelper.getInstance().sendMessage(sender, "<#00BFFF>\uD83C\uDFA3 CustomFishing - <#87CEEB>" + CustomFishingPlugin.getInstance().getVersionManager().getPluginVersion()); + AdventureHelper.getInstance().sendMessage(sender, "<#B0C4DE>A fishing plugin that provides innovative mechanics and powerful loot system"); + AdventureHelper.getInstance().sendMessage(sender, "<#DA70D6>\uD83E\uDDEA Author: <#FFC0CB>XiaoMoMi"); + AdventureHelper.getInstance().sendMessage(sender, "<#FF7F50>\uD83D\uDD25 Contributors: <#FFA07A>0ft3n, <#FFA07A>Peng_Lx, <#FFA07A>Masaki, <#FFA07A>g2213swo"); + AdventureHelper.getInstance().sendMessage(sender, "<#FFD700>⭐ Document <#A9A9A9>| <#FAFAD2>⛏ Github <#A9A9A9>| <#48D1CC>\uD83D\uDD14 Polymart"); }); } } diff --git a/plugin/src/main/java/net/momirealms/customfishing/command/sub/CompetitionCommand.java b/plugin/src/main/java/net/momirealms/customfishing/command/sub/CompetitionCommand.java index 75df733f..38bb4fac 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/command/sub/CompetitionCommand.java +++ b/plugin/src/main/java/net/momirealms/customfishing/command/sub/CompetitionCommand.java @@ -20,7 +20,7 @@ package net.momirealms.customfishing.command.sub; import dev.jorel.commandapi.CommandAPICommand; import dev.jorel.commandapi.arguments.ArgumentSuggestions; import dev.jorel.commandapi.arguments.StringArgument; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.mechanic.competition.FishingCompetition; import net.momirealms.customfishing.setting.CFConfig; @@ -56,7 +56,7 @@ public class CompetitionCommand { String id = (String) args.get(0); assert id != null; if (!allCompetitions.contains(id)) { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Competition_Not_Exist.replace("{id}", id)); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Competition_Not_Exist.replace("{id}", id)); return; } Object server = args.get("server-group"); @@ -80,9 +80,9 @@ public class CompetitionCommand { FishingCompetition competition = CustomFishingPlugin.get().getCompetitionManager().getOnGoingCompetition(); if (competition != null) { CustomFishingPlugin.get().getScheduler().runTaskAsync(() -> competition.end(true)); - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_End_Competition); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_End_Competition); } else { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_No_Competition_Ongoing); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_No_Competition_Ongoing); } } }); @@ -102,9 +102,9 @@ public class CompetitionCommand { CustomFishingPlugin.get().getScheduler().runTaskAsync(() -> { competition.stop(true); }); - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Stop_Competition); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Stop_Competition); } else { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_No_Competition_Ongoing); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_No_Competition_Ongoing); } } }); diff --git a/plugin/src/main/java/net/momirealms/customfishing/command/sub/DataCommand.java b/plugin/src/main/java/net/momirealms/customfishing/command/sub/DataCommand.java index e54f0609..d2bfd6cc 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/command/sub/DataCommand.java +++ b/plugin/src/main/java/net/momirealms/customfishing/command/sub/DataCommand.java @@ -25,7 +25,7 @@ import dev.jorel.commandapi.CommandAPICommand; import dev.jorel.commandapi.arguments.ArgumentSuggestions; import dev.jorel.commandapi.arguments.StringArgument; import dev.jorel.commandapi.arguments.UUIDArgument; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.data.DataStorageInterface; import net.momirealms.customfishing.api.data.LegacyDataStorageInterface; @@ -70,7 +70,7 @@ public class DataCommand { .executes((sender, args) -> { UUID uuid = (UUID) args.get("uuid"); CustomFishingPlugin.get().getStorageManager().getDataSource().lockOrUnlockPlayerData(uuid, false); - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Successfully unlocked."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Successfully unlocked."); }); } @@ -85,7 +85,7 @@ public class DataCommand { CustomFishingPlugin plugin = CustomFishingPlugin.get(); plugin.getScheduler().runTaskAsync(() -> { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Starting export."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Starting export."); LegacyDataStorageInterface dataStorageInterface; switch (arg) { @@ -93,7 +93,7 @@ public class DataCommand { case "MariaDB" -> dataStorageInterface = new MariaDBImpl(plugin); case "YAML" -> dataStorageInterface = new YAMLImpl(plugin); default -> { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "No such legacy storage method."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "No such legacy storage method."); return; } } @@ -143,7 +143,7 @@ public class DataCommand { dataStorageInterface.disable(); - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Completed."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Completed."); }); }); } @@ -153,14 +153,14 @@ public class DataCommand { return new CommandAPICommand("export") .executesConsole((sender, args) -> { if (Bukkit.getOnlinePlayers().size() != 0) { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Please kick all the players before exporting. Otherwise the cache will be inconsistent with data, resulting in the backup file not being up to date."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Please kick all the players before exporting. Otherwise the cache will be inconsistent with data, resulting in the backup file not being up to date."); return; } CustomFishingPlugin plugin = CustomFishingPlugin.get(); plugin.getScheduler().runTaskAsync(() -> { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Starting export."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Starting export."); DataStorageInterface dataStorageInterface = plugin.getStorageManager().getDataSource(); Set uuids = dataStorageInterface.getUniqueUsers(false); @@ -206,7 +206,7 @@ public class DataCommand { e.printStackTrace(); } - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Completed."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Completed."); }); }); } @@ -217,7 +217,7 @@ public class DataCommand { .withArguments(new StringArgument("file")) .executesConsole((sender, args) -> { if (Bukkit.getOnlinePlayers().size() != 0) { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Please kick all the players before importing. Otherwise the cache will be inconsistent with data."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Please kick all the players before importing. Otherwise the cache will be inconsistent with data."); return; } @@ -227,23 +227,23 @@ public class DataCommand { File file = new File(plugin.getDataFolder(), fileName); if (!file.exists()) { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "File not exists."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "File not exists."); return; } if (!file.getName().endsWith(".json.gz")) { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Invalid file."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Invalid file."); return; } plugin.getScheduler().runTaskAsync(() -> { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Starting import."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Starting import."); JsonObject data; try (BufferedReader reader = new BufferedReader(new InputStreamReader(new GZIPInputStream(Files.newInputStream(file.toPath())), StandardCharsets.UTF_8))) { data = new GsonBuilder().disableHtmlEscaping().create().fromJson(reader, JsonObject.class); } catch (IOException e) { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Error occurred when reading the backup file."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Error occurred when reading the backup file."); e.printStackTrace(); return; } @@ -277,7 +277,7 @@ public class DataCommand { break; } - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Completed."); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Completed."); }); }); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/command/sub/DebugCommand.java b/plugin/src/main/java/net/momirealms/customfishing/command/sub/DebugCommand.java index e5890557..29782ad2 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/command/sub/DebugCommand.java +++ b/plugin/src/main/java/net/momirealms/customfishing/command/sub/DebugCommand.java @@ -24,8 +24,7 @@ import dev.jorel.commandapi.StringTooltip; import dev.jorel.commandapi.arguments.ArgumentSuggestions; import dev.jorel.commandapi.arguments.BooleanArgument; import dev.jorel.commandapi.arguments.StringArgument; -import net.momirealms.biomeapi.BiomeAPI; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.integration.SeasonInterface; import net.momirealms.customfishing.api.manager.AdventureManager; @@ -36,6 +35,7 @@ import net.momirealms.customfishing.api.mechanic.effect.FishingEffect; import net.momirealms.customfishing.mechanic.fishing.FishingPreparationImpl; import net.momirealms.customfishing.util.ConfigUtils; import net.momirealms.customfishing.util.NBTUtils; +import net.momirealms.sparrow.heart.SparrowHeart; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -64,14 +64,14 @@ public class DebugCommand { public CommandAPICommand getBiomeCommand() { return new CommandAPICommand("biome") .executesPlayer((player, arg) -> { - AdventureManagerImpl.getInstance().sendMessage(player, BiomeAPI.getBiomeAt(player.getLocation())); + AdventureHelper.getInstance().sendMessage(player, SparrowHeart.getInstance().getBiomeResourceLocation(player.getLocation())); }); } public CommandAPICommand getLocationCommand() { return new CommandAPICommand("location") .executesPlayer((player, arg) -> { - AdventureManagerImpl.getInstance().sendMessage(player, player.getLocation().toString()); + AdventureHelper.getInstance().sendMessage(player, player.getLocation().toString()); }); } @@ -84,7 +84,7 @@ public class DebugCommand { ArrayList list = new ArrayList<>(); ConfigUtils.mapToReadableStringList(NBTUtils.compoundToMap(new NBTItem(item)), list, 0, false); for (String line : list) { - AdventureManagerImpl.getInstance().sendMessage(player, line); + AdventureHelper.getInstance().sendMessage(player, line); } }); } @@ -94,10 +94,10 @@ public class DebugCommand { .executesPlayer((player, arg) -> { SeasonInterface seasonInterface = CustomFishingPlugin.get().getIntegrationManager().getSeasonInterface(); if (seasonInterface == null) { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, "NO SEASON PLUGIN"); + AdventureHelper.getInstance().sendMessageWithPrefix(player, "NO SEASON PLUGIN"); return; } - AdventureManagerImpl.getInstance().sendMessage(player, seasonInterface.getSeason(player.getLocation().getWorld())); + AdventureHelper.getInstance().sendMessage(player, seasonInterface.getSeason(player.getLocation().getWorld())); }); } @@ -112,7 +112,7 @@ public class DebugCommand { for (String key : groups) { stringJoiner.add(key); } - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Group{" + group + "}[" + stringJoiner + "]"); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Group{" + group + "}[" + stringJoiner + "]"); }); } @@ -127,7 +127,7 @@ public class DebugCommand { for (String key : cs) { stringJoiner.add(key); } - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, "Category{" + c + "}[" + stringJoiner + "]"); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, "Category{" + c + "}[" + stringJoiner + "]"); }); } @@ -140,7 +140,7 @@ public class DebugCommand { }))) .executesPlayer((player, arg) -> { if (player.getInventory().getItemInMainHand().getType() != Material.FISHING_ROD) { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, "Please hold a fishing rod before using this command."); + AdventureHelper.getInstance().sendMessageWithPrefix(player, "Please hold a fishing rod before using this command."); return; } FishingEffect initialEffect = CustomFishingPlugin.get().getEffectManager().getInitialEffect(); @@ -165,7 +165,7 @@ public class DebugCommand { } LootWithWeight[] lootArray = loots.toArray(new LootWithWeight[0]); quickSort(lootArray, 0,lootArray.length - 1); - AdventureManager adventureManager = AdventureManagerImpl.getInstance(); + AdventureManager adventureManager = AdventureHelper.getInstance(); adventureManager.sendMessage(player, "---------- results ---------"); for (LootWithWeight loot : lootArray) { adventureManager.sendMessage(player, loot.key() + ": " + String.format("%.2f", loot.weight()*100/sum) + "% (" + String.format("%.2f", loot.weight()) + ")"); diff --git a/plugin/src/main/java/net/momirealms/customfishing/command/sub/FishingBagCommand.java b/plugin/src/main/java/net/momirealms/customfishing/command/sub/FishingBagCommand.java index 0eaafe01..b147f3f5 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/command/sub/FishingBagCommand.java +++ b/plugin/src/main/java/net/momirealms/customfishing/command/sub/FishingBagCommand.java @@ -20,7 +20,7 @@ package net.momirealms.customfishing.command.sub; import dev.jorel.commandapi.CommandAPICommand; import dev.jorel.commandapi.arguments.PlayerArgument; import dev.jorel.commandapi.arguments.UUIDArgument; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.data.user.OfflineUser; import net.momirealms.customfishing.setting.CFConfig; @@ -46,7 +46,7 @@ public class FishingBagCommand { if (inv != null) { player.openInventory(inv); } else { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CFLocale.MSG_Data_Not_Loaded); + AdventureHelper.getInstance().sendMessageWithPrefix(player, CFLocale.MSG_Data_Not_Loaded); } } })); @@ -82,12 +82,12 @@ public class FishingBagCommand { } CustomFishingPlugin.get().getStorageManager().getOfflineUser(uuid, CFConfig.lockData).thenAccept(optional -> { if (optional.isEmpty()) { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CFLocale.MSG_Never_Played); + AdventureHelper.getInstance().sendMessageWithPrefix(player, CFLocale.MSG_Never_Played); return; } OfflineUser offlineUser = optional.get(); if (offlineUser == OfflineUserImpl.LOCKED_USER) { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CFLocale.MSG_Unsafe_Modification); + AdventureHelper.getInstance().sendMessageWithPrefix(player, CFLocale.MSG_Unsafe_Modification); return; } CustomFishingPlugin.get().getScheduler().runTaskSync(() -> { diff --git a/plugin/src/main/java/net/momirealms/customfishing/command/sub/ItemCommand.java b/plugin/src/main/java/net/momirealms/customfishing/command/sub/ItemCommand.java index 917a4d2b..15eba24f 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/command/sub/ItemCommand.java +++ b/plugin/src/main/java/net/momirealms/customfishing/command/sub/ItemCommand.java @@ -23,7 +23,7 @@ import dev.jorel.commandapi.arguments.ArgumentSuggestions; import dev.jorel.commandapi.arguments.EntitySelectorArgument; import dev.jorel.commandapi.arguments.IntegerArgument; import dev.jorel.commandapi.arguments.StringArgument; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.common.Key; import net.momirealms.customfishing.api.mechanic.condition.Condition; @@ -102,7 +102,7 @@ public class ItemCommand { } try { config.save(file); - AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, "Imported! Saved to " + file.getAbsolutePath()); + AdventureHelper.getInstance().sendMessageWithPrefix(player, "Imported! Saved to " + file.getAbsolutePath()); } catch (IOException e) { e.printStackTrace(); } @@ -126,9 +126,9 @@ public class ItemCommand { ItemStack item = CustomFishingPlugin.get().getItemManager().build(player, namespace, id, new Condition(player).getArgs()); if (item != null) { int actual = ItemUtils.giveItem(player, item, amount); - AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CFLocale.MSG_Get_Item.replace("{item}", id).replace("{amount}", String.valueOf(actual))); + AdventureHelper.getInstance().sendMessageWithPrefix(player, CFLocale.MSG_Get_Item.replace("{item}", id).replace("{amount}", String.valueOf(actual))); } else { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, CFLocale.MSG_Item_Not_Exists); + AdventureHelper.getInstance().sendMessageWithPrefix(player, CFLocale.MSG_Item_Not_Exists); } }); } @@ -154,10 +154,10 @@ public class ItemCommand { for (Player player : players) { ItemStack item = CustomFishingPlugin.get().getItemManager().build(player, namespace, id, new Condition(player).getArgs()); int actual = ItemUtils.giveItem(player, item, amount); - if (!silence) AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Give_Item.replace("{item}", id).replace("{amount}", String.valueOf(actual)).replace("{player}", player.getName())); + if (!silence) AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Give_Item.replace("{item}", id).replace("{amount}", String.valueOf(actual)).replace("{player}", player.getName())); } } else { - AdventureManagerImpl.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Item_Not_Exists); + AdventureHelper.getInstance().sendMessageWithPrefix(sender, CFLocale.MSG_Item_Not_Exists); } }); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/command/sub/StatisticsCommand.java b/plugin/src/main/java/net/momirealms/customfishing/command/sub/StatisticsCommand.java index 5df559ef..f8d78dfb 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/command/sub/StatisticsCommand.java +++ b/plugin/src/main/java/net/momirealms/customfishing/command/sub/StatisticsCommand.java @@ -19,7 +19,7 @@ package net.momirealms.customfishing.command.sub; import dev.jorel.commandapi.CommandAPICommand; import dev.jorel.commandapi.arguments.*; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.mechanic.condition.Condition; import net.momirealms.customfishing.api.mechanic.loot.Loot; @@ -126,7 +126,7 @@ public class StatisticsCommand { assert player != null; Statistics statistics = CustomFishingPlugin.get().getStatisticsManager().getStatistics(player.getUniqueId()); if (statistics != null) { - var adventure = AdventureManagerImpl.getInstance(); + var adventure = AdventureHelper.getInstance(); for (Map.Entry entry : statistics.getStatisticMap().entrySet()) { adventure.sendMessage(sender, entry.getKey() + ": " + entry.getValue()); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/BackToFolderItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/BackToFolderItem.java index dad6a4e1..5b348c4b 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/BackToFolderItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/BackToFolderItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.Icon; import net.momirealms.customfishing.gui.page.file.FileSelector; @@ -46,10 +46,10 @@ public class BackToFolderItem extends AbstractItem implements Icon { public ItemProvider getItemProvider() { if (file != null && (file.getPath().startsWith("plugins\\CustomFishing\\contents") || file.getPath().startsWith("plugins/CustomFishing/contents"))) { return new ItemBuilder(Material.ORANGE_STAINED_GLASS_PANE) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_BACK_TO_PARENT_FOLDER ))) - .setLore(List.of(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setLore(List.of(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "<#FFA500>-> " + file.getName() )))); } else { diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/BackToPageItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/BackToPageItem.java index 1805b1b9..f5fb2cca 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/BackToPageItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/BackToPageItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.ParentPage; import net.momirealms.customfishing.setting.CFLocale; @@ -41,7 +41,7 @@ public class BackToPageItem extends AbstractItem { @Override public ItemProvider getItemProvider() { return new ItemBuilder(Material.ORANGE_STAINED_GLASS_PANE) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_BACK_TO_PARENT_PAGE ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/NextPageItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/NextPageItem.java index 9b9c3a2f..6da7372d 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/NextPageItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/NextPageItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.Icon; import net.momirealms.customfishing.setting.CFLocale; @@ -36,10 +36,10 @@ public class NextPageItem extends PageItem implements Icon { @Override public ItemProvider getItemProvider(PagedGui gui) { ItemBuilder builder = new ItemBuilder(Material.GREEN_STAINED_GLASS_PANE); - builder.setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NEXT_PAGE ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( gui.hasNextPage() ? CFLocale.GUI_GOTO_NEXT_PAGE .replace("{0}", String.valueOf(gui.getCurrentPage() + 2)) diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/PreviousPageItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/PreviousPageItem.java index b7f65bcb..8ea9fc89 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/PreviousPageItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/PreviousPageItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.Icon; import net.momirealms.customfishing.setting.CFLocale; @@ -36,10 +36,10 @@ public class PreviousPageItem extends PageItem implements Icon { @Override public ItemProvider getItemProvider(PagedGui gui) { ItemBuilder builder = new ItemBuilder(Material.RED_STAINED_GLASS_PANE); - builder.setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_PREVIOUS_PAGE ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( gui.hasPreviousPage() ? CFLocale.GUI_GOTO_PREVIOUS_PAGE .replace("{0}", String.valueOf(gui.getCurrentPage())) diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/ScrollDownItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/ScrollDownItem.java index 84a234c4..0426248c 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/ScrollDownItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/ScrollDownItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.Icon; import net.momirealms.customfishing.setting.CFLocale; @@ -36,11 +36,11 @@ public class ScrollDownItem extends ScrollItem implements Icon { @Override public ItemProvider getItemProvider(ScrollGui gui) { ItemBuilder builder = new ItemBuilder(Material.GREEN_STAINED_GLASS_PANE); - builder.setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_SCROLL_DOWN ))); if (!gui.canScroll(1)) - builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CANNOT_SCROLL_DOWN ))); return builder; diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/ScrollUpItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/ScrollUpItem.java index 803cfc49..c040c611 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/ScrollUpItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/ScrollUpItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.Icon; import net.momirealms.customfishing.setting.CFLocale; @@ -36,11 +36,11 @@ public class ScrollUpItem extends ScrollItem implements Icon { @Override public ItemProvider getItemProvider(ScrollGui gui) { ItemBuilder builder = new ItemBuilder(Material.RED_STAINED_GLASS_PANE); - builder.setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_SCROLL_UP ))); if (!gui.canScroll(-1)) - builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CANNOT_SCROLL_UP ))); return builder; diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/AmountItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/AmountItem.java index 12cb853a..f47c40da 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/AmountItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/AmountItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.AmountEditor; @@ -42,22 +42,22 @@ public class AmountItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.IRON_NUGGET) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_AMOUNT ))) .setAmount(itemPage.getSection().getInt("amount", 1)); if (itemPage.getSection().contains("amount")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getInt("amount") ))) .addLoreLines(""); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/CMDItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/CMDItem.java index 80cae0b8..ae3cec8b 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/CMDItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/CMDItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.CustomModelDataEditor; @@ -42,21 +42,21 @@ public class CMDItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.GLOW_INK_SAC) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_MODEL_DATA ))); if (itemPage.getSection().contains("custom-model-data")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getInt("custom-model-data") ))) .addLoreLines(""); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/DisplayNameItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/DisplayNameItem.java index 8491088c..3fe0e95b 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/DisplayNameItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/DisplayNameItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.DisplayNameEditor; @@ -42,21 +42,21 @@ public class DisplayNameItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.NAME_TAG) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_DISPLAY_NAME ))); if (itemPage.getSection().contains("display.name")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getString("display.name") ))) .addLoreLines(""); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/DurabilityItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/DurabilityItem.java index ed022cbc..7341393d 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/DurabilityItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/DurabilityItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.DurabilityEditor; @@ -42,21 +42,21 @@ public class DurabilityItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.DIAMOND_CHESTPLATE) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_DURABILITY ))); if (itemPage.getSection().contains("max-durability")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getInt("max-durability") ))) .addLoreLines(""); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/EnchantmentItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/EnchantmentItem.java index f49bdc65..fe73a540 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/EnchantmentItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/EnchantmentItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.EnchantmentEditor; @@ -46,27 +46,27 @@ public class EnchantmentItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.IRON_HOE) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_ENCHANTMENT ))) .addEnchantment(Enchantment.ARROW_FIRE,1,true) .addItemFlags(ItemFlag.HIDE_ENCHANTS); if (itemPage.getSection().contains("enchantments")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE ))); for (Map.Entry entry : itemPage.getSection().getConfigurationSection("enchantments").getValues(false).entrySet()) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( " - " + entry.getKey() + ":" + entry.getValue() ))); } - itemBuilder.addLoreLines("").addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines("").addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/Head64Item.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/Head64Item.java index 75b88207..ca213160 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/Head64Item.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/Head64Item.java @@ -18,7 +18,7 @@ package net.momirealms.customfishing.gui.icon.property.item; import net.momirealms.customfishing.CustomFishingPluginImpl; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.gui.SectionPage; @@ -45,11 +45,11 @@ public class Head64Item extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.PLAYER_HEAD) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_HEAD64 ))); if (itemPage.getSection().contains("head64")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE ))); String head64 = itemPage.getSection().getString("head64", ""); @@ -62,17 +62,17 @@ public class Head64Item extends AbstractItem { } } for (String line : list) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( ""+ line ))); } - itemBuilder.addLoreLines("").addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines("").addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } @@ -83,7 +83,7 @@ public class Head64Item extends AbstractItem { public void handleClick(@NotNull ClickType clickType, @NotNull Player player, @NotNull InventoryClickEvent event) { if (clickType.isLeftClick()) { player.closeInventory(); - AdventureManagerImpl.getInstance().sendMessageWithPrefix(player, "Input the head64 value in chat"); + AdventureHelper.getInstance().sendMessageWithPrefix(player, "Input the head64 value in chat"); ((CustomFishingPluginImpl) CustomFishingPlugin.get()).getChatCatcherManager().catchMessage(player, "head64", itemPage); } else if (clickType.isRightClick()) { itemPage.getSection().set("head64", null); diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/ItemFlagItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/ItemFlagItem.java index 43e8dfba..90f70925 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/ItemFlagItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/ItemFlagItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.ItemFlagEditor; @@ -42,26 +42,26 @@ public class ItemFlagItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.CYAN_BANNER) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_FLAG ))); if (itemPage.getSection().contains("item-flags")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE ))); for (String lore : itemPage.getSection().getStringList("item-flags")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( " - " + lore ))); } itemBuilder.addLoreLines(""); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/LoreItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/LoreItem.java index 3775913d..f5525a7d 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/LoreItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/LoreItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.LoreEditor; @@ -42,26 +42,26 @@ public class LoreItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.BIRCH_SIGN) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_LORE ))); if (itemPage.getSection().contains("display.lore")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE ))); for (String lore : itemPage.getSection().getStringList("display.lore")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( " - " + lore ))); } itemBuilder.addLoreLines(""); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/MaterialItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/MaterialItem.java index 1fe70f6a..ac638535 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/MaterialItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/MaterialItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.MaterialEditor; @@ -42,21 +42,21 @@ public class MaterialItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.COD) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_MATERIAL ))); if (itemPage.getSection().contains("material")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getString("material") ))) .addLoreLines(""); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/NBTItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/NBTItem.java index 80ee1e72..df3b1ece 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/NBTItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/NBTItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.NBTEditor; @@ -43,26 +43,26 @@ public class NBTItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.COMMAND_BLOCK) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_NBT ))); var section = itemPage.getSection().getConfigurationSection("nbt"); if (section != null) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE ))); for (String line : ConfigUtils.getReadableSection(section.getValues(false))) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( line ))); } - itemBuilder.addLoreLines("").addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines("").addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/PreventGrabItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/PreventGrabItem.java index 25c97fc1..436e2031 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/PreventGrabItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/PreventGrabItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.setting.CFLocale; @@ -41,14 +41,14 @@ public class PreventGrabItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.DRAGON_EGG) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_PREVENT_GRAB ))); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getBoolean("prevent-grabbing", false) ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_TO_TOGGLE ))); return itemBuilder; diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/PriceItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/PriceItem.java index db18273d..bfcd5080 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/PriceItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/PriceItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.PriceEditor; @@ -42,27 +42,27 @@ public class PriceItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.GOLD_INGOT) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_PRICE ))); if (itemPage.getSection().contains("price")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_PRICE_BASE + itemPage.getSection().getDouble("price.base") ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_PRICE_BONUS + itemPage.getSection().getDouble("price.bonus") ))) .addLoreLines(""); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/RandomDurabilityItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/RandomDurabilityItem.java index ab15e7ff..e94841c6 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/RandomDurabilityItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/RandomDurabilityItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.setting.CFLocale; @@ -41,15 +41,15 @@ public class RandomDurabilityItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.LEATHER_BOOTS) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_RANDOM_DURABILITY ))) .setDamage(15); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getBoolean("random-durability", false) ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_TO_TOGGLE ))); diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/SizeItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/SizeItem.java index afcdcdb8..36a461a2 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/SizeItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/SizeItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.SizeEditor; @@ -42,21 +42,21 @@ public class SizeItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.PUFFERFISH) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_SIZE ))); if (itemPage.getSection().contains("size")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getString("size") ))) .addLoreLines(""); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/StackableItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/StackableItem.java index 719b6435..b5f3c504 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/StackableItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/StackableItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.setting.CFLocale; @@ -41,14 +41,14 @@ public class StackableItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.CHEST_MINECART) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_STACKABLE ))); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getBoolean("stackable", true) ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_TO_TOGGLE ))); return itemBuilder; diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/StoredEnchantmentItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/StoredEnchantmentItem.java index e90b71be..c55c5900 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/StoredEnchantmentItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/StoredEnchantmentItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.EnchantmentEditor; @@ -46,27 +46,27 @@ public class StoredEnchantmentItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.ENCHANTED_BOOK) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_STORED_ENCHANTMENT ))) .addEnchantment(Enchantment.ARROW_FIRE,1,true) .addItemFlags(ItemFlag.HIDE_ENCHANTS); if (itemPage.getSection().contains("stored-enchantments")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE ))); for (Map.Entry entry : itemPage.getSection().getConfigurationSection("stored-enchantments").getValues(false).entrySet()) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( " - " + entry.getKey() + ":" + entry.getValue() ))); } - itemBuilder.addLoreLines("").addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines("").addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/TagItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/TagItem.java index 314db099..694870d0 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/TagItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/TagItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.setting.CFLocale; @@ -41,14 +41,14 @@ public class TagItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.TOTEM_OF_UNDYING) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_TAG ))); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getBoolean("tag", true) ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_TO_TOGGLE ))); return itemBuilder; diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/UnbreakableItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/UnbreakableItem.java index a30b864f..30e3ee31 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/UnbreakableItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/item/UnbreakableItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.setting.CFLocale; @@ -41,14 +41,14 @@ public class UnbreakableItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.BEDROCK) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_UNBREAKABLE ))); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getBoolean("unbreakable", false) ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_TO_TOGGLE ))); return itemBuilder; diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/DisableGameItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/DisableGameItem.java index 75e1b890..d314f5da 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/DisableGameItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/DisableGameItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.loot; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.setting.CFLocale; @@ -41,14 +41,14 @@ public class DisableGameItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.LEAD) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LOOT_DISABLE_GAME ))); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getBoolean("disable-game", false) ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_TO_TOGGLE ))); return itemBuilder; diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/DisableStatsItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/DisableStatsItem.java index 2962ec69..5527128b 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/DisableStatsItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/DisableStatsItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.loot; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.setting.CFLocale; @@ -41,14 +41,14 @@ public class DisableStatsItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.WRITTEN_BOOK) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LOOT_DISABLE_STATS ))); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getBoolean("disable-stat", false) ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_TO_TOGGLE ))); return itemBuilder; diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/InstantGameItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/InstantGameItem.java index 7a24f0ab..5109dd1e 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/InstantGameItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/InstantGameItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.loot; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.setting.CFLocale; @@ -41,14 +41,14 @@ public class InstantGameItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.FISHING_ROD) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LOOT_INSTANT_GAME ))); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getBoolean("instant-game", false) ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_TO_TOGGLE ))); return itemBuilder; diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/NickItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/NickItem.java index 5079bb2d..f208f219 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/NickItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/NickItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.loot; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.NickEditor; @@ -42,21 +42,21 @@ public class NickItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.WRITABLE_BOOK) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LOOT_NICK ))); if (itemPage.getSection().contains("nick")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getString("nick") ))) .addLoreLines(""); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/ScoreItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/ScoreItem.java index 9e921ef0..c953d39c 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/ScoreItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/ScoreItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.loot; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.page.property.ScoreEditor; @@ -42,21 +42,21 @@ public class ScoreItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.NETHER_STAR) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LOOT_SCORE ))); if (itemPage.getSection().contains("score")) { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getDouble("score") ))) .addLoreLines(""); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_RESET ))); } else { - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/ShowInFinderItem.java b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/ShowInFinderItem.java index 0ad51f5a..9154e529 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/ShowInFinderItem.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/icon/property/loot/ShowInFinderItem.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.icon.property.loot; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.setting.CFLocale; @@ -41,14 +41,14 @@ public class ShowInFinderItem extends AbstractItem { @Override public ItemProvider getItemProvider() { ItemBuilder itemBuilder = new ItemBuilder(Material.COMPASS) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LOOT_SHOW_IN_FINDER ))); - itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + itemBuilder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CURRENT_VALUE + itemPage.getSection().getBoolean("show-in-fishfinder", true) ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_TO_TOGGLE ))); return itemBuilder; diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/file/FileSelector.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/file/FileSelector.java index a757e5f7..31953891 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/file/FileSelector.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/file/FileSelector.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.file; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.icon.BackGroundItem; import net.momirealms.customfishing.gui.icon.BackToFolderItem; @@ -81,7 +81,7 @@ public class FileSelector { Window window = Window.single() .setViewer(player) - .setTitle(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setTitle(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_SELECT_FILE ))) .setGui(gui) @@ -107,7 +107,7 @@ public class FileSelector { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.PAPER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.PAPER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "<#FDF5E6>" + file.getName() ))); } @@ -135,7 +135,7 @@ public class FileSelector { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.BOOK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BOOK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "<#D2B48C>" + file.getName() ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/item/AbstractSectionEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/item/AbstractSectionEditor.java index 70b54c73..3121eff8 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/item/AbstractSectionEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/item/AbstractSectionEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.item; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.gui.SectionPage; @@ -93,7 +93,7 @@ public abstract class AbstractSectionEditor implements SectionPage { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_EDIT_KEY.replace("{0}", key)) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_EDIT_KEY.replace("{0}", key)) )) .setUpperGui(upperGui) .setLowerGui(gui) diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/item/ItemSelector.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/item/ItemSelector.java index a7867ac1..4500c195 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/item/ItemSelector.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/item/ItemSelector.java @@ -18,7 +18,7 @@ package net.momirealms.customfishing.gui.page.item; import de.tr7zw.changeme.nbtapi.NBTItem; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.util.LogUtils; @@ -103,7 +103,7 @@ public class ItemSelector implements YamlPage { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_SELECT_ITEM ))) .addRenameHandler(s -> { @@ -150,7 +150,7 @@ public class ItemSelector implements YamlPage { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_SET_NEW_KEY) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_SET_NEW_KEY) )) .addRenameHandler(s -> { long current = System.currentTimeMillis(); @@ -219,12 +219,12 @@ public class ItemSelector implements YamlPage { public ItemInList(String key, ItemBuilder itemBuilder, ItemSelector itemSelector) { this.key = key; - this.itemBuilder = itemBuilder.setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + this.itemBuilder = itemBuilder.setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( key ))).addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_DELETE ))); this.itemSelector = itemSelector; @@ -251,7 +251,7 @@ public class ItemSelector implements YamlPage { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.ANVIL).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.ANVIL).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ADD_NEW_KEY ))); } @@ -268,18 +268,18 @@ public class ItemSelector implements YamlPage { public ItemProvider getItemProvider() { if (prefix != null && !yaml.contains(prefix) && prefix.matches("^[a-zA-Z0-9_]+$")) { var builder = new ItemBuilder(Material.NAME_TAG) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( prefix ))); - builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_CANCEL ))); return builder; } else { return new ItemBuilder(Material.BARRIER) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DUPE_INVALID_KEY ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/AmountEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/AmountEditor.java index 1bae4d57..6eca4aa1 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/AmountEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/AmountEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.icon.BackGroundItem; @@ -72,7 +72,7 @@ public class AmountEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_AMOUNT) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_AMOUNT) )) .addRenameHandler(s -> { amount = s; @@ -90,7 +90,7 @@ public class AmountEditor { @Override public ItemProvider getItemProvider() { if (amount == null || amount.isEmpty()) { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } else { @@ -98,17 +98,17 @@ public class AmountEditor { int m = Integer.parseInt(amount); if (m >= 1) { return new ItemBuilder(Material.IRON_NUGGET) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))) .setAmount(m); } else { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_INVALID_NUMBER ))); } } catch (NumberFormatException e) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_INVALID_NUMBER ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/CustomModelDataEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/CustomModelDataEditor.java index 8b3aa8a3..fcefd2e2 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/CustomModelDataEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/CustomModelDataEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.gui.SectionPage; @@ -84,7 +84,7 @@ public class CustomModelDataEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_MODEL_DATA) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_MODEL_DATA) )) .addRenameHandler(s -> { cmd = s; @@ -102,7 +102,7 @@ public class CustomModelDataEditor { @Override public ItemProvider getItemProvider() { if (cmd == null || cmd.isEmpty()) { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } else { @@ -116,16 +116,16 @@ public class CustomModelDataEditor { ) .setCustomModelData(value) .setDisplayName(CFLocale.GUI_NEW_VALUE + value) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))); } else { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_INVALID_NUMBER ))); } } catch (NumberFormatException e) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_INVALID_NUMBER ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/DisplayNameEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/DisplayNameEditor.java index 1dfff61b..5b8ce025 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/DisplayNameEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/DisplayNameEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.icon.BackGroundItem; @@ -72,7 +72,7 @@ public class DisplayNameEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_DISPLAY_NAME) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_DISPLAY_NAME) )) .addRenameHandler(s -> { name = s; @@ -90,15 +90,15 @@ public class DisplayNameEditor { @Override public ItemProvider getItemProvider() { if (name == null || name.isEmpty()) { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } else { return new ItemBuilder(Material.NAME_TAG) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "" + name ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/DurabilityEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/DurabilityEditor.java index daa741fb..99ebfbc0 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/DurabilityEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/DurabilityEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.icon.BackGroundItem; @@ -72,7 +72,7 @@ public class DurabilityEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_CUSTOM_DURABILITY) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_CUSTOM_DURABILITY) )) .addRenameHandler(s -> { dur = s; @@ -90,7 +90,7 @@ public class DurabilityEditor { @Override public ItemProvider getItemProvider() { if (dur == null || dur.isEmpty()) { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } else { @@ -98,20 +98,20 @@ public class DurabilityEditor { int m = Integer.parseInt(dur); if (m >= 1) { return new ItemBuilder(Material.NETHERITE_PICKAXE) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NEW_VALUE + dur ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))) .setDamage(Math.max(0, Material.NETHERITE_PICKAXE.getMaxDurability() - m)); } else { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_INVALID_NUMBER ))); } } catch (NumberFormatException e) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_INVALID_NUMBER ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/EnchantmentEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/EnchantmentEditor.java index c0473a25..cc954eac 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/EnchantmentEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/EnchantmentEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.icon.BackGroundItem; @@ -93,7 +93,7 @@ public class EnchantmentEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(store ? CFLocale.GUI_TITLE_STORED_ENCHANTMENT : CFLocale.GUI_TITLE_ENCHANTMENT) + AdventureHelper.getInstance().getComponentFromMiniMessage(store ? CFLocale.GUI_TITLE_STORED_ENCHANTMENT : CFLocale.GUI_TITLE_ENCHANTMENT) )) .addRenameHandler(s -> { if (index == 0) return; @@ -122,7 +122,7 @@ public class EnchantmentEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.ANVIL).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.ANVIL).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ADD_NEW_ENCHANTMENT ))); } @@ -147,12 +147,12 @@ public class EnchantmentEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.ENCHANTED_BOOK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.ENCHANTED_BOOK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( line ))).addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_DELETE ))); } @@ -176,28 +176,28 @@ public class EnchantmentEditor { public ItemProvider getItemProvider() { List subList = enchantments.subList(1, enchantments.size()); if (subList.isEmpty()) { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } else { var builder = new ItemBuilder(Material.NAME_TAG) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))); for (String enchantment : subList) { String[] split = enchantment.split(":"); if (split.length != 3) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ILLEGAL_FORMAT ))); } try { Integer.parseInt(split[2]); - builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( " - " + enchantment ))); } catch (NumberFormatException e) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ILLEGAL_FORMAT ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/ItemFlagEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/ItemFlagEditor.java index 31aa4b1c..5f6d1e7d 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/ItemFlagEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/ItemFlagEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.gui.SectionPage; @@ -83,7 +83,7 @@ public class ItemFlagEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_ITEM_FLAG) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_ITEM_FLAG) )) .setUpperGui(upperGui) .setLowerGui(gui) @@ -111,11 +111,11 @@ public class ItemFlagEditor { @Override public ItemProvider getItemProvider() { if (flags.contains(flag)) { - return new ItemBuilder(Material.GREEN_BANNER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.GREEN_BANNER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "" + flag ))); } else { - return new ItemBuilder(Material.RED_BANNER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.RED_BANNER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "" + flag ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/LoreEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/LoreEditor.java index 80569c1b..dd9aa32f 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/LoreEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/LoreEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.icon.BackGroundItem; @@ -85,7 +85,7 @@ public class LoreEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_LORE) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_LORE) )) .addRenameHandler(s -> { if (index == 0) return; @@ -114,7 +114,7 @@ public class LoreEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.ANVIL).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.ANVIL).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ADD_NEW_LORE ))); } @@ -139,12 +139,12 @@ public class LoreEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.PAPER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.PAPER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( line ))).addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_DELETE ))); } @@ -168,16 +168,16 @@ public class LoreEditor { public ItemProvider getItemProvider() { List subList = lore.subList(1, lore.size()); if (subList.isEmpty()) { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } else { var builder = new ItemBuilder(Material.NAME_TAG) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))); for (String lore : subList) { - builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( " - " + lore ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/MaterialEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/MaterialEditor.java index 5cd37ff0..f5dfdf87 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/MaterialEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/MaterialEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.gui.SectionPage; @@ -90,7 +90,7 @@ public class MaterialEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_MATERIAL) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_MATERIAL) )) .addRenameHandler(s -> { material = s; @@ -121,7 +121,7 @@ public class MaterialEditor { @Override public ItemProvider getItemProvider() { if (material == null || material.isEmpty()) { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } else { @@ -130,7 +130,7 @@ public class MaterialEditor { .getItemManager() .getItemStackAppearance(player, material) ).setDisplayName(CFLocale.GUI_NEW_VALUE + material) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))); if (section.contains("custom-model-data")) diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/NBTEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/NBTEditor.java index 16ae1af4..9f044ca5 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/NBTEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/NBTEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.icon.BackGroundItem; @@ -108,7 +108,7 @@ public class NBTEditor { var window = AnvilWindow.split() .setViewer(player) - .setTitle(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_NBT_EDIT_TITLE))) + .setTitle(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_NBT_EDIT_TITLE))) .setUpperGui(upperGui) .setLowerGui(gui) .build(); @@ -143,7 +143,7 @@ public class NBTEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_NBT_COMPOUND) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_NBT_COMPOUND) )) .addRenameHandler(s -> { value = s; @@ -183,7 +183,7 @@ public class NBTEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_NBT_LIST) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_NBT_LIST) )) .addRenameHandler(s -> { value = s; @@ -222,7 +222,7 @@ public class NBTEditor { var window = AnvilWindow.split() .setViewer(player) - .setTitle(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_NBT_KEY))) + .setTitle(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_TITLE_NBT_KEY))) .addRenameHandler(s -> { value = s; confirm.notifyWindows(); @@ -261,7 +261,7 @@ public class NBTEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_NBT_SET_VALUE_TITLE) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_NBT_SET_VALUE_TITLE) )) .addRenameHandler(s -> { value = s; @@ -312,7 +312,7 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.BELL).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BELL).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "(" + type + ") " + tip ))); } @@ -328,16 +328,16 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { if (value == null || value.equals("") || value.contains(".") || currentSection.contains(value)) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NBT_INVALID_KEY ))); } - return new ItemBuilder(Material.COMMAND_BLOCK_MINECART).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.COMMAND_BLOCK_MINECART).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NEW_VALUE + value - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_CANCEL ))); } @@ -363,15 +363,15 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { if (value == null || value.equals("") || value.contains(".") || currentSection.contains(value)) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NBT_INVALID_KEY ))); } - return new ItemBuilder(Material.CHAIN_COMMAND_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.CHAIN_COMMAND_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NEW_VALUE + value - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_CANCEL ))); } @@ -397,16 +397,16 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { if (value == null || value.equals("") || value.contains(".") || currentSection.contains(value)) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NBT_INVALID_KEY ))); } - return new ItemBuilder(Material.COMMAND_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.COMMAND_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NEW_VALUE + value - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_CANCEL ))); } @@ -431,7 +431,7 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.OAK_SIGN).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.OAK_SIGN).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NBT_ADD_COMPOUND ))); } @@ -446,7 +446,7 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.SPRUCE_SIGN).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.SPRUCE_SIGN).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NBT_ADD_LIST ))); } @@ -461,7 +461,7 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.ACACIA_SIGN).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.ACACIA_SIGN).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NBT_ADD_VALUE ))); } @@ -485,12 +485,12 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { String[] splits = node.split("\\."); - return new ItemBuilder(Material.COMMAND_BLOCK_MINECART).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.COMMAND_BLOCK_MINECART).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "Compound: " + splits[splits.length -1] ))).addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_DELETE ))); } @@ -520,13 +520,13 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { String[] splits = node.split("\\."); - return new ItemBuilder(Material.REPEATING_COMMAND_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.REPEATING_COMMAND_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( splits[splits.length -1] + ": " + value ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_LEFT_CLICK_EDIT - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_DELETE ))); } @@ -554,13 +554,13 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { String[] splits = node.split("\\."); - return new ItemBuilder(Material.CHAIN_COMMAND_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.CHAIN_COMMAND_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "List: " + splits[splits.length -1] ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "" + CFLocale.GUI_LEFT_CLICK_EDIT + "" - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_DELETE ))); } @@ -585,13 +585,13 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { String[] splits = node.split("\\."); - return new ItemBuilder(Material.COMMAND_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.COMMAND_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "Map: " + splits[splits.length -1] ))) .addLoreLines("") - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "" + CFLocale.GUI_LEFT_CLICK_EDIT + "" - ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + ))).addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_DELETE ))); } @@ -619,14 +619,14 @@ public class NBTEditor { NBTUtils.getTypeAndData(value); return new ItemBuilder(Material.COMMAND_BLOCK) .setDisplayName(value) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_RIGHT_CLICK_CANCEL ))); } catch (IllegalArgumentException e) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ILLEGAL_FORMAT ))); } @@ -654,17 +654,17 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { if (nbtSection.getValues(false).size() > 0) { - var builder = new ItemBuilder(Material.ACACIA_SIGN).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + var builder = new ItemBuilder(Material.ACACIA_SIGN).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NBT_PREVIEW ))); for (String line : ConfigUtils.getReadableSection(nbtSection.getValues(false))) { - builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( line ))); } return builder; } else { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } @@ -684,7 +684,7 @@ public class NBTEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.MINECART).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.MINECART).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NBT_BACK_TO_COMPOUND ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/NickEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/NickEditor.java index 7ca2c7d9..77ece67f 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/NickEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/NickEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.icon.BackGroundItem; @@ -72,7 +72,7 @@ public class NickEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_NICK_TITLE) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_NICK_TITLE) )) .addRenameHandler(s -> { nick = s; @@ -90,15 +90,15 @@ public class NickEditor { @Override public ItemProvider getItemProvider() { if (nick == null || nick.isEmpty()) { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } else { return new ItemBuilder(Material.WRITABLE_BOOK) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( "" + nick ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/PriceEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/PriceEditor.java index 8baaba26..aa866830 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/PriceEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/PriceEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.icon.BackGroundItem; @@ -82,7 +82,7 @@ public class PriceEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_PRICE_TITLE) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_PRICE_TITLE) )) .addRenameHandler(s -> { if (s == null || s.equals("")) { @@ -103,7 +103,7 @@ public class PriceEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.GOLD_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.GOLD_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_PRICE_BASE ))); } @@ -119,7 +119,7 @@ public class PriceEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.GOLD_NUGGET).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.GOLD_NUGGET).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_PRICE_BONUS ))); } @@ -136,7 +136,7 @@ public class PriceEditor { @Override public ItemProvider getItemProvider() { if (price[0].equals("0") && price[1].equals("0")) { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } else { @@ -144,20 +144,20 @@ public class PriceEditor { Double.parseDouble(price[0]); Double.parseDouble(price[1]); return new ItemBuilder(Material.GOLD_INGOT) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NEW_VALUE ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_PRICE_BASE + price[0] ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_ITEM_PRICE_BONUS + price[1] ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))); } catch (NumberFormatException e) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_INVALID_NUMBER ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/ScoreEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/ScoreEditor.java index 8d5d1d33..c524d29f 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/ScoreEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/ScoreEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.icon.BackGroundItem; @@ -72,7 +72,7 @@ public class ScoreEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_SCORE_TITLE) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_SCORE_TITLE) )) .addRenameHandler(s -> { score = s; @@ -90,21 +90,21 @@ public class ScoreEditor { @Override public ItemProvider getItemProvider() { if (score == null || score.isEmpty()) { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } else { try { Double.parseDouble(score); return new ItemBuilder(Material.NETHER_STAR) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NEW_VALUE + score ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))); } catch (NumberFormatException e) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_INVALID_NUMBER ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/SizeEditor.java b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/SizeEditor.java index 083ecb97..8ee058b8 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/SizeEditor.java +++ b/plugin/src/main/java/net/momirealms/customfishing/gui/page/property/SizeEditor.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.gui.page.property; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.adventure.component.ShadedAdventureComponentWrapper; import net.momirealms.customfishing.gui.SectionPage; import net.momirealms.customfishing.gui.icon.BackGroundItem; @@ -82,7 +82,7 @@ public class SizeEditor { var window = AnvilWindow.split() .setViewer(player) .setTitle(new ShadedAdventureComponentWrapper( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(CFLocale.GUI_SIZE_TITLE) + AdventureHelper.getInstance().getComponentFromMiniMessage(CFLocale.GUI_SIZE_TITLE) )) .addRenameHandler(s -> { if (s == null || s.equals("")) { @@ -103,7 +103,7 @@ public class SizeEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.IRON_INGOT).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.IRON_INGOT).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_SIZE_MIN ))); } @@ -119,7 +119,7 @@ public class SizeEditor { @Override public ItemProvider getItemProvider() { - return new ItemBuilder(Material.IRON_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.IRON_BLOCK).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_SIZE_MAX ))); } @@ -136,7 +136,7 @@ public class SizeEditor { @Override public ItemProvider getItemProvider() { if (size[0].equals("0") && size[1].equals("0")) { - return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.STRUCTURE_VOID).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_DELETE_PROPERTY ))); } else { @@ -146,22 +146,22 @@ public class SizeEditor { if (min <= max) { return new ItemBuilder(Material.PUFFERFISH) - .setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_NEW_VALUE ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( " - " + size[0] + "~" + size[1] ))) - .addLoreLines(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + .addLoreLines(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_CLICK_CONFIRM ))); } else { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_SIZE_MAX_NO_LESS ))); } } catch (NumberFormatException e) { - return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + return new ItemBuilder(Material.BARRIER).setDisplayName(new ShadedAdventureComponentWrapper(AdventureHelper.getInstance().getComponentFromMiniMessage( CFLocale.GUI_INVALID_NUMBER ))); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/Dependency.java b/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/Dependency.java index 715d0e3b..d8321eec 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/Dependency.java +++ b/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/Dependency.java @@ -28,7 +28,6 @@ package net.momirealms.customfishing.libraries.dependencies; import com.google.common.collect.ImmutableList; import net.momirealms.customfishing.libraries.dependencies.relocation.Relocation; import org.bukkit.Bukkit; -import org.jetbrains.annotations.Nullable; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -44,36 +43,38 @@ public enum Dependency { "org.ow2.asm", "asm", "9.7", - null, "asm" ), ASM_COMMONS( "org.ow2.asm", "asm-commons", "9.7", - null, "asm-commons" ), JAR_RELOCATOR( "me.lucko", "jar-relocator", "1.7", - null, "jar-relocator" ), COMMAND_API( "dev{}jorel", "commandapi-bukkit-shade", - "9.4.0", - null, + "9.4.1", "commandapi-bukkit", Relocation.of("commandapi", "dev{}jorel{}commandapi") ), + COMMAND_API_MOJMAP( + "dev{}jorel", + "commandapi-bukkit-shade-mojang-mapped", + "9.4.1", + "commandapi-bukkit-shade-mojang-mapped", + Relocation.of("commandapi", "dev{}jorel{}commandapi") + ), MARIADB_DRIVER( "org{}mariadb{}jdbc", "mariadb-java-client", "3.3.3", - null, "mariadb-java-client", Relocation.of("mariadb", "org{}mariadb") ), @@ -81,23 +82,13 @@ public enum Dependency { "dev{}dejvokep", "boosted-yaml", "1.3.4", - null, "boosted-yaml", Relocation.of("boostedyaml", "dev{}dejvokep{}boostedyaml") ), - NBT_API( - "de{}tr7zw", - "item-nbt-api", - "2.12.4", - "codemc", - "item-nbt-api", - Relocation.of("changeme", "de{}tr7zw{}changeme") - ), EXP4J( "net{}objecthunter", "exp4j", "0.4.8", - null, "exp4j", Relocation.of("exp4j", "net{}objecthunter{}exp4j") ), @@ -105,7 +96,6 @@ public enum Dependency { "com{}mysql", "mysql-connector-j", "8.4.0", - null, "mysql-connector-j", Relocation.of("mysql", "com{}mysql") ), @@ -113,21 +103,18 @@ public enum Dependency { "com.h2database", "h2", "2.2.224", - null, "h2database" ), SQLITE_DRIVER( "org.xerial", "sqlite-jdbc", "3.45.3.0", - null, "sqlite-jdbc" ), HIKARI( "com{}zaxxer", "HikariCP", "5.1.0", - null, "HikariCP", Relocation.of("hikari", "com{}zaxxer{}hikari") ), @@ -135,21 +122,18 @@ public enum Dependency { "org.slf4j", "slf4j-simple", "2.0.12", - null, "slf4j-simple" ), SLF4J_API( "org.slf4j", "slf4j-api", "2.0.12", - null, "slf4j-api" ), MONGODB_DRIVER_CORE( "org{}mongodb", "mongodb-driver-core", "5.1.0", - null, "mongodb-driver-core", Relocation.of("mongodb", "com{}mongodb"), Relocation.of("bson", "org{}bson") @@ -158,7 +142,6 @@ public enum Dependency { "org{}mongodb", "mongodb-driver-sync", "5.1.0", - null, "mongodb-driver-sync", Relocation.of("mongodb", "com{}mongodb"), Relocation.of("bson", "org{}bson") @@ -167,7 +150,6 @@ public enum Dependency { "org{}mongodb", "bson", "5.1.0", - null, "mongodb-bson", Relocation.of("mongodb", "com{}mongodb"), Relocation.of("bson", "org{}bson") @@ -176,7 +158,6 @@ public enum Dependency { "redis{}clients", "jedis", "5.1.2", - null, "jedis", Relocation.of("jedis", "redis{}clients{}jedis"), Relocation.of("commonspool2", "org{}apache{}commons{}pool2") @@ -185,7 +166,6 @@ public enum Dependency { "org{}bstats", "bstats-base", "3.0.2", - null, "bstats-base", Relocation.of("bstats", "org{}bstats") ), @@ -193,7 +173,6 @@ public enum Dependency { "org{}bstats", "bstats-bukkit", "3.0.2", - null, "bstats-bukkit", Relocation.of("bstats", "org{}bstats") ), @@ -201,65 +180,19 @@ public enum Dependency { "org{}apache{}commons", "commons-pool2", "2.12.0", - null, "commons-pool2", Relocation.of("commonspool2", "org{}apache{}commons{}pool2") ), - INV_UI( - "xyz{}xenondevs{}invui", - "invui-core", - "1.30", - "xenondevs", - "invui-core", - Relocation.of("invui", "xyz{}xenondevs{}invui"), - Relocation.of("inventoryaccess", "xyz{}xenondevs{}inventoryaccess") - ), - INV_UI_ACCESS( - "xyz{}xenondevs{}invui", - "inventory-access", - "1.30", - "xenondevs", - "inventory-access", - Relocation.of("inventoryaccess", "xyz{}xenondevs{}inventoryaccess") - ), - INV_UI_NMS( - "xyz{}xenondevs{}invui", - getInvUINms(), - "1.30", - "xenondevs", - getInvUINms(), - Relocation.of("inventoryaccess", "xyz{}xenondevs{}inventoryaccess") - ), - BIOME_API( - "com{}github{}Xiao-MoMi", - "BiomeAPI", - "0.6", - "jitpack", - "biome-api", - Relocation.of("biomeapi", "net{}momirealms{}biomeapi") - ), GSON( "com.google.code.gson", "gson", "2.10.1", - null, "gson" ), - ADVENTURE_BUNDLE( - "com.github.Xiao-MoMi", - "Adventure-Bundle", - "4.16.0", - "jitpack", - "adventure-bundle", - Relocation.of("adventure", "net{}kyori{}adventure"), - Relocation.of("option", "net{}kyori{}option"), - Relocation.of("examination", "net{}kyori{}examination") - ), COMMONS_LANG_3( "org{}apache{}commons", "commons-lang3", "3.14.0", - null, "commons-lang3", Relocation.of("lang3", "org{}apache{}commons{}lang3") ); @@ -267,16 +200,15 @@ public enum Dependency { private final String mavenRepoPath; private final String version; private final List relocations; - private final String repo; private final String artifact; private static final String MAVEN_FORMAT = "%s/%s/%s/%s-%s.jar"; - Dependency(String groupId, String artifactId, String version, String repo, String artifact) { - this(groupId, artifactId, version, repo, artifact, new Relocation[0]); + Dependency(String groupId, String artifactId, String version, String artifact) { + this(groupId, artifactId, version, artifact, new Relocation[0]); } - Dependency(String groupId, String artifactId, String version, String repo, String artifact, Relocation... relocations) { + Dependency(String groupId, String artifactId, String version, String artifact, Relocation... relocations) { this.mavenRepoPath = String.format(MAVEN_FORMAT, rewriteEscaping(groupId).replace(".", "/"), rewriteEscaping(artifactId), @@ -286,7 +218,6 @@ public enum Dependency { ); this.version = version; this.relocations = ImmutableList.copyOf(relocations); - this.repo = repo; this.artifact = artifact; } @@ -310,42 +241,4 @@ public enum Dependency { public List getRelocations() { return this.relocations; } - - /** - * Creates a {@link MessageDigest} suitable for computing the checksums - * of dependencies. - * - * @return the digest - */ - public static MessageDigest createDigest() { - try { - return MessageDigest.getInstance("SHA-256"); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException(e); - } - } - - @Nullable - public String getRepo() { - return repo; - } - - private static String getInvUINms() { - String version = Bukkit.getServer().getBukkitVersion().split("-")[0]; - String artifact; - switch (version) { - case "1.17.1" -> artifact = "r9"; - case "1.18.1" -> artifact = "r10"; - case "1.18.2" -> artifact = "r11"; - case "1.19.1", "1.19.2" -> artifact = "r13"; - case "1.19.3" -> artifact = "r14"; - case "1.19.4" -> artifact = "r15"; - case "1.20.1" -> artifact = "r16"; - case "1.20.2" -> artifact = "r17"; - case "1.20.3", "1.20.4" -> artifact = "r18"; - case "1.20.5", "1.20.6" -> artifact = "r19"; - default -> throw new RuntimeException("Unsupported version: " + version); - } - return String.format("inventory-access-%s", artifact); - } } diff --git a/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/DependencyManagerImpl.java b/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/DependencyManagerImpl.java index 68ae2a31..878bb175 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/DependencyManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/DependencyManagerImpl.java @@ -153,33 +153,16 @@ public class DependencyManagerImpl implements DependencyManager { DependencyDownloadException lastError = null; String fileName = dependency.getFileName(null); - String forceRepo = dependency.getRepo(); - if (forceRepo == null) { - // attempt to download the dependency from each repo in order. - for (DependencyRepository repo : DependencyRepository.values()) { - if (repo.getId().equals("maven") && TimeZone.getDefault().getID().startsWith("Asia")) { - continue; - } - try { - LogUtils.info("Downloading dependency(" + fileName + ") from " + repo.getUrl() + dependency.getMavenRepoPath()); - repo.download(dependency, file); - LogUtils.info("Successfully downloaded " + fileName); - return file; - } catch (DependencyDownloadException e) { - lastError = e; - } - } - } else { - DependencyRepository repository = DependencyRepository.getByID(forceRepo); - if (repository != null) { - try { - LogUtils.info("Downloading dependency(" + fileName + ") from " + repository.getUrl() + dependency.getMavenRepoPath()); - repository.download(dependency, file); - LogUtils.info("Successfully downloaded " + fileName); - return file; - } catch (DependencyDownloadException e) { - lastError = e; - } + + // attempt to download the dependency from each repo in order. + for (DependencyRepository repo : DependencyRepository.values()) { + try { + LogUtils.info("Downloading dependency(" + fileName + ") from " + repo.getUrl() + dependency.getMavenRepoPath()); + repo.download(dependency, file); + LogUtils.info("Successfully downloaded " + fileName); + return file; + } catch (DependencyDownloadException e) { + lastError = e; } } throw Objects.requireNonNull(lastError); diff --git a/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/DependencyRepository.java b/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/DependencyRepository.java index a909322b..a8538048 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/DependencyRepository.java +++ b/plugin/src/main/java/net/momirealms/customfishing/libraries/dependencies/DependencyRepository.java @@ -40,7 +40,7 @@ import java.util.concurrent.TimeUnit; */ public enum DependencyRepository { - MAVEN_CENTRAL("maven", "https://repo1.maven.org/maven2/") { + MAVEN_CENTRAL("https://repo1.maven.org/maven2/") { @Override protected URLConnection openConnection(Dependency dependency) throws IOException { URLConnection connection = super.openConnection(dependency); @@ -53,41 +53,18 @@ public enum DependencyRepository { /** * Maven Central */ - MAVEN_CENTRAL_MIRROR("aliyun", "https://maven.aliyun.com/repository/public/"), - /** - * Code MC - */ - CODE_MC("codemc", "https://repo.codemc.io/repository/maven-public/"), - /** - * xenondevs - */ - XENONDEVS("xenondevs", "https://repo.xenondevs.xyz/releases/"), - /** - * Jitpack - */ - JITPACK("jitpack", "https://jitpack.io/"); + MAVEN_CENTRAL_MIRROR("https://maven.aliyun.com/repository/public/"); private final String url; - private final String id; - DependencyRepository(String id, String url) { + DependencyRepository(String url) { this.url = url; - this.id = id; } public String getUrl() { return url; } - public static DependencyRepository getByID(String id) { - for (DependencyRepository repository : values()) { - if (id.equals(repository.id)) { - return repository; - } - } - return null; - } - /** * Opens a connection to the given {@code dependency}. * @@ -146,8 +123,4 @@ public enum DependencyRepository { throw new DependencyDownloadException(e); } } - - public String getId() { - return id; - } } diff --git a/plugin/src/main/java/net/momirealms/customfishing/mechanic/action/ActionManagerImpl.java b/plugin/src/main/java/net/momirealms/customfishing/mechanic/action/ActionManagerImpl.java index edb23fde..84082f06 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/mechanic/action/ActionManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/mechanic/action/ActionManagerImpl.java @@ -19,7 +19,7 @@ package net.momirealms.customfishing.mechanic.action; import net.kyori.adventure.key.Key; import net.kyori.adventure.sound.Sound; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.common.Pair; import net.momirealms.customfishing.api.manager.ActionManager; @@ -306,7 +306,7 @@ public class ActionManagerImpl implements ActionManager { condition.getArgs() ); for (String text : replaced) { - AdventureManagerImpl.getInstance().sendPlayerMessage(condition.getPlayer(), text); + AdventureHelper.getInstance().sendPlayerMessage(condition.getPlayer(), text); } }; }); @@ -321,7 +321,7 @@ public class ActionManagerImpl implements ActionManager { ); for (Player player : Bukkit.getOnlinePlayers()) { for (String text : replaced) { - AdventureManagerImpl.getInstance().sendPlayerMessage(player, text); + AdventureHelper.getInstance().sendPlayerMessage(player, text); } } }; @@ -344,7 +344,7 @@ public class ActionManagerImpl implements ActionManager { condition.getArgs() ); for (String text : replaced) { - AdventureManagerImpl.getInstance().sendPlayerMessage((Player) player, text); + AdventureHelper.getInstance().sendPlayerMessage((Player) player, text); } condition.delArg("{near}"); } @@ -362,7 +362,7 @@ public class ActionManagerImpl implements ActionManager { if (Math.random() > chance) return; String random = msg.get(ThreadLocalRandom.current().nextInt(msg.size())); random = PlaceholderManagerImpl.getInstance().parse(condition.getPlayer(), random, condition.getArgs()); - AdventureManagerImpl.getInstance().sendPlayerMessage(condition.getPlayer(), random); + AdventureHelper.getInstance().sendPlayerMessage(condition.getPlayer(), random); }; }); } @@ -441,7 +441,7 @@ public class ActionManagerImpl implements ActionManager { return condition -> { if (Math.random() > chance) return; String parsed = PlaceholderManagerImpl.getInstance().parse(condition.getPlayer(), text, condition.getArgs()); - AdventureManagerImpl.getInstance().sendActionbar(condition.getPlayer(), parsed); + AdventureHelper.getInstance().sendActionbar(condition.getPlayer(), parsed); }; }); registerAction("random-actionbar", (args, chance) -> { @@ -450,7 +450,7 @@ public class ActionManagerImpl implements ActionManager { if (Math.random() > chance) return; String random = texts.get(ThreadLocalRandom.current().nextInt(texts.size())); random = PlaceholderManagerImpl.getInstance().parse(condition.getPlayer(), random, condition.getArgs()); - AdventureManagerImpl.getInstance().sendActionbar(condition.getPlayer(), random); + AdventureHelper.getInstance().sendActionbar(condition.getPlayer(), random); }; }); registerAction("actionbar-nearby", (args, chance) -> { @@ -470,7 +470,7 @@ public class ActionManagerImpl implements ActionManager { actionbar, condition.getArgs() ); - AdventureManagerImpl.getInstance().sendActionbar((Player) player, replaced); + AdventureHelper.getInstance().sendActionbar((Player) player, replaced); condition.delArg("{near}"); } } @@ -493,7 +493,7 @@ public class ActionManagerImpl implements ActionManager { condition.getPlayer().getLocation().getWorld().spawn(condition.getPlayer().getLocation(), ExperienceOrb.class, e -> e.setExperience((int) value.get(condition.getPlayer(), condition.getArgs()))); } else { condition.getPlayer().giveExp((int) value.get(condition.getPlayer(), condition.getArgs()), true); - AdventureManagerImpl.getInstance().sendSound(condition.getPlayer(), Sound.Source.PLAYER, Key.key("minecraft:entity.experience_orb.pickup"), 1, 1); + AdventureHelper.getInstance().sendSound(condition.getPlayer(), Sound.Source.PLAYER, Key.key("minecraft:entity.experience_orb.pickup"), 1, 1); } }; }); @@ -524,7 +524,7 @@ public class ActionManagerImpl implements ActionManager { return condition -> { if (Math.random() > chance) return; condition.getPlayer().giveExp((int) value.get(condition.getPlayer(), condition.getArgs())); - AdventureManagerImpl.getInstance().sendSound(condition.getPlayer(), Sound.Source.PLAYER, Key.key("minecraft:entity.experience_orb.pickup"), 1, 1); + AdventureHelper.getInstance().sendSound(condition.getPlayer(), Sound.Source.PLAYER, Key.key("minecraft:entity.experience_orb.pickup"), 1, 1); }; }); } @@ -551,7 +551,7 @@ public class ActionManagerImpl implements ActionManager { ArmorStandUtils.sendHologram( (Player) player, location.clone().add(x, y, z), - AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + AdventureHelper.getInstance().getComponentFromMiniMessage( PlaceholderManagerImpl.getInstance().parse(owner, text, condition.getArgs()) ), duration @@ -564,7 +564,7 @@ public class ActionManagerImpl implements ActionManager { ArmorStandUtils.sendHologram( owner, location.clone().add(x, y, z), - AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + AdventureHelper.getInstance().getComponentFromMiniMessage( PlaceholderManagerImpl.getInstance().parse(owner, text, condition.getArgs()) ), duration @@ -830,7 +830,7 @@ public class ActionManagerImpl implements ActionManager { int fadeOut = section.getInt("fade-out", 10); return condition -> { if (Math.random() > chance) return; - AdventureManagerImpl.getInstance().sendTitle( + AdventureHelper.getInstance().sendTitle( condition.getPlayer(), PlaceholderManagerImpl.getInstance().parse(condition.getPlayer(), title, condition.getArgs()), PlaceholderManagerImpl.getInstance().parse(condition.getPlayer(), subtitle, condition.getArgs()), @@ -859,7 +859,7 @@ public class ActionManagerImpl implements ActionManager { double distance = LocationUtils.getDistance(player.getLocation(), condition.getLocation()); if (distance <= range) { condition.insertArg("{near}", player.getName()); - AdventureManagerImpl.getInstance().sendTitle( + AdventureHelper.getInstance().sendTitle( condition.getPlayer(), PlaceholderManagerImpl.getInstance().parse(condition.getPlayer(), title, condition.getArgs()), PlaceholderManagerImpl.getInstance().parse(condition.getPlayer(), subtitle, condition.getArgs()), @@ -889,7 +889,7 @@ public class ActionManagerImpl implements ActionManager { int fadeOut = section.getInt("fade-out", 10); return condition -> { if (Math.random() > chance) return; - AdventureManagerImpl.getInstance().sendTitle( + AdventureHelper.getInstance().sendTitle( condition.getPlayer(), PlaceholderManagerImpl.getInstance().parse(condition.getPlayer(), titles.get(ThreadLocalRandom.current().nextInt(titles.size())), condition.getArgs()), PlaceholderManagerImpl.getInstance().parse(condition.getPlayer(), subtitles.get(ThreadLocalRandom.current().nextInt(subtitles.size())), condition.getArgs()), @@ -947,7 +947,7 @@ public class ActionManagerImpl implements ActionManager { ); return condition -> { if (Math.random() > chance) return; - AdventureManagerImpl.getInstance().sendSound(condition.getPlayer(), sound); + AdventureHelper.getInstance().sendSound(condition.getPlayer(), sound); }; } else { LogUtils.warn("Illegal value format found at action: sound"); @@ -1047,7 +1047,7 @@ public class ActionManagerImpl implements ActionManager { stringJoiner.add(loot); } condition.delArg("{lava}"); - AdventureManagerImpl.getInstance().sendMessageWithPrefix(condition.getPlayer(), CFLocale.MSG_Possible_Loots + stringJoiner); + AdventureHelper.getInstance().sendMessageWithPrefix(condition.getPlayer(), CFLocale.MSG_Possible_Loots + stringJoiner); }; }); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/mechanic/bag/BagManagerImpl.java b/plugin/src/main/java/net/momirealms/customfishing/mechanic/bag/BagManagerImpl.java index a2715e0b..ad782914 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/mechanic/bag/BagManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/mechanic/bag/BagManagerImpl.java @@ -18,7 +18,7 @@ package net.momirealms.customfishing.mechanic.bag; import net.momirealms.customfishing.CustomFishingPluginImpl; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.data.user.OfflineUser; import net.momirealms.customfishing.api.manager.BagManager; @@ -110,7 +110,7 @@ public class BagManagerImpl implements BagManager, Listener { Inventory bag = onlinePlayer.getHolder().getInventory(); if (bag.getSize() != rows * 9) { Inventory newBag = InventoryUtils.createInventory(onlinePlayer.getHolder(), rows * 9, - AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + AdventureHelper.getInstance().getComponentFromMiniMessage( PlaceholderManagerImpl.getInstance().parse( player, bagTitle, Map.of("{player}", player.getName()) ) diff --git a/plugin/src/main/java/net/momirealms/customfishing/mechanic/competition/actionbar/ActionBarSender.java b/plugin/src/main/java/net/momirealms/customfishing/mechanic/competition/actionbar/ActionBarSender.java index a407da0d..84124c45 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/mechanic/competition/actionbar/ActionBarSender.java +++ b/plugin/src/main/java/net/momirealms/customfishing/mechanic/competition/actionbar/ActionBarSender.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.mechanic.competition.actionbar; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.mechanic.competition.ActionBarConfig; import net.momirealms.customfishing.api.scheduler.CancellableTask; @@ -98,7 +98,7 @@ public class ActionBarSender { DynamicText text = texts[counter % (texts.length)]; updatePrivatePlaceholders(); text.update(privatePlaceholders); - AdventureManagerImpl.getInstance().sendActionbar( + AdventureHelper.getInstance().sendActionbar( player, text.getLatestValue() ); diff --git a/plugin/src/main/java/net/momirealms/customfishing/mechanic/competition/bossbar/BossBarSender.java b/plugin/src/main/java/net/momirealms/customfishing/mechanic/competition/bossbar/BossBarSender.java index 7ea0ab98..262ceda3 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/mechanic/competition/bossbar/BossBarSender.java +++ b/plugin/src/main/java/net/momirealms/customfishing/mechanic/competition/bossbar/BossBarSender.java @@ -24,7 +24,7 @@ import com.comphenix.protocol.wrappers.WrappedChatComponent; import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.momirealms.customfishing.CustomFishingPluginImpl; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.mechanic.competition.BossBarConfig; import net.momirealms.customfishing.api.scheduler.CancellableTask; @@ -152,7 +152,7 @@ public class BossBarSender { try { Object chatComponent = ReflectionUtils.iChatComponentMethod.invoke(null, GsonComponentSerializer.gson().serialize( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + AdventureHelper.getInstance().getComponentFromMiniMessage( text.getLatestValue() ))); Object updatePacket = ReflectionUtils.updateConstructor.newInstance(chatComponent); diff --git a/plugin/src/main/java/net/momirealms/customfishing/mechanic/fishing/FishingManagerImpl.java b/plugin/src/main/java/net/momirealms/customfishing/mechanic/fishing/FishingManagerImpl.java index f1c0e497..a760a84c 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/mechanic/fishing/FishingManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/mechanic/fishing/FishingManagerImpl.java @@ -23,7 +23,7 @@ import de.tr7zw.changeme.nbtapi.NBTItem; import net.kyori.adventure.key.Key; import net.kyori.adventure.sound.Sound; import net.momirealms.customfishing.CustomFishingPluginImpl; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.common.Pair; import net.momirealms.customfishing.api.event.FishingResultEvent; import net.momirealms.customfishing.api.event.LavaFishingEvent; @@ -672,7 +672,7 @@ public class FishingManagerImpl implements Listener, FishingManager { doSuccessActions(loot, effect, fishingPreparation, player); if (pair.right() > 0) { player.giveExp(pair.right(), true); - AdventureManagerImpl.getInstance().sendSound(player, Sound.Source.PLAYER, Key.key("minecraft:entity.experience_orb.pickup"), 1, 1); + AdventureHelper.getInstance().sendSound(player, Sound.Source.PLAYER, Key.key("minecraft:entity.experience_orb.pickup"), 1, 1); } }, hook.getLocation(), (long) CFConfig.multipleLootSpawnDelay * i); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/mechanic/fishing/HookCheckTimerTask.java b/plugin/src/main/java/net/momirealms/customfishing/mechanic/fishing/HookCheckTimerTask.java index 564e64e3..a0eafee1 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/mechanic/fishing/HookCheckTimerTask.java +++ b/plugin/src/main/java/net/momirealms/customfishing/mechanic/fishing/HookCheckTimerTask.java @@ -19,7 +19,7 @@ package net.momirealms.customfishing.mechanic.fishing; import net.kyori.adventure.key.Key; import net.kyori.adventure.sound.Sound; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.event.FishHookLandEvent; import net.momirealms.customfishing.api.event.LavaFishingEvent; @@ -302,7 +302,7 @@ public class HookCheckTimerTask implements Runnable { this.fishHooked = true; this.removeTempEntity(); - AdventureManagerImpl.getInstance().sendSound( + AdventureHelper.getInstance().sendSound( fishingPreparation.getPlayer(), Sound.Source.NEUTRAL, Key.key("minecraft:block.pointed_dripstone.drip_lava_into_cauldron"), diff --git a/plugin/src/main/java/net/momirealms/customfishing/mechanic/game/GameManagerImpl.java b/plugin/src/main/java/net/momirealms/customfishing/mechanic/game/GameManagerImpl.java index 7cf6cf60..50037e9d 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/mechanic/game/GameManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/mechanic/game/GameManagerImpl.java @@ -19,7 +19,7 @@ package net.momirealms.customfishing.mechanic.game; import net.kyori.adventure.key.Key; import net.kyori.adventure.sound.Sound; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.common.Pair; import net.momirealms.customfishing.api.manager.GameManager; @@ -258,7 +258,7 @@ public class GameManagerImpl implements GameManager { + OffsetUtils.getOffsetChars(pointerOffset + progress) + FontUtils.surroundWithFont(pointerImage, font) + OffsetUtils.getOffsetChars(totalWidth - progress - pointerWidth); - AdventureManagerImpl.getInstance().sendTitle(player, sendTitle, bar,0,10,0); + AdventureHelper.getInstance().sendTitle(player, sendTitle, bar,0,10,0); } @Override @@ -397,7 +397,7 @@ public class GameManagerImpl implements GameManager { + OffsetUtils.getOffsetChars((int) (-barEffectiveWidth - 1 + fish_position)) + FontUtils.surroundWithFont(pointerImage, font) + OffsetUtils.getOffsetChars((int) (barEffectiveWidth - fish_position - pointerIconWidth + 1)); - AdventureManagerImpl.getInstance().sendTitle( + AdventureHelper.getInstance().sendTitle( player, tip != null && !played ? tip : title.replace("{progress}", progress[(int) ((hold_time / time_requirement) * progress.length)]), bar, @@ -489,7 +489,7 @@ public class GameManagerImpl implements GameManager { + FontUtils.surroundWithFont((struggling_time > 0 ? strugglingFishImage[struggling_time % strugglingFishImage.length] : fishImage), font) + OffsetUtils.getOffsetChars(barEffectiveWidth - fish_position - fishIconWidth); strain = Math.max(0, Math.min(strain, ultimateTension)); - AdventureManagerImpl.getInstance().sendTitle( + AdventureHelper.getInstance().sendTitle( player, tip != null && !played ? tip : title.replace("{tension}", tension[(int) ((strain / ultimateTension) * tension.length)]), bar, @@ -554,7 +554,7 @@ public class GameManagerImpl implements GameManager { public void onTick() { showUI(); if (tip != null) { - AdventureManagerImpl.getInstance().sendActionbar(player, tip); + AdventureHelper.getInstance().sendActionbar(player, tip); } } @@ -565,7 +565,7 @@ public class GameManagerImpl implements GameManager { setGameResult(false); fail = true; showUI(); - AdventureManagerImpl.getInstance().sendSound( + AdventureHelper.getInstance().sendSound( player, Sound.Source.PLAYER, Key.key(wrongSound), @@ -576,7 +576,7 @@ public class GameManagerImpl implements GameManager { return true; } - AdventureManagerImpl.getInstance().sendSound( + AdventureHelper.getInstance().sendSound( player, Sound.Source.PLAYER, Key.key(correctSound), @@ -598,7 +598,7 @@ public class GameManagerImpl implements GameManager { setGameResult(false); fail = true; showUI(); - AdventureManagerImpl.getInstance().sendSound( + AdventureHelper.getInstance().sendSound( player, Sound.Source.PLAYER, Key.key(wrongSound), @@ -609,7 +609,7 @@ public class GameManagerImpl implements GameManager { return false; } - AdventureManagerImpl.getInstance().sendSound( + AdventureHelper.getInstance().sendSound( player, Sound.Source.PLAYER, Key.key(correctSound), @@ -631,7 +631,7 @@ public class GameManagerImpl implements GameManager { setGameResult(false); fail = true; showUI(); - AdventureManagerImpl.getInstance().sendSound( + AdventureHelper.getInstance().sendSound( player, Sound.Source.PLAYER, Key.key(wrongSound), @@ -642,7 +642,7 @@ public class GameManagerImpl implements GameManager { return false; } - AdventureManagerImpl.getInstance().sendSound( + AdventureHelper.getInstance().sendSound( player, Sound.Source.PLAYER, Key.key(correctSound), @@ -669,7 +669,7 @@ public class GameManagerImpl implements GameManager { setGameResult(false); fail = true; showUI(); - AdventureManagerImpl.getInstance().sendSound( + AdventureHelper.getInstance().sendSound( player, Sound.Source.PLAYER, Key.key(wrongSound), @@ -680,7 +680,7 @@ public class GameManagerImpl implements GameManager { return true; } - AdventureManagerImpl.getInstance().sendSound( + AdventureHelper.getInstance().sendSound( player, Sound.Source.PLAYER, Key.key(correctSound), @@ -724,7 +724,7 @@ public class GameManagerImpl implements GameManager { } } } - AdventureManagerImpl.getInstance().sendTitle( + AdventureHelper.getInstance().sendTitle( player, sb.toString(), subtitle.replace("{time}", String.format("%.1f", ((double) deadline - System.currentTimeMillis())/1000)), @@ -768,7 +768,7 @@ public class GameManagerImpl implements GameManager { } } } - AdventureManagerImpl.getInstance().sendTitle( + AdventureHelper.getInstance().sendTitle( player, sb.toString(), subtitle.replace("{time}", String.format("%.1f", ((double) deadline - System.currentTimeMillis())/1000)), @@ -843,7 +843,7 @@ public class GameManagerImpl implements GameManager { } public void showUI() { - AdventureManagerImpl.getInstance().sendTitle( + AdventureHelper.getInstance().sendTitle( player, title.replace("{click}", String.valueOf(clickedTimes)), subtitle.replace("{clicks}", String.valueOf(requiredTimes)).replace("{time}", String.format("%.1f", ((double) deadline - System.currentTimeMillis())/1000)), @@ -919,7 +919,7 @@ public class GameManagerImpl implements GameManager { stringBuilder.append(barBody); } - AdventureManagerImpl.getInstance().sendTitle( + AdventureHelper.getInstance().sendTitle( player, stringBuilder.toString(), subtitle, @@ -995,7 +995,7 @@ public class GameManagerImpl implements GameManager { + OffsetUtils.getOffsetChars(progress + pointerOffset) + FontUtils.surroundWithFont(pointerImage, font) + OffsetUtils.getOffsetChars(barEffectiveWidth - progress - pointerIconWidth + 1); - AdventureManagerImpl.getInstance().sendTitle( + AdventureHelper.getInstance().sendTitle( player, title, bar, @@ -1160,7 +1160,7 @@ public class GameManagerImpl implements GameManager { + OffsetUtils.getOffsetChars((int) (-barEffectiveWidth - 1 + fish_position)) + FontUtils.surroundWithFont(pointerImage, font) + OffsetUtils.getOffsetChars((int) (barEffectiveWidth - fish_position - pointerIconWidth + 1)); - AdventureManagerImpl.getInstance().sendTitle( + AdventureHelper.getInstance().sendTitle( player, tip != null && !played ? tip : title.replace("{progress}", progress[(int) ((hold_time / time_requirement) * progress.length)]), bar, diff --git a/plugin/src/main/java/net/momirealms/customfishing/mechanic/item/ItemManagerImpl.java b/plugin/src/main/java/net/momirealms/customfishing/mechanic/item/ItemManagerImpl.java index f45f5804..696e3a6f 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/mechanic/item/ItemManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/mechanic/item/ItemManagerImpl.java @@ -18,7 +18,7 @@ package net.momirealms.customfishing.mechanic.item; import de.tr7zw.changeme.nbtapi.*; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.common.Key; import net.momirealms.customfishing.api.common.Pair; @@ -585,8 +585,8 @@ public class ItemManagerImpl implements ItemManager, Listener { if (name == null) return this; editors.put("name", (player, nbtItem, placeholders) -> { NBTCompound displayCompound = nbtItem.getOrCreateCompound("display"); - displayCompound.setString("Name", AdventureManagerImpl.getInstance().componentToJson( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + displayCompound.setString("Name", AdventureHelper.getInstance().componentToJson( + AdventureHelper.getInstance().getComponentFromMiniMessage( "" + PlaceholderManagerImpl.getInstance().parse(player, name, placeholders) ) )); @@ -645,8 +645,8 @@ public class ItemManagerImpl implements ItemManager, Listener { NBTCompound displayCompound = nbtItem.getOrCreateCompound("display"); NBTList list = displayCompound.getStringList("Lore"); list.clear(); - list.addAll(lore.stream().map(s -> AdventureManagerImpl.getInstance().componentToJson( - AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + list.addAll(lore.stream().map(s -> AdventureHelper.getInstance().componentToJson( + AdventureHelper.getInstance().getComponentFromMiniMessage( "" + PlaceholderManagerImpl.getInstance().parse(player, s, placeholders) ) )).toList()); diff --git a/plugin/src/main/java/net/momirealms/customfishing/mechanic/market/MarketGUI.java b/plugin/src/main/java/net/momirealms/customfishing/mechanic/market/MarketGUI.java index ea412da3..17b75777 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/mechanic/market/MarketGUI.java +++ b/plugin/src/main/java/net/momirealms/customfishing/mechanic/market/MarketGUI.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.mechanic.market; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.data.EarningData; import net.momirealms.customfishing.api.mechanic.market.MarketGUIHolder; @@ -62,7 +62,7 @@ public class MarketGUI { this.inventory = InventoryUtils.createInventory( holder, manager.getLayout().length * 9, - AdventureManagerImpl.getInstance().getComponentFromMiniMessage(manager.getTitle()) + AdventureHelper.getInstance().getComponentFromMiniMessage(manager.getTitle()) ); holder.setInventory(this.inventory); } diff --git a/plugin/src/main/java/net/momirealms/customfishing/mechanic/requirement/RequirementManagerImpl.java b/plugin/src/main/java/net/momirealms/customfishing/mechanic/requirement/RequirementManagerImpl.java index c9e375df..a278a44a 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/mechanic/requirement/RequirementManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/mechanic/requirement/RequirementManagerImpl.java @@ -17,7 +17,6 @@ package net.momirealms.customfishing.mechanic.requirement; -import net.momirealms.biomeapi.BiomeAPI; import net.momirealms.customfishing.CustomFishingPluginImpl; import net.momirealms.customfishing.api.common.Pair; import net.momirealms.customfishing.api.integration.LevelInterface; @@ -36,6 +35,7 @@ import net.momirealms.customfishing.compatibility.papi.ParseUtils; import net.momirealms.customfishing.util.ClassUtils; import net.momirealms.customfishing.util.ConfigUtils; import net.momirealms.customfishing.util.MoonPhase; +import net.momirealms.sparrow.heart.SparrowHeart; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -581,7 +581,7 @@ public class RequirementManagerImpl implements RequirementManager { registerRequirement("biome", (args, actions, advanced) -> { HashSet biomes = new HashSet<>(ConfigUtils.stringListArgs(args)); return condition -> { - String currentBiome = BiomeAPI.getBiomeAt(condition.getLocation()); + String currentBiome = SparrowHeart.getInstance().getBiomeResourceLocation(condition.getLocation()); if (biomes.contains(currentBiome)) return true; if (advanced) triggerActions(actions, condition); @@ -591,7 +591,7 @@ public class RequirementManagerImpl implements RequirementManager { registerRequirement("!biome", (args, actions, advanced) -> { HashSet biomes = new HashSet<>(ConfigUtils.stringListArgs(args)); return condition -> { - String currentBiome = BiomeAPI.getBiomeAt(condition.getLocation()); + String currentBiome = SparrowHeart.getInstance().getBiomeResourceLocation(condition.getLocation()); if (!biomes.contains(currentBiome)) return true; if (advanced) triggerActions(actions, condition); diff --git a/plugin/src/main/java/net/momirealms/customfishing/storage/user/OfflineUserImpl.java b/plugin/src/main/java/net/momirealms/customfishing/storage/user/OfflineUserImpl.java index 3d2d0233..066a2ef4 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/storage/user/OfflineUserImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/storage/user/OfflineUserImpl.java @@ -17,7 +17,7 @@ package net.momirealms.customfishing.storage.user; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.data.EarningData; import net.momirealms.customfishing.api.data.InventoryData; @@ -62,7 +62,7 @@ public class OfflineUserImpl implements OfflineUser { OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid); // Set up the inventory for the FishingBagHolder this.holder.setInventory(InventoryUtils.createInventory(this.holder, playerData.getBagData().size, - AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + AdventureHelper.getInstance().getComponentFromMiniMessage( PlaceholderManagerImpl.getInstance().parse( offlinePlayer, CustomFishingPlugin.get().getBagManager().getBagTitle(), diff --git a/plugin/src/main/java/net/momirealms/customfishing/util/ItemUtils.java b/plugin/src/main/java/net/momirealms/customfishing/util/ItemUtils.java index 255c71be..a1aeea39 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/util/ItemUtils.java +++ b/plugin/src/main/java/net/momirealms/customfishing/util/ItemUtils.java @@ -23,7 +23,7 @@ import de.tr7zw.changeme.nbtapi.NBTList; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.ScoreComponent; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; -import net.momirealms.customfishing.adventure.AdventureManagerImpl; +import net.momirealms.customfishing.adventure.AdventureHelper; import net.momirealms.customfishing.api.CustomFishingPlugin; import net.momirealms.customfishing.api.common.Pair; import net.momirealms.customfishing.api.mechanic.hook.HookSetting; @@ -79,7 +79,7 @@ public class ItemUtils { } else { for (String newLore : setting.getLore()) { ScoreComponent.Builder builder = Component.score().name("cf").objective("hook"); - builder.append(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.append(AdventureHelper.getInstance().getComponentFromMiniMessage( newLore.replace("{dur}", String.valueOf(cfCompound.getInteger("hook_dur"))) .replace("{max}", String.valueOf(setting.getMaxDurability())) )); @@ -93,7 +93,7 @@ public class ItemUtils { int current = cfCompound.getInteger("cur_dur"); for (String newLore : CFConfig.durabilityLore) { ScoreComponent.Builder builder = Component.score().name("cf").objective("durability"); - builder.append(AdventureManagerImpl.getInstance().getComponentFromMiniMessage( + builder.append(AdventureHelper.getInstance().getComponentFromMiniMessage( newLore.replace("{dur}", String.valueOf(current)) .replace("{max}", String.valueOf(max)) )); diff --git a/plugin/src/main/java/net/momirealms/customfishing/util/NBTUtils.java b/plugin/src/main/java/net/momirealms/customfishing/util/NBTUtils.java index 6e4bc6a2..34b8c16b 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/util/NBTUtils.java +++ b/plugin/src/main/java/net/momirealms/customfishing/util/NBTUtils.java @@ -227,7 +227,7 @@ public class NBTUtils { case NBTTagIntArray -> map.put(key, "(IntArray) " + Arrays.toString(nbtCompound.getIntArray(key))); case NBTTagCompound -> { Map map1 = compoundToMap(Objects.requireNonNull(nbtCompound.getCompound(key))); - if (map1.size() != 0) map.put(key, map1); + if (!map1.isEmpty()) map.put(key, map1); } case NBTTagList -> { List list = new ArrayList<>(); @@ -240,7 +240,7 @@ public class NBTUtils { case NBTTagLong -> nbtCompound.getLongList(key).forEach(a -> list.add("(Long) " + a)); case NBTTagIntArray -> nbtCompound.getIntArrayList(key).forEach(a -> list.add("(IntArray) " + Arrays.toString(a))); } - if (list.size() != 0) map.put(key, list); + if (!list.isEmpty()) map.put(key, list); } } } diff --git a/plugin/src/main/java/net/momirealms/customfishing/version/VersionManagerImpl.java b/plugin/src/main/java/net/momirealms/customfishing/version/VersionManagerImpl.java index 6b45de8f..0120864c 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/version/VersionManagerImpl.java +++ b/plugin/src/main/java/net/momirealms/customfishing/version/VersionManagerImpl.java @@ -20,6 +20,7 @@ package net.momirealms.customfishing.version; import net.momirealms.customfishing.CustomFishingPluginImpl; import net.momirealms.customfishing.api.manager.VersionManager; import net.momirealms.customfishing.api.util.LogUtils; +import org.bukkit.Bukkit; import java.io.BufferedReader; import java.io.InputStream; @@ -49,27 +50,22 @@ public class VersionManagerImpl implements VersionManager { this.plugin = plugin; // Get the server version - serverVersion = plugin.getServer().getClass().getPackage().getName().split("\\.")[3]; - String[] split = serverVersion.split("_"); - int main_ver = Integer.parseInt(split[1]); - + serverVersion = Bukkit.getServer().getBukkitVersion().split("-")[0]; + String[] split = serverVersion.split("\\."); + int main_ver = Integer.parseInt(split[0]); + // Determine if the server version is newer than 1_19_R2 and 1_20_R1 if (main_ver >= 20) { - isNewerThan1_19_R2 = true; - isNewerThan1_19_R3 = true; + isNewerThan1_19_R2 = isNewerThan1_19_R3 = true; isNewerThan1_20 = true; isNewerThan1_19 = true; } else if (main_ver == 19) { - isNewerThan1_19_R2 = Integer.parseInt(split[2].substring(1)) >= 2; - isNewerThan1_19_R3 = Integer.parseInt(split[2].substring(1)) >= 3; isNewerThan1_20 = false; + isNewerThan1_19_R2 = Integer.parseInt(split[1]) >= 2; + isNewerThan1_19_R3 = Integer.parseInt(split[1]) >= 3; isNewerThan1_19 = true; } else { - isNewerThan1_19_R2 = false; - isNewerThan1_19_R3 = false; - isNewerThan1_20 = false; - isNewerThan1_19 = false; + isNewerThan1_20 = isNewerThan1_19 = isNewerThan1_19_R2 = isNewerThan1_19_R3 = false; } - // Check if the server is Spigot String server_name = plugin.getServer().getName(); this.isSpigot = server_name.equals("CraftBukkit");