diff --git a/api/src/main/java/net/momirealms/customfishing/api/mechanic/config/GUIItemParser.java b/api/src/main/java/net/momirealms/customfishing/api/mechanic/config/SingleItemParser.java similarity index 95% rename from api/src/main/java/net/momirealms/customfishing/api/mechanic/config/GUIItemParser.java rename to api/src/main/java/net/momirealms/customfishing/api/mechanic/config/SingleItemParser.java index 196c3058..20a4583d 100644 --- a/api/src/main/java/net/momirealms/customfishing/api/mechanic/config/GUIItemParser.java +++ b/api/src/main/java/net/momirealms/customfishing/api/mechanic/config/SingleItemParser.java @@ -33,13 +33,13 @@ import java.util.List; import java.util.Map; import java.util.function.BiConsumer; -public class GUIItemParser { +public class SingleItemParser { private final String id; private final String material; private final List, Context>>> tagConsumers = new ArrayList<>(); - public GUIItemParser(String id, Section section, Map> functionMap) { + public SingleItemParser(String id, Section section, Map> functionMap) { this.id = id; this.material = section.getString("material"); analyze(section, functionMap); diff --git a/api/src/main/java/net/momirealms/customfishing/api/mechanic/fishing/FishingGears.java b/api/src/main/java/net/momirealms/customfishing/api/mechanic/fishing/FishingGears.java index f1605314..70ed0de9 100644 --- a/api/src/main/java/net/momirealms/customfishing/api/mechanic/fishing/FishingGears.java +++ b/api/src/main/java/net/momirealms/customfishing/api/mechanic/fishing/FishingGears.java @@ -291,7 +291,7 @@ public class FishingGears { ((context, itemStack) -> {}), ((context, itemStack) -> { if (context.getHolder().getGameMode() != GameMode.CREATIVE) { - Item wrapped = BukkitCustomFishingPlugin.getInstance().getItemManager().wrap(itemStack.clone()); + Item wrapped = BukkitCustomFishingPlugin.getInstance().getItemManager().wrap(itemStack); String hookID = (String) wrapped.getTag("CustomFishing", "hook_id").orElseThrow(() -> new RuntimeException("This error should never occur")); wrapped.getTag("CustomFishing", "hook_max_damage").ifPresent(max -> { int maxDamage = (int) max; @@ -328,13 +328,13 @@ public class FishingGears { newLore.addAll(durabilityLore); wrapped.lore(newLore); } - itemStack.setItemMeta(wrapped.load().getItemMeta()); + wrapped.load(); }); } }), ((context, itemStack) -> { if (context.getHolder().getGameMode() != GameMode.CREATIVE) { - Item wrapped = BukkitCustomFishingPlugin.getInstance().getItemManager().wrap(itemStack.clone()); + Item wrapped = BukkitCustomFishingPlugin.getInstance().getItemManager().wrap(itemStack); String hookID = (String) wrapped.getTag("CustomFishing", "hook_id").orElseThrow(() -> new RuntimeException("This error should never occur")); wrapped.getTag("CustomFishing", "hook_max_damage").ifPresent(max -> { int maxDamage = (int) max; @@ -371,7 +371,7 @@ public class FishingGears { newLore.addAll(durabilityLore); wrapped.lore(newLore); } - itemStack.setItemMeta(wrapped.load().getItemMeta()); + wrapped.load(); }); } }), diff --git a/core/src/main/java/net/momirealms/customfishing/bukkit/market/BukkitMarketManager.java b/core/src/main/java/net/momirealms/customfishing/bukkit/market/BukkitMarketManager.java index 0cfa2347..47d89245 100644 --- a/core/src/main/java/net/momirealms/customfishing/bukkit/market/BukkitMarketManager.java +++ b/core/src/main/java/net/momirealms/customfishing/bukkit/market/BukkitMarketManager.java @@ -21,7 +21,7 @@ import dev.dejvokep.boostedyaml.block.implementation.Section; import net.momirealms.customfishing.api.BukkitCustomFishingPlugin; import net.momirealms.customfishing.api.mechanic.action.Action; import net.momirealms.customfishing.api.mechanic.action.ActionManager; -import net.momirealms.customfishing.api.mechanic.config.GUIItemParser; +import net.momirealms.customfishing.api.mechanic.config.SingleItemParser; import net.momirealms.customfishing.api.mechanic.context.Context; import net.momirealms.customfishing.api.mechanic.context.ContextKeys; import net.momirealms.customfishing.api.mechanic.item.CustomFishingItem; @@ -146,9 +146,9 @@ public class BukkitMarketManager implements MarketManager, Listener { this.sellAllSlot = sellAllSection.getString("symbol", "S").charAt(0); this.sellFishingBag = sellAllSection.getBoolean("fishingbag", true); - this.sellAllIconAllowItem = new GUIItemParser("allow", sellAllSection.getSection("allow-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); - this.sellAllIconDenyItem = new GUIItemParser("deny", sellAllSection.getSection("deny-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); - this.sellAllIconLimitItem = new GUIItemParser("limit", sellAllSection.getSection("limit-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); + this.sellAllIconAllowItem = new SingleItemParser("allow", sellAllSection.getSection("allow-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); + this.sellAllIconDenyItem = new SingleItemParser("deny", sellAllSection.getSection("deny-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); + this.sellAllIconLimitItem = new SingleItemParser("limit", sellAllSection.getSection("limit-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); this.sellAllAllowActions = plugin.getActionManager().parseActions(sellAllSection.getSection("allow-icon.action")); this.sellAllDenyActions = plugin.getActionManager().parseActions(sellAllSection.getSection("deny-icon.action")); @@ -163,9 +163,9 @@ public class BukkitMarketManager implements MarketManager, Listener { if (sellSection != null) { this.sellSlot = sellSection.getString("symbol", "B").charAt(0); - this.sellIconAllowItem = new GUIItemParser("allow", sellSection.getSection("allow-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); - this.sellIconDenyItem = new GUIItemParser("deny", sellSection.getSection("deny-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); - this.sellIconLimitItem = new GUIItemParser("limit", sellSection.getSection("limit-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); + this.sellIconAllowItem = new SingleItemParser("allow", sellSection.getSection("allow-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); + this.sellIconDenyItem = new SingleItemParser("deny", sellSection.getSection("deny-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); + this.sellIconLimitItem = new SingleItemParser("limit", sellSection.getSection("limit-icon"), plugin.getConfigManager().getFormatFunctions()).getItem(); this.sellAllowActions = plugin.getActionManager().parseActions(sellSection.getSection("allow-icon.action")); this.sellDenyActions = plugin.getActionManager().parseActions(sellSection.getSection("deny-icon.action")); @@ -188,7 +188,7 @@ public class BukkitMarketManager implements MarketManager, Listener { for (Map.Entry entry : decorativeSection.getStringRouteMappedValues(false).entrySet()) { if (entry.getValue() instanceof Section innerSection) { char symbol = Objects.requireNonNull(innerSection.getString("symbol")).charAt(0); - decorativeIcons.put(symbol, new GUIItemParser("gui", innerSection, plugin.getConfigManager().getFormatFunctions()).getItem()); + decorativeIcons.put(symbol, new SingleItemParser("gui", innerSection, plugin.getConfigManager().getFormatFunctions()).getItem()); } } } diff --git a/gradle.properties b/gradle.properties index 1fd53977..01fb877e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ # Project settings # Rule: [major update].[feature update].[bug fix] -project_version=2.2.2 +project_version=2.2.3 config_version=34 project_group=net.momirealms