diff --git a/build.gradle b/build.gradle index a409f235..a7e3b793 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group = 'net.momirealms' -version = '1.3.0.4' +version = '1.3.0.5' repositories { mavenCentral() diff --git a/src/main/java/net/momirealms/customfishing/commands/subcmd/StatisticsCommand.java b/src/main/java/net/momirealms/customfishing/commands/subcmd/StatisticsCommand.java index 31f06d28..5e8b7cf7 100644 --- a/src/main/java/net/momirealms/customfishing/commands/subcmd/StatisticsCommand.java +++ b/src/main/java/net/momirealms/customfishing/commands/subcmd/StatisticsCommand.java @@ -105,7 +105,7 @@ public class StatisticsCommand extends AbstractSubCommand { ) return true; Player player = Bukkit.getPlayer(args.get(0)); assert player != null; - if (CustomFishing.getInstance().getStatisticsManager().reset(player.getUniqueId())) AdventureUtil.sendMessage(sender, MessageManager.prefix + MessageManager.resetStatistics); + if (CustomFishing.getInstance().getStatisticsManager().reset(player.getUniqueId())) AdventureUtil.sendMessage(sender, MessageManager.prefix + MessageManager.resetStatistics.replace("{Player}", args.get(0))); else AdventureUtil.sendMessage(sender, MessageManager.prefix + "Internal Error, player's data is not loaded"); return true; } diff --git a/src/main/java/net/momirealms/customfishing/fishing/loot/Item.java b/src/main/java/net/momirealms/customfishing/fishing/loot/Item.java index cfac585e..c339008d 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/loot/Item.java +++ b/src/main/java/net/momirealms/customfishing/fishing/loot/Item.java @@ -64,7 +64,8 @@ public class Item { Objects.requireNonNull(section.getConfigurationSection("enchantments")).getKeys(false).forEach(enchant -> { LeveledEnchantment leveledEnchantment = new LeveledEnchantment( NamespacedKey.fromString(enchant), - section.getInt("enchantments." + enchant) + section.getInt("enchantments." + enchant), + 1 ); enchantmentList.add(leveledEnchantment); }); diff --git a/src/main/java/net/momirealms/customfishing/fishing/mode/FishingGame.java b/src/main/java/net/momirealms/customfishing/fishing/mode/FishingGame.java index d1804ea2..bdab3bf6 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/mode/FishingGame.java +++ b/src/main/java/net/momirealms/customfishing/fishing/mode/FishingGame.java @@ -48,7 +48,7 @@ public abstract class FishingGame extends BukkitRunnable { this.deadline = deadline; this.difficulty = difficulty; this.title = fishingBar.getRandomTitle(); - this.fishHook = fishingManager.getBobber(player); + this.fishHook = fishingManager.getHook(player); } @Override @@ -71,7 +71,7 @@ public abstract class FishingGame extends BukkitRunnable { AdventureUtil.playerMessage(player, MessageManager.prefix + MessageManager.escape); cancel(); fishingManager.removeFishingPlayer(player); - fishingManager.removeBobber(player); + fishingManager.removeHook(player); fishingManager.fail(player, null, true); } } diff --git a/src/main/java/net/momirealms/customfishing/fishing/mode/ModeThreeGame.java b/src/main/java/net/momirealms/customfishing/fishing/mode/ModeThreeGame.java index 60b34948..31b9c5fa 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/mode/ModeThreeGame.java +++ b/src/main/java/net/momirealms/customfishing/fishing/mode/ModeThreeGame.java @@ -74,20 +74,20 @@ public class ModeThreeGame extends FishingGame { if (fish_position < modeThreeBar.getSuccess_position() - modeThreeBar.getFish_icon_width() - 1) { cancel(); success = true; - FishHook fishHook = fishingManager.getBobber(player); + FishHook fishHook = fishingManager.getHook(player); if (fishHook != null) { fishingManager.proceedReelIn(fishHook.getLocation(), player, this); - fishingManager.removeBobber(player); + fishingManager.removeHook(player); } fishingManager.removeFishingPlayer(player); return; } if (fish_position + modeThreeBar.getFish_icon_width() > modeThreeBar.getBar_effective_width() || strain >= modeThreeBar.getUltimate_strain()) { cancel(); - FishHook fishHook = fishingManager.getBobber(player); + FishHook fishHook = fishingManager.getHook(player); if (fishHook != null) { fishingManager.proceedReelIn(fishHook.getLocation(), player, this); - fishingManager.removeBobber(player); + fishingManager.removeHook(player); } fishingManager.removeFishingPlayer(player); return; diff --git a/src/main/java/net/momirealms/customfishing/fishing/mode/ModeTwoGame.java b/src/main/java/net/momirealms/customfishing/fishing/mode/ModeTwoGame.java index bf9a2729..3d3404d6 100644 --- a/src/main/java/net/momirealms/customfishing/fishing/mode/ModeTwoGame.java +++ b/src/main/java/net/momirealms/customfishing/fishing/mode/ModeTwoGame.java @@ -74,10 +74,10 @@ public class ModeTwoGame extends FishingGame { if (hold_time >= time_requirement) { cancel(); success = true; - FishHook fishHook = fishingManager.getBobber(player); + FishHook fishHook = fishingManager.getHook(player); if (fishHook != null) { fishingManager.proceedReelIn(fishHook.getLocation(), player, this); - fishingManager.removeBobber(player); + fishingManager.removeHook(player); } fishingManager.removeFishingPlayer(player); return; diff --git a/src/main/java/net/momirealms/customfishing/listener/InventoryListener.java b/src/main/java/net/momirealms/customfishing/listener/InventoryListener.java index de338b75..16c2c6d8 100644 --- a/src/main/java/net/momirealms/customfishing/listener/InventoryListener.java +++ b/src/main/java/net/momirealms/customfishing/listener/InventoryListener.java @@ -17,27 +17,21 @@ package net.momirealms.customfishing.listener; -import net.momirealms.customfishing.object.Function; +import net.momirealms.customfishing.object.InventoryFunction; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryDragEvent; -import org.bukkit.event.inventory.InventoryOpenEvent; public class InventoryListener implements Listener { - private final Function function; + private final InventoryFunction function; - public InventoryListener(Function function) { + public InventoryListener(InventoryFunction function) { this.function = function; } - @EventHandler - public void onOpen(InventoryOpenEvent event){ - function.onOpenInventory(event); - } - @EventHandler public void onClick(InventoryClickEvent event) { function.onClickInventory(event); diff --git a/src/main/java/net/momirealms/customfishing/listener/PickUpListener.java b/src/main/java/net/momirealms/customfishing/listener/PickUpListener.java index 5e7f6b50..60b807d0 100644 --- a/src/main/java/net/momirealms/customfishing/listener/PickUpListener.java +++ b/src/main/java/net/momirealms/customfishing/listener/PickUpListener.java @@ -29,25 +29,25 @@ import java.util.Objects; public class PickUpListener implements Listener { @EventHandler - public void onPickUp(PlayerAttemptPickupItemEvent event){ + public void onPickUp(PlayerAttemptPickupItemEvent event) { ItemStack itemStack = event.getItem().getItemStack(); NBTItem nbtItem = new NBTItem(itemStack); - if (!nbtItem.hasTag("M_Owner")) return; - if (!Objects.equals(nbtItem.getString("M_Owner"), event.getPlayer().getName())){ + if (!nbtItem.hasTag("TempOwner")) return; + if (!Objects.equals(nbtItem.getString("TempOwner"), event.getPlayer().getName())) { event.setCancelled(true); } else { - nbtItem.removeKey("M_Owner"); + nbtItem.removeKey("TempOwner"); itemStack.setItemMeta(nbtItem.getItem().getItemMeta()); } } @EventHandler - public void onMove(InventoryPickupItemEvent event){ + public void onMove(InventoryPickupItemEvent event) { ItemStack itemStack = event.getItem().getItemStack(); NBTItem nbtItem = new NBTItem(itemStack); - if (!nbtItem.hasTag("M_Owner")) return; - nbtItem.removeKey("M_Owner"); + if (!nbtItem.hasTag("TempOwner")) return; + nbtItem.removeKey("TempOwner"); itemStack.setItemMeta(nbtItem.getItem().getItemMeta()); } } \ No newline at end of file diff --git a/src/main/java/net/momirealms/customfishing/listener/PlayerFishListener.java b/src/main/java/net/momirealms/customfishing/listener/PlayerFishListener.java index 0fdf929a..d684497c 100644 --- a/src/main/java/net/momirealms/customfishing/listener/PlayerFishListener.java +++ b/src/main/java/net/momirealms/customfishing/listener/PlayerFishListener.java @@ -24,8 +24,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerFishEvent; -public record PlayerFishListener( - FishingManager manager) implements Listener { +public record PlayerFishListener(FishingManager manager) implements Listener { @EventHandler(priority = EventPriority.MONITOR) public void onFishMONITOR(PlayerFishEvent event) { @@ -71,9 +70,7 @@ public record PlayerFishListener( case REEL_IN -> manager.onReelIn(event); case CAUGHT_ENTITY -> manager.onCaughtEntity(event); case CAUGHT_FISH -> manager.onCaughtFish(event); - case FAILED_ATTEMPT -> manager.onFailedAttempt(event); case BITE -> manager.onBite(event); - case IN_GROUND -> manager.onInGround(event); } } } diff --git a/src/main/java/net/momirealms/customfishing/listener/WindowPacketListener.java b/src/main/java/net/momirealms/customfishing/listener/WindowPacketListener.java index a8469a8a..b2bebe29 100644 --- a/src/main/java/net/momirealms/customfishing/listener/WindowPacketListener.java +++ b/src/main/java/net/momirealms/customfishing/listener/WindowPacketListener.java @@ -21,13 +21,13 @@ import com.comphenix.protocol.PacketType; import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketEvent; import net.momirealms.customfishing.CustomFishing; -import net.momirealms.customfishing.object.Function; +import net.momirealms.customfishing.object.InventoryFunction; public class WindowPacketListener extends PacketAdapter { - private final Function function; + private final InventoryFunction function; - public WindowPacketListener(Function function) { + public WindowPacketListener(InventoryFunction function) { super(CustomFishing.getInstance(), PacketType.Play.Server.OPEN_WINDOW); this.function = function; } diff --git a/src/main/java/net/momirealms/customfishing/manager/BagDataManager.java b/src/main/java/net/momirealms/customfishing/manager/BagDataManager.java index 04975877..50a3bb22 100644 --- a/src/main/java/net/momirealms/customfishing/manager/BagDataManager.java +++ b/src/main/java/net/momirealms/customfishing/manager/BagDataManager.java @@ -28,7 +28,7 @@ import net.momirealms.customfishing.CustomFishing; import net.momirealms.customfishing.listener.InventoryListener; import net.momirealms.customfishing.listener.JoinQuitListener; import net.momirealms.customfishing.listener.WindowPacketListener; -import net.momirealms.customfishing.object.DataFunction; +import net.momirealms.customfishing.object.InventoryFunction; import net.momirealms.customfishing.util.AdventureUtil; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -45,7 +45,7 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -public class BagDataManager extends DataFunction { +public class BagDataManager extends InventoryFunction { private final ConcurrentHashMap dataMap; private final HashMap tempData; @@ -84,6 +84,7 @@ public class BagDataManager extends DataFunction { CustomFishing.getProtocolManager().removePacketListener(windowPacketListener); } + @Override public void disable() { unload(); saveBagDataForOnlinePlayers(true); @@ -149,7 +150,7 @@ public class BagDataManager extends DataFunction { // If sql exception or data is locked else if (!force) { // can still try to load - if (!checkTriedTimes(player.getUniqueId())) { + if (checkTriedTimes(player.getUniqueId())) { Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> joinReadData(player, false), 20); } // tried 3 times diff --git a/src/main/java/net/momirealms/customfishing/manager/DataManager.java b/src/main/java/net/momirealms/customfishing/manager/DataManager.java index b2fa38a2..f7c89f27 100644 --- a/src/main/java/net/momirealms/customfishing/manager/DataManager.java +++ b/src/main/java/net/momirealms/customfishing/manager/DataManager.java @@ -88,6 +88,7 @@ public class DataManager extends Function { if (this.dataStorageInterface != null && dataStorageInterface.getStorageType() != st) this.dataStorageInterface.disable(); } + @Override public void disable() { if (this.dataStorageInterface != null) { this.dataStorageInterface.disable(); diff --git a/src/main/java/net/momirealms/customfishing/manager/FishingManager.java b/src/main/java/net/momirealms/customfishing/manager/FishingManager.java index 11800176..4709714a 100644 --- a/src/main/java/net/momirealms/customfishing/manager/FishingManager.java +++ b/src/main/java/net/momirealms/customfishing/manager/FishingManager.java @@ -794,10 +794,6 @@ public class FishingManager extends Function { ), 8); } - public void onFailedAttempt(PlayerFishEvent event) { - //Empty - } - public void showBar(Player player) { if (fishingPlayerMap.get(player) != null) return; Loot loot = nextLoot.get(player); @@ -807,10 +803,6 @@ public class FishingManager extends Function { } } - public void onInGround(PlayerFishEvent event) { - //Empty - } - public void onMMOItemsRodCast(PlayerFishEvent event) { final Player player = event.getPlayer(); PlayerInventory inventory = player.getInventory(); @@ -942,9 +934,9 @@ public class FishingManager extends Function { AdventureUtil.playerMessage(player, MessageManager.prefix + MessageManager.noLoot); return; } - StringBuilder stringBuilder = new StringBuilder(MessageManager.prefix + MessageManager.possibleLoots); - possibleLoots.forEach(loot -> stringBuilder.append(loot.getNick()).append(MessageManager.splitChar)); - AdventureUtil.playerMessage(player, stringBuilder.substring(0, stringBuilder.length() - MessageManager.splitChar.length())); + StringJoiner stringJoiner = new StringJoiner(MessageManager.splitChar); + possibleLoots.forEach(loot -> stringJoiner.add(loot.getNick())); + AdventureUtil.playerMessage(player, MessageManager.prefix + MessageManager.possibleLoots + stringJoiner); } private void showFishingBar(Player player, @NotNull Loot loot) { @@ -988,7 +980,7 @@ public class FishingManager extends Function { vanillaLoot.remove(player); BobberCheckTask task = hookCheckTaskMap.remove(player); if (task != null) task.stop(); - removeBobber(player); + removeHook(player); } public void removeFishingPlayer(Player player) { @@ -1041,7 +1033,7 @@ public class FishingManager extends Function { } } - public void removeBobber(Player player) { + public void removeHook(Player player) { FishHook fishHook = hooks.remove(player); if (fishHook != null) { fishHook.remove(); @@ -1049,7 +1041,7 @@ public class FishingManager extends Function { } @Nullable - public FishHook getBobber(Player player) { + public FishHook getHook(Player player) { return hooks.get(player); } diff --git a/src/main/java/net/momirealms/customfishing/manager/LootManager.java b/src/main/java/net/momirealms/customfishing/manager/LootManager.java index 8f9d6ffd..4f296694 100644 --- a/src/main/java/net/momirealms/customfishing/manager/LootManager.java +++ b/src/main/java/net/momirealms/customfishing/manager/LootManager.java @@ -225,8 +225,11 @@ public class LootManager extends Function { if (enchantSection != null) { for (Map.Entry entry : enchantSection.getValues(false).entrySet()) { if (entry.getValue() instanceof MemorySection memorySection){ - LeveledEnchantment enchantment = new LeveledEnchantment(NamespacedKey.fromString(memorySection.getString("enchant", "minecraft:sharpness")), memorySection.getInt("level")); - enchantment.setChance(memorySection.getDouble("chance")); + LeveledEnchantment enchantment = new LeveledEnchantment( + NamespacedKey.fromString(memorySection.getString("enchant", "minecraft:sharpness")), + memorySection.getInt("level"), + memorySection.getDouble("chance") + ); randomEnchants.add(enchantment); } } diff --git a/src/main/java/net/momirealms/customfishing/manager/MessageManager.java b/src/main/java/net/momirealms/customfishing/manager/MessageManager.java index 13336e0d..89c9aed7 100644 --- a/src/main/java/net/momirealms/customfishing/manager/MessageManager.java +++ b/src/main/java/net/momirealms/customfishing/manager/MessageManager.java @@ -17,10 +17,13 @@ package net.momirealms.customfishing.manager; +import net.momirealms.customfishing.CustomFishing; import net.momirealms.customfishing.util.ConfigUtil; +import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; import java.io.File; +import java.io.IOException; public class MessageManager { @@ -38,11 +41,9 @@ public class MessageManager { public static String notOnline; public static String giveItem; public static String getItem; - public static String coolDown; public static String possibleLoots; public static String splitChar; public static String noLoot; - public static String notOpenWater; public static String competitionOn; public static String notEnoughPlayers; public static String noRank; @@ -62,40 +63,50 @@ public class MessageManager { public static void load() { YamlConfiguration config = ConfigUtil.getConfig("messages" + File.separator + "messages_" + ConfigManager.lang +".yml"); - prefix = config.getString("messages.prefix", "messages.prefix is missing"); - reload = config.getString("messages.reload", "messages.reload is missing"); - nonArgs = config.getString("messages.none-args", "messages.none-args is missing"); - unavailableArgs = config.getString("messages.invalid-args", "messages.invalid-args is missing"); - escape = config.getString("messages.escape", "messages.escape is missing"); - noPerm = config.getString("messages.no-perm", "messages.no-perm is missing"); - itemNotExist = config.getString("messages.item-not-exist", "messages.item-not-exist is missing"); - playerNotExist = config.getString("messages.player-not-exist", "messages.player-not-exist is missing"); - noConsole = config.getString("messages.no-console", "messages.no-console is missing"); - wrongAmount = config.getString("messages.wrong-amount", "messages.wrong-amount is missing"); - lackArgs = config.getString("messages.lack-args", "messages.lack-args is missing"); - notOnline = config.getString("messages.not-online", "messages.not-online is missing"); - giveItem = config.getString("messages.give-item", "messages.give-item is missing"); - getItem = config.getString("messages.get-item", "messages.get-item is missing"); - coolDown = config.getString("messages.cooldown", "messages.cooldown is missing"); - possibleLoots = config.getString("messages.possible-loots", "messages.possible-loots is missing"); - splitChar = config.getString("messages.split-char", "messages.split-char is missing"); - noLoot = config.getString("messages.no-loot", "messages.no-loot is missing"); - notOpenWater = config.getString("messages.not-open-water", "messages.not-open-water is missing"); - competitionOn = config.getString("messages.competition-ongoing", "messages.competition-ongoing is missing"); - notEnoughPlayers = config.getString("messages.players-not-enough", "messages.players-not-enough is missing"); - noRank = config.getString("messages.no-rank", "messages.no-rank is missing"); - forceSuccess = config.getString("messages.force-competition-success", "messages.force-competition-success is missing"); - forceFailure = config.getString("messages.force-competition-failure", "messages.force-competition-failure is missing"); - forceEnd = config.getString("messages.force-competition-end", "messages.force-competition-end is missing"); - forceCancel = config.getString("messages.force-competition-cancel","messages.force-competition-cancel is messing"); - noPlayer = config.getString("messages.no-player", "messages.no-player is missing"); - noScore = config.getString("messages.no-score", "messages.no-score is missing"); - noRod = config.getString("messages.no-rod", "messages.no-rod is missing"); - hookOther = config.getString("messages.hook-other-entity","messages.hook-other-entity is missing"); - reachSellLimit = config.getString("messages.reach-sell-limit","messages.reach-sell-limit is missing"); - setStatistics = config.getString("messages.set-statistics","messages.set-statistics is missing"); - resetStatistics = config.getString("messages.reset-statistics","messages.reset-statistics is missing"); - negativeStatistics = config.getString("messages.negative-statistics","messages.negative-statistics is missing"); - statisticsNotExists = config.getString("messages.statistics-not-exist","messages.statistics-not-exist is missing"); + prefix = getOrSet(config, "prefix", "[CustomFishing] "); + reload = getOrSet(config, "reload", "Reloaded. Took {time}ms."); + nonArgs = getOrSet(config, "none-args", "Arguments cannot be none."); + unavailableArgs = getOrSet(config, "invalid-args", "Invalid arguments."); + escape = getOrSet(config, "escape", "It has been too long since the fish is hooked. Oh my god, it escaped."); + noPerm = getOrSet(config, "no-perm", "You don''t have permission."); + itemNotExist = getOrSet(config, "item-not-exist", "That item does not exist."); + playerNotExist = getOrSet(config, "player-not-exist", "That player does not exist."); + noConsole = getOrSet(config, "no-console", "This command cannot be executed from the console."); + wrongAmount = getOrSet(config, "wrong-amount", "You can''t set an negative amount of items."); + lackArgs = getOrSet(config, "lack-args", "Insufficient arguments."); + notOnline = getOrSet(config, "not-online", "That player is not online."); + giveItem = getOrSet(config, "give-item", "Successfully given player {Player} {Amount}x {Item}."); + getItem = getOrSet(config, "get-item", "Successfully got {Amount}x {Item}."); + possibleLoots = getOrSet(config, "possible-loots", "Possible loots here: "); + splitChar = getOrSet(config, "split-char", ", "); + noLoot = getOrSet(config, "no-loot", "There''s no fish in this place."); + competitionOn = getOrSet(config, "competition-ongoing", "There is currently a fishing competition in progress! Start fishing to join the competition for a prize."); + notEnoughPlayers = getOrSet(config, "players-not-enough", "The number of players is not enough for the fishing competition to be started as scheduled."); + noRank = getOrSet(config, "no-rank", "No Rank"); + forceSuccess = getOrSet(config, "force-competition-success", "Forced to start a fishing competition."); + forceFailure = getOrSet(config, "force-competition-failure", "The competition does not exist."); + forceEnd = getOrSet(config, "force-competition-end", "Forced to end the current competition."); + forceCancel = getOrSet(config, "force-competition-cancel", "Forced to cancel the competition"); + noPlayer = getOrSet(config, "no-player", "No player"); + noScore = getOrSet(config, "no-score", "No score"); + noRod = getOrSet(config, "no-rod", "You have to fish with a special rod to get loots."); + hookOther = getOrSet(config, "hook-other-entity", "The hook is hooked on another entity."); + reachSellLimit = getOrSet(config, "reach-sell-limit", "You have earned too much from selling fish! Come tomorrow."); + setStatistics = getOrSet(config, "set-statistics", "Successfully set {Player}''s {Loot} statistics to {Amount}."); + resetStatistics = getOrSet(config, "reset-statistics", "Successfully reset {Player}''s statistics."); + negativeStatistics = getOrSet(config, "negative-statistics", "Amount should be a value no lower than zero."); + statisticsNotExists = getOrSet(config, "statistics-not-exist", "The statistics does not exist."); + try { + config.save(new File(CustomFishing.getInstance().getDataFolder(), "messages" + File.separator + "messages_" + ConfigManager.lang +".yml")); + } catch (IOException ignore) { + } + } + + private static String getOrSet(ConfigurationSection section, String path, String defaultValue) { + path = "messages." + path; + if (!section.contains(path)) { + section.set(path, defaultValue); + } + return section.getString(path); } } diff --git a/src/main/java/net/momirealms/customfishing/manager/SellManager.java b/src/main/java/net/momirealms/customfishing/manager/SellManager.java index adfd0449..5ded8185 100644 --- a/src/main/java/net/momirealms/customfishing/manager/SellManager.java +++ b/src/main/java/net/momirealms/customfishing/manager/SellManager.java @@ -33,7 +33,7 @@ import net.momirealms.customfishing.fishing.loot.Item; import net.momirealms.customfishing.listener.InventoryListener; import net.momirealms.customfishing.listener.JoinQuitListener; import net.momirealms.customfishing.listener.WindowPacketListener; -import net.momirealms.customfishing.object.DataFunction; +import net.momirealms.customfishing.object.InventoryFunction; import net.momirealms.customfishing.util.AdventureUtil; import net.momirealms.customfishing.util.ConfigUtil; import net.momirealms.customfishing.util.ItemStackUtil; @@ -48,7 +48,6 @@ import org.bukkit.event.HandlerList; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryDragEvent; -import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; @@ -56,7 +55,7 @@ import org.bukkit.inventory.PlayerInventory; import java.util.*; import java.util.concurrent.ConcurrentHashMap; -public class SellManager extends DataFunction { +public class SellManager extends InventoryFunction { private final WindowPacketListener windowPacketListener; private final InventoryListener inventoryListener; @@ -120,6 +119,7 @@ public class SellManager extends DataFunction { HandlerList.unregisterAll(joinQuitListener); } + @Override public void disable() { unload(); plugin.getDataManager().getDataStorageInterface().saveSellData(sellDataMap.entrySet(), true); @@ -152,7 +152,7 @@ public class SellManager extends DataFunction { // If sql exception or data is locked else if (!force) { // can still try to load - if (!checkTriedTimes(player.getUniqueId())) { + if (checkTriedTimes(player.getUniqueId())) { Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> { joinReadData(player, false); }, 20); @@ -250,23 +250,14 @@ public class SellManager extends DataFunction { for (Map.Entry entry : guiItems.entrySet()) { inventory.setItem(entry.getKey(), entry.getValue()); } + for (int slot : functionIconSlots) { + inventory.setItem(slot, ItemStackUtil.getFromItem(sellIcon.cloneWithPrice(getTotalPrice(getPlayerItems(inventory))))); + } inventoryMap.put(player, inventory); player.openInventory(inventory); if (openKey != null) AdventureUtil.playerSound(player, soundSource, openKey, 1, 1); } - @Override - public void onOpenInventory(InventoryOpenEvent event) { - final Player player = (Player) event.getPlayer(); - Inventory inventory = inventoryMap.get(player); - if (inventory == null) return; - if (inventory == event.getInventory()) { - for (int slot : functionIconSlots) { - inventory.setItem(slot, ItemStackUtil.getFromItem(sellIcon.cloneWithPrice(getTotalPrice(getPlayerItems(inventory))))); - } - } - } - @Override public void onClickInventory(InventoryClickEvent event) { final Player player = (Player) event.getView().getPlayer(); diff --git a/src/main/java/net/momirealms/customfishing/manager/StatisticsManager.java b/src/main/java/net/momirealms/customfishing/manager/StatisticsManager.java index 5892a319..dcda3a10 100644 --- a/src/main/java/net/momirealms/customfishing/manager/StatisticsManager.java +++ b/src/main/java/net/momirealms/customfishing/manager/StatisticsManager.java @@ -57,6 +57,7 @@ public class StatisticsManager extends DataFunction { plugin.getDataManager().getDataStorageInterface().saveStatistics(statisticsDataMap.entrySet(), unlock); } + @Override public void disable() { unload(); saveStatisticsDataForOnlinePlayers(true); @@ -89,7 +90,7 @@ public class StatisticsManager extends DataFunction { statisticsDataMap.put(player.getUniqueId(), statisticsData); } else if (!force) { - if (!checkTriedTimes(player.getUniqueId())) { + if (checkTriedTimes(player.getUniqueId())) { Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> joinReadData(player, false), 20); } else { diff --git a/src/main/java/net/momirealms/customfishing/object/DataFunction.java b/src/main/java/net/momirealms/customfishing/object/DataFunction.java index d1ef83a5..4e76309f 100644 --- a/src/main/java/net/momirealms/customfishing/object/DataFunction.java +++ b/src/main/java/net/momirealms/customfishing/object/DataFunction.java @@ -32,15 +32,15 @@ public abstract class DataFunction extends Function { Integer previous = triedTimes.get(uuid); if (previous == null) { triedTimes.put(uuid, 1); - return false; + return true; } else if (previous > 2) { triedTimes.remove(uuid); - return true; + return false; } else { triedTimes.put(uuid, previous + 1); - return false; + return true; } } } diff --git a/src/main/java/net/momirealms/customfishing/object/Function.java b/src/main/java/net/momirealms/customfishing/object/Function.java index 8ebaea1c..f216ba31 100644 --- a/src/main/java/net/momirealms/customfishing/object/Function.java +++ b/src/main/java/net/momirealms/customfishing/object/Function.java @@ -17,13 +17,9 @@ package net.momirealms.customfishing.object; -import com.comphenix.protocol.events.PacketContainer; import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryDragEvent; -import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; @@ -37,6 +33,10 @@ public abstract class Function { //empty } + public void disable() { + //empty + } + public void onQuit(Player player) { //empty } @@ -49,25 +49,15 @@ public abstract class Function { //empty } - public void onWindowTitlePacketSend(PacketContainer packet, Player receiver) { - - } - - public void onCloseInventory(InventoryCloseEvent event) { - } - - public void onClickInventory(InventoryClickEvent event) { - } - - public void onOpenInventory(InventoryOpenEvent event) { - } - public void onBreakBlock(BlockBreakEvent event) { + //empty } public void onConsumeItem(PlayerItemConsumeEvent event) { + //empty } public void onDragInventory(InventoryDragEvent event) { + //empty } } diff --git a/src/main/java/net/momirealms/customfishing/object/InventoryFunction.java b/src/main/java/net/momirealms/customfishing/object/InventoryFunction.java new file mode 100644 index 00000000..2c34a5a0 --- /dev/null +++ b/src/main/java/net/momirealms/customfishing/object/InventoryFunction.java @@ -0,0 +1,26 @@ +package net.momirealms.customfishing.object; + +import com.comphenix.protocol.events.PacketContainer; +import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryDragEvent; + +public abstract class InventoryFunction extends DataFunction { + + public void onWindowTitlePacketSend(PacketContainer packet, Player receiver) { + //empty + } + + public void onCloseInventory(InventoryCloseEvent event) { + //empty + } + + public void onClickInventory(InventoryClickEvent event) { + //empty + } + + public void onDragInventory(InventoryDragEvent event) { + + } +} diff --git a/src/main/java/net/momirealms/customfishing/object/LeveledEnchantment.java b/src/main/java/net/momirealms/customfishing/object/LeveledEnchantment.java index 474dc42b..a2f65d8c 100644 --- a/src/main/java/net/momirealms/customfishing/object/LeveledEnchantment.java +++ b/src/main/java/net/momirealms/customfishing/object/LeveledEnchantment.java @@ -19,20 +19,6 @@ package net.momirealms.customfishing.object; import org.bukkit.NamespacedKey; -public class LeveledEnchantment { +public record LeveledEnchantment(NamespacedKey key, int level, double chance) { - private final NamespacedKey key; - private final int level; - private double chance; - - public LeveledEnchantment(NamespacedKey key, int level){ - this.key = key; - this.level = level; - } - - public void setChance(double chance) {this.chance = chance;} - - public int getLevel() {return level;} - public NamespacedKey getKey() {return key;} - public double getChance() {return chance;} } diff --git a/src/main/java/net/momirealms/customfishing/object/SimpleLocation.java b/src/main/java/net/momirealms/customfishing/object/SimpleLocation.java index 371de963..d8410362 100644 --- a/src/main/java/net/momirealms/customfishing/object/SimpleLocation.java +++ b/src/main/java/net/momirealms/customfishing/object/SimpleLocation.java @@ -19,24 +19,7 @@ package net.momirealms.customfishing.object; import java.util.Objects; -public class SimpleLocation { - - private final int x; - private final int y; - private final int z; - private final String worldName; - - public SimpleLocation(String worldName, int x, int y, int z){ - this.worldName = worldName; - this.x = x; - this.y = y; - this.z = z; - } - - public int getX() {return x;} - public int getZ() {return z;} - public int getY() {return y;} - public String getWorldName() {return worldName;} +public record SimpleLocation(String worldName, int x, int y, int z) { @Override public boolean equals(Object obj) { @@ -47,7 +30,7 @@ public class SimpleLocation { return false; } final SimpleLocation other = (SimpleLocation) obj; - if (!Objects.equals(worldName, other.getWorldName())) { + if (!Objects.equals(worldName, other.worldName())) { return false; } if (Double.doubleToLongBits(this.x) != Double.doubleToLongBits(other.x)) { diff --git a/src/main/java/net/momirealms/customfishing/util/ItemStackUtil.java b/src/main/java/net/momirealms/customfishing/util/ItemStackUtil.java index 280db3c5..205c6727 100644 --- a/src/main/java/net/momirealms/customfishing/util/ItemStackUtil.java +++ b/src/main/java/net/momirealms/customfishing/util/ItemStackUtil.java @@ -58,11 +58,11 @@ public class ItemStackUtil { if (item.getEnchantment() != null) { if (itemStack.getType() == Material.ENCHANTED_BOOK){ EnchantmentStorageMeta meta = (EnchantmentStorageMeta) itemMeta; - item.getEnchantment().forEach(enchantment -> meta.addStoredEnchant(Objects.requireNonNull(Enchantment.getByKey(enchantment.getKey())),enchantment.getLevel(),true)); + item.getEnchantment().forEach(enchantment -> meta.addStoredEnchant(Objects.requireNonNull(Enchantment.getByKey(enchantment.key())),enchantment.level(),true)); itemStack.setItemMeta(meta); } else { - item.getEnchantment().forEach(enchantment -> itemMeta.addEnchant(Objects.requireNonNull(Enchantment.getByKey(enchantment.getKey())),enchantment.getLevel(),true)); + item.getEnchantment().forEach(enchantment -> itemMeta.addEnchant(Objects.requireNonNull(Enchantment.getByKey(enchantment.key())),enchantment.level(),true)); itemStack.setItemMeta(itemMeta); } } @@ -138,13 +138,13 @@ public class ItemStackUtil { if (itemStack.getType() == Material.ENCHANTED_BOOK){ EnchantmentStorageMeta meta = (EnchantmentStorageMeta)itemMeta; for (LeveledEnchantment enchantment : enchantments) { - if (enchantment.getChance() > Math.random()) meta.addStoredEnchant(Objects.requireNonNull(Enchantment.getByKey(enchantment.getKey())),enchantment.getLevel(),true); + if (enchantment.chance() > Math.random()) meta.addStoredEnchant(Objects.requireNonNull(Enchantment.getByKey(enchantment.key())),enchantment.level(),true); } itemStack.setItemMeta(meta); } else { for (LeveledEnchantment enchantment : enchantments) { - if (enchantment.getChance() > Math.random()) itemMeta.addEnchant(Objects.requireNonNull(Enchantment.getByKey(enchantment.getKey())),enchantment.getLevel(),true); + if (enchantment.chance() > Math.random()) itemMeta.addEnchant(Objects.requireNonNull(Enchantment.getByKey(enchantment.key())),enchantment.level(),true); } itemStack.setItemMeta(itemMeta); } @@ -255,9 +255,9 @@ public class ItemStackUtil { return true; } - public static Map compoundToMap(NBTCompound nbtCompound){ + public static Map compoundToMap(ReadWriteNBT nbtCompound){ Map map = new HashMap<>(); - nbtCompound.getKeys().forEach(key -> { + for (String key : nbtCompound.getKeys()) { switch (nbtCompound.getType(key)){ case NBTTagByte -> map.put(key, "(Byte) " + nbtCompound.getByte(key)); case NBTTagInt -> map.put(key, "(Int) " + nbtCompound.getInteger(key)); @@ -282,45 +282,11 @@ public class ItemStackUtil { case NBTTagFloat -> nbtCompound.getFloatList(key).forEach(a -> list.add("(Float) " + a)); case NBTTagLong -> nbtCompound.getLongList(key).forEach(a -> list.add("(Long) " + a)); case NBTTagIntArray -> nbtCompound.getIntArrayList(key).forEach(a -> list.add("(IntArray) " + Arrays.toString(a))); - default -> nbtCompound.getUUIDList(key).forEach(a -> list.add("(UUID) " + a)); } - map.put(key, list); + if (list.size() != 0) map.put(key, list); } } - }); - return map; - } - - - public static Map compoundToMap(ReadWriteNBT nbtCompound){ - Map map = new HashMap<>(); - nbtCompound.getKeys().forEach(key -> { - switch (nbtCompound.getType(key)){ - case NBTTagByte -> map.put(key, "(Byte) " + nbtCompound.getByte(key)); - case NBTTagInt -> map.put(key, "(Int) " + nbtCompound.getInteger(key)); - case NBTTagDouble -> map.put(key, "(Double) " + nbtCompound.getDouble(key)); - case NBTTagLong -> map.put(key, "(Long) " + nbtCompound.getLong(key)); - case NBTTagFloat -> map.put(key, "(Float) " + nbtCompound.getFloat(key)); - case NBTTagShort -> map.put(key, "(Short) " + nbtCompound.getShort(key)); - case NBTTagString -> map.put(key, "(String) " + nbtCompound.getString(key)); - case NBTTagByteArray -> map.put(key, "(ByteArray) " + Arrays.toString(nbtCompound.getByteArray(key))); - case NBTTagIntArray -> map.put(key, "(IntArray) " + Arrays.toString(nbtCompound.getIntArray(key))); - case NBTTagList -> { - List list = new ArrayList<>(); - switch (nbtCompound.getListType(key)) { - case NBTTagCompound -> nbtCompound.getCompoundList(key).forEach(a -> list.add(compoundToMap(a))); - case NBTTagInt -> nbtCompound.getIntegerList(key).forEach(a -> list.add("(Int) " + a)); - case NBTTagDouble -> nbtCompound.getDoubleList(key).forEach(a -> list.add("(Double) " + a)); - case NBTTagString -> nbtCompound.getStringList(key).forEach(a -> list.add("(String) " + a)); - case NBTTagFloat -> nbtCompound.getFloatList(key).forEach(a -> list.add("(Float) " + a)); - case NBTTagLong -> nbtCompound.getLongList(key).forEach(a -> list.add("(Long) " + a)); - case NBTTagIntArray -> nbtCompound.getIntArrayList(key).forEach(a -> list.add("(IntArray) " + Arrays.toString(a))); - default -> nbtCompound.getUUIDList(key).forEach(a -> list.add("(UUID) " + a)); - } - map.put(key, list); - } - } - }); + } return map; } } diff --git a/src/main/java/net/momirealms/customfishing/util/LocationUtils.java b/src/main/java/net/momirealms/customfishing/util/LocationUtils.java index ee20546e..205a1957 100644 --- a/src/main/java/net/momirealms/customfishing/util/LocationUtils.java +++ b/src/main/java/net/momirealms/customfishing/util/LocationUtils.java @@ -41,9 +41,9 @@ public class LocationUtils { @Nullable public static Location getLocation(SimpleLocation location) { - World world = Bukkit.getWorld(location.getWorldName()); + World world = Bukkit.getWorld(location.worldName()); if (world == null) return null; - return new Location(world, location.getX(), location.getY(), location.getZ()); + return new Location(world, location.x(), location.y(), location.z()); } public static SimpleLocation getSimpleLocation(String location, String world) { diff --git a/src/main/java/net/momirealms/customfishing/util/NBTUtil.java b/src/main/java/net/momirealms/customfishing/util/NBTUtil.java index c5af04ee..e57290dc 100644 --- a/src/main/java/net/momirealms/customfishing/util/NBTUtil.java +++ b/src/main/java/net/momirealms/customfishing/util/NBTUtil.java @@ -30,88 +30,100 @@ import java.util.UUID; public class NBTUtil { - public static NBTItem getNBTItem(Map nbt, ItemStack itemStack){ + public static NBTItem setNBTToItemStack(Map nbt, ItemStack itemStack){ NBTItem nbtItem = new NBTItem(itemStack); setTags(nbt, nbtItem); return nbtItem; } + @SuppressWarnings("unchecked") public static void setTags(Map map, NBTCompound nbtCompound) { - for (String key : map.keySet()) { - if (map.get(key) instanceof MemorySection memorySection){ - NBTCompound newCompound = nbtCompound.addCompound(key); - setTags(memorySection.getValues(false), newCompound); - } - else if (map.get(key) instanceof List list){ + for (Map.Entry entry : map.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + if (value instanceof MemorySection memorySection) { + setTags(memorySection.getValues(false), nbtCompound.addCompound(key)); + } else if (value instanceof List list) { for (Object o : list) { - if (o instanceof String value) { - setListValue(key, value, nbtCompound); - } else if (o instanceof Map map1) { - setCompoundList(key, map1, nbtCompound); + if (o instanceof String stringValue) { + setListValue(key, stringValue, nbtCompound); + } else if (o instanceof Map mapValue) { + setCompoundList(key, (Map) mapValue, nbtCompound); } } - } - else if (map.get(key) instanceof String value) { - setSingleValue(key, value, nbtCompound); + } else if (value instanceof String stringValue) { + setSingleValue(key, stringValue, nbtCompound); } } } - private static void setCompoundList(String key, Map map, NBTCompound nbtCompound) { + private static void setCompoundList(String key, Map map, NBTCompound nbtCompound) { NBTListCompound nbtListCompound = nbtCompound.getCompoundList(key).addCompound(); - setTags((Map) map, nbtListCompound); + setTags(map, nbtListCompound); } private static void setListValue(String key, String value, NBTCompound nbtCompound) { - if (value.startsWith("(String) ")) { - nbtCompound.getStringList(key).add(value.substring(9)); - } else if (value.startsWith("(UUID) ")) { - nbtCompound.getUUIDList(key).add(UUID.fromString(value.substring(7))); - } else if (value.startsWith("(Double) ")) { - nbtCompound.getDoubleList(key).add(Double.valueOf(value.substring(9))); - } else if (value.startsWith("(Long) ")) { - nbtCompound.getLongList(key).add(Long.valueOf(value.substring(7))); - } else if (value.startsWith("(Float) ")) { - nbtCompound.getFloatList(key).add(Float.valueOf(value.substring(8))); - } else if (value.startsWith("(Int) ")) { - nbtCompound.getIntegerList(key).add(Integer.valueOf(value.substring(6))); - } else if (value.startsWith("(IntArray) ")) { - String[] split = value.substring(11).replace("[","").replace("]","").replaceAll("\\s", "").split(","); - int[] array = Arrays.stream(split).mapToInt(Integer::parseInt).toArray(); - nbtCompound.getIntArrayList(key).add(array); + String[] parts = getTypeAndData(value); + String type = parts[0]; String data = parts[1]; + switch (type) { + case "String" -> nbtCompound.getStringList(key).add(data); + case "UUID" -> nbtCompound.getUUIDList(key).add(UUID.fromString(data)); + case "Double" -> nbtCompound.getDoubleList(key).add(Double.valueOf(data)); + case "Long" -> nbtCompound.getLongList(key).add(Long.valueOf(data)); + case "Float" -> nbtCompound.getFloatList(key).add(Float.valueOf(data)); + case "Int" -> nbtCompound.getIntegerList(key).add(Integer.valueOf(data)); + case "IntArray" -> { + String[] split = data.replace("[", "").replace("]", "").replaceAll("\\s", "").split(","); + int[] array = Arrays.stream(split).mapToInt(Integer::parseInt).toArray(); + nbtCompound.getIntArrayList(key).add(array); + } + default -> throw new IllegalArgumentException("Invalid value type: " + type); } } private static void setSingleValue(String key, String value, NBTCompound nbtCompound) { - if (value.startsWith("(Int) ")){ - nbtCompound.setInteger(key, Integer.valueOf(value.substring(6))); - } else if (value.startsWith("(String) ")){ - nbtCompound.setString(key, value.substring(9)); - } else if (value.startsWith("(Long) ")){ - nbtCompound.setLong(key, Long.valueOf(value.substring(7))); - } else if (value.startsWith("(Float) ")){ - nbtCompound.setFloat(key, Float.valueOf(value.substring(8))); - } else if (value.startsWith("(Double) ")){ - nbtCompound.setDouble(key, Double.valueOf(value.substring(9))); - } else if (value.startsWith("(Short) ")){ - nbtCompound.setShort(key, Short.valueOf(value.substring(8))); - } else if (value.startsWith("(Boolean) ")){ - nbtCompound.setBoolean(key, Boolean.valueOf(value.substring(10))); - } else if (value.startsWith("(UUID) ")){ - nbtCompound.setUUID(key, UUID.fromString(value.substring(7))); - } else if (value.startsWith("(Byte) ")){ - nbtCompound.setByte(key, Byte.valueOf(value.substring(7))); - } else if (value.startsWith("(ByteArray) ")){ - String[] split = value.substring(12).replace("[","").replace("]","").replaceAll("\\s", "").split(","); - byte[] bytes = new byte[split.length]; - for (int i = 0; i < split.length; i++){ - bytes[i] = Byte.parseByte(split[i]); + String[] parts = getTypeAndData(value); + String type = parts[0]; String data = parts[1]; + switch (type) { + case "Int" -> nbtCompound.setInteger(key, Integer.valueOf(data)); + case "String" -> nbtCompound.setString(key, data); + case "Long" -> nbtCompound.setLong(key, Long.valueOf(data)); + case "Float" -> nbtCompound.setFloat(key, Float.valueOf(data)); + case "Double" -> nbtCompound.setDouble(key, Double.valueOf(data)); + case "Short" -> nbtCompound.setShort(key, Short.valueOf(data)); + case "Boolean" -> nbtCompound.setBoolean(key, Boolean.valueOf(data)); + case "UUID" -> nbtCompound.setUUID(key, UUID.nameUUIDFromBytes(data.getBytes())); + case "Byte" -> nbtCompound.setByte(key, Byte.valueOf(data)); + case "ByteArray" -> { + String[] split = splitValue(value); + byte[] bytes = new byte[split.length]; + for (int i = 0; i < split.length; i++){ + bytes[i] = Byte.parseByte(split[i]); + } + nbtCompound.setByteArray(key, bytes); } - nbtCompound.setByteArray(key, bytes); - } else if (value.startsWith("(IntArray) ")){ - String[] split = value.substring(11).replace("[","").replace("]","").replaceAll("\\s", "").split(","); - int[] array = Arrays.stream(split).mapToInt(Integer::parseInt).toArray(); - nbtCompound.setIntArray(key, array); + case "IntArray" -> { + String[] split = splitValue(value); + int[] array = Arrays.stream(split).mapToInt(Integer::parseInt).toArray(); + nbtCompound.setIntArray(key, array); + } + default -> throw new IllegalArgumentException("Invalid value type: " + type); } } -} + + private static String[] getTypeAndData(String str) { + String[] parts = str.split("\\s+", 2); + if (parts.length != 2) { + throw new IllegalArgumentException("Invalid value format: " + str); + } + String type = parts[0].substring(1, parts[0].length() - 1); + String data = parts[1]; + return new String[]{type, data}; + } + + private static String[] splitValue(String value) { + return value.substring(value.indexOf('[') + 1, value.lastIndexOf(']')) + .replaceAll("\\s", "") + .split(","); + } +} \ No newline at end of file diff --git a/src/main/resources/messages/messages_english.yml b/src/main/resources/messages/messages_english.yml index bf27be7d..e709bc61 100644 --- a/src/main/resources/messages/messages_english.yml +++ b/src/main/resources/messages/messages_english.yml @@ -2,35 +2,35 @@ #https://docs.adventure.kyori.net/minimessage/format.html messages: prefix: '[CustomFishing] ' - reload: 'Reloaded. Took {time}ms' - no-perm: 'You don''t have permission!' - not-online: 'That player is not online!' - item-not-exist: 'That item does not exist!' - player-not-exist: 'That player does not exist!' - escape: 'It has been too long since the fish is hooked. Oh my god, it escaped!' + reload: 'Reloaded. Took {time}ms.' + no-perm: 'You don''t have permission.' + not-online: 'That player is not online.' + item-not-exist: 'That item does not exist.' + player-not-exist: 'That player does not exist.' + escape: 'It has been too long since the fish is hooked. Oh my god, it escaped.' give-item: 'Successfully given player {Player} {Amount}x {Item}.' - get-item: 'Successfully obtained {Amount}x {Item}.' - no-console: 'This command cannot be executed from the console!' - wrong-amount: 'You can''t set an negative amount of items!' + get-item: 'Successfully got {Amount}x {Item}.' + no-console: 'This command cannot be executed from the console.' + wrong-amount: 'You can''t set an negative amount of items.' lack-args: 'Insufficient arguments.' - none-args: 'None arguments!' - invalid-args: 'Invalid arguments!' + none-args: 'Arguments cannot be none.' + invalid-args: 'Invalid arguments.' possible-loots: 'Possible loots here: ' - reach-sell-limit: 'You have earned too much from selling fish! Come tomorrow.' split-char: ', ' - no-loot: 'There''s no fish in this place!' - competition-ongoing: 'There is currently a fishing competition in progress! Start fishing to join the competition for a prize!' - players-not-enough: 'The number of players is not enough for the fishing competition to be started as scheduled!' - no-rank: 'No Rank' - force-competition-success: 'Forced to start a fishing competition' - force-competition-failure: 'This competition does not exist' - force-competition-end: 'Forced to end the current competition' + hook-other-entity: 'The hook is hooked on another entity.' + reach-sell-limit: 'You have earned too much from selling fish! Come tomorrow.' + no-loot: 'There''s no fish in this place.' + competition-ongoing: 'There is currently a fishing competition in progress! Start fishing to join the competition for a prize.' + players-not-enough: 'The number of players is not enough for the fishing competition to be started as scheduled.' + force-competition-success: 'Forced to start a fishing competition.' + force-competition-failure: 'The competition does not exist.' + force-competition-end: 'Forced to end the current competition.' force-competition-cancel: 'Forced to cancel the competition' - hook-other-entity: 'The hook is hooked on another entity!' - no-rod: 'You have to fish with a special rod to get loots!' + no-rod: 'You have to fish with a special rod to get loots.' + no-rank: 'No Rank' no-player: 'No player' no-score: 'No score' - set-statistics: 'Successfully set {Player}''s {Loot} statistics to {Amount}' - reset-statistics: 'Successfully reset {Player}''s statistics' - negative-statistics: 'Amount should be a value no lower than zero' - statistics-not-exist: 'The statistics does not exist' \ No newline at end of file + set-statistics: 'Successfully set {Player}''s {Loot} statistics to {Amount}.' + reset-statistics: 'Successfully reset {Player}''s statistics.' + negative-statistics: 'Amount should be a value no lower than zero.' + statistics-not-exist: 'The statistics does not exist.' \ No newline at end of file