From 735eb68f9c4a76ea6ffc4dbae3a72d73734b684b Mon Sep 17 00:00:00 2001 From: XiaoMoMi <972454774@qq.com> Date: Fri, 14 Jul 2023 21:15:15 +0800 Subject: [PATCH] 3.3.1.1 --- build.gradle.kts | 2 +- .../customplugin/PlatformManager.java | 52 +++++++++++++------ 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 4cc9c19..0fe4039 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { allprojects { project.group = "net.momirealms" - project.version = "3.3.1.0" + project.version = "3.3.1.1-hotfix2" apply() apply(plugin = "java") diff --git a/plugin/src/main/java/net/momirealms/customcrops/customplugin/PlatformManager.java b/plugin/src/main/java/net/momirealms/customcrops/customplugin/PlatformManager.java index 8a63f26..623eac6 100644 --- a/plugin/src/main/java/net/momirealms/customcrops/customplugin/PlatformManager.java +++ b/plugin/src/main/java/net/momirealms/customcrops/customplugin/PlatformManager.java @@ -223,28 +223,24 @@ public class PlatformManager extends Function { ItemStack item_in_hand = player.getInventory().getItemInMainHand(); String item_in_hand_id = plugin.getPlatformInterface().getItemStackID(item_in_hand); - if (ProtectionLib.canBreak(player, location)) { - if (onInteractCrop(player, id, location, item_in_hand, item_in_hand_id, event)) { - return; - } + if (onInteractCrop(player, id, location, item_in_hand, item_in_hand_id, event)) { + return; } - if (ProtectionLib.canPlace(player, location)) { - if (onInteractWithSprinkler(player, location, item_in_hand, item_in_hand_id, blockFace)) { - return; - } + if (onInteractWithSprinkler(player, location, item_in_hand, item_in_hand_id, blockFace)) { + return; + } - if (onInteractSprinkler(player, id, location, item_in_hand, item_in_hand_id, event)) { - return; - } + if (onInteractSprinkler(player, id, location, item_in_hand, item_in_hand_id, event)) { + return; + } - if (onInteractPot(player, id, location, item_in_hand, item_in_hand_id, event)) { - return; - } + if (onInteractPot(player, id, location, item_in_hand, item_in_hand_id, event)) { + return; + } - if (onInteractWithWateringCan(player, item_in_hand_id, item_in_hand, id, location)) { - return; - } + if (onInteractWithWateringCan(player, item_in_hand_id, item_in_hand, id, location)) { + return; } } @@ -404,6 +400,10 @@ public class PlatformManager extends Function { return false; } + if (!ProtectionLib.canPlace(player, location)) { + return true; + } + SprinklerInteractEvent sprinklerInteractEvent = new SprinklerInteractEvent(player, item_in_hand, location, sprinklerConfig.getKey()); Bukkit.getPluginManager().callEvent(sprinklerInteractEvent); if (sprinklerInteractEvent.isCancelled()) { @@ -515,6 +515,10 @@ public class PlatformManager extends Function { return true; } + if (!ProtectionLib.canPlace(player, location)) { + return true; + } + Location sprinkler_loc = location.clone().add(0,1,0); if (plugin.getPlatformInterface().detectAnyThing(sprinkler_loc)) return true; @@ -543,6 +547,10 @@ public class PlatformManager extends Function { return true; } + if (!ProtectionLib.canBreak(player, location)) { + return true; + } + CropInteractEvent cropInteractEvent = new CropInteractEvent(player, item_in_hand, location, id, cropConfig.getKey()); Bukkit.getPluginManager().callEvent(cropInteractEvent); if (cropInteractEvent.isCancelled()) { @@ -694,6 +702,10 @@ public class PlatformManager extends Function { return false; } + if (!ProtectionLib.canPlace(player, location)) { + return true; + } + PotInteractEvent potInteractEvent = new PotInteractEvent(player, item_in_hand, location, pot_id); Bukkit.getPluginManager().callEvent(potInteractEvent); if (potInteractEvent.isCancelled()) { @@ -1071,6 +1083,12 @@ public class PlatformManager extends Function { return false; } + if (location != null) { + if (!ProtectionLib.canPlace(player, location)) { + return true; + } + } + int current = plugin.getWateringCanManager().getCurrentWater(item_in_hand); if (current >= wateringCanConfig.getStorage()) return true;