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 161dcc64..5732a947 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 @@ -709,7 +709,7 @@ public class ItemManagerImpl implements ItemManager, Listener { if (bonus != 0) { placeholders.put("{bonus}", String.format("%.2f", bonus)); } - float size = Float.parseFloat(placeholders.getOrDefault("{size}", "0").replace(",", ".")); + float size = Float.parseFloat(placeholders.getOrDefault("{SIZE}", "0")); double price = CustomFishingPlugin.get().getMarketManager().getFishPrice( base, bonus, @@ -717,6 +717,7 @@ public class ItemManagerImpl implements ItemManager, Listener { ); nbtItem.setDouble("Price", price); placeholders.put("{price}", String.format("%.2f", price)); + placeholders.put("{PRICE}", String.valueOf(price)); }); return this; } @@ -731,8 +732,16 @@ public class ItemManagerImpl implements ItemManager, Listener { double fixed = Double.parseDouble(placeholders.getOrDefault("{size-fixed}", "0.0")); random *= bonus; random += fixed; + if (CFConfig.restrictedSizeRange) { + if (random > size.right()) { + random = size.right(); + } else if (random < size.left()) { + random = size.left(); + } + } cfCompound.setFloat("size", random); placeholders.put("{size}", String.format("%.2f", random)); + placeholders.put("{SIZE}", String.valueOf(random)); }); return this; } diff --git a/plugin/src/main/java/net/momirealms/customfishing/setting/CFConfig.java b/plugin/src/main/java/net/momirealms/customfishing/setting/CFConfig.java index 90b65806..f883badb 100644 --- a/plugin/src/main/java/net/momirealms/customfishing/setting/CFConfig.java +++ b/plugin/src/main/java/net/momirealms/customfishing/setting/CFConfig.java @@ -40,7 +40,7 @@ import java.util.Objects; public class CFConfig { // config version - public static String configVersion = "30"; + public static String configVersion = "31"; // Debug mode public static boolean debug; // language @@ -88,6 +88,10 @@ public class CFConfig { // Lock data on join public static boolean lockData; + public static boolean restrictedSizeRange; + public static boolean allowSizeStack; + public static List sizeStackLore; + // Legacy color code support public static boolean legacyColorSupport; // Durability lore @@ -151,6 +155,10 @@ public class CFConfig { lavaMinTime = config.getInt("mechanics.lava-fishing.min-wait-time", 100); lavaMaxTime = config.getInt("mechanics.lava-fishing.max-wait-time", 600); + restrictedSizeRange = config.getBoolean("mechanics.size.restricted-size-range", true); + allowSizeStack = config.getBoolean("mechanics.size.allow-stack", false); + sizeStackLore = config.getStringList("mechanics.size.lore-format").stream().map(it -> "" + it).toList(); + globalShowInFinder = config.getBoolean("mechanics.global-loot-property.show-in-fishfinder", true); globalDisableStats = config.getBoolean("mechanics.global-loot-property.disable-stat", false); globalDisableGame = config.getBoolean("mechanics.global-loot-property.disable-game", false); diff --git a/plugin/src/main/resources/config.yml b/plugin/src/main/resources/config.yml index 464ef7ca..17a53a84 100644 --- a/plugin/src/main/resources/config.yml +++ b/plugin/src/main/resources/config.yml @@ -1,6 +1,6 @@ # Developer: @Xiao-MoMi # Wiki: https://mo-mi.gitbook.io/xiaomomi-plugins/ -config-version: '30' +config-version: '31' # Debug debug: false @@ -147,6 +147,24 @@ mechanics: min-wait-time: 100 max-wait-time: 600 + # Size settings + size: + # Some effects would increase/decrease size so the option decides whether they could ignore the limit + restricted-size-range: true + + ###### WARNING: THIS IS NOT AN IMPLEMENTED FEATURE AND MIGHT BE REMOVED IN THE FUTURE ###### + # It's only available for developers to test for the moment. + # This feature requires much work on preventing dupe, counting price, merging dropped items, + # clicks in inventory, hopper transferring and lore updating... + # It might be removed if dupes or has bad performance. + ## Allow players to stack fish with different sizes + #allow-stack: false + ## Lore format + #lore-format: + # - '' + # - 'Total Size: {0}cm' + ############################################################################################# + # Competition settings competition: # Use redis for cross server data synchronization diff --git a/plugin/src/main/resources/market.yml b/plugin/src/main/resources/market.yml index d420be6b..b4fbb5d2 100644 --- a/plugin/src/main/resources/market.yml +++ b/plugin/src/main/resources/market.yml @@ -1,8 +1,8 @@ +enable: true + # Container title title: 'Fish Market' -enable: true - limitation: enable: true # Support expression and placeholders