9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-25 09:59:20 +00:00
This commit is contained in:
XiaoMoMi
2023-07-14 21:15:15 +08:00
parent 454337d39f
commit 735eb68f9c
2 changed files with 36 additions and 18 deletions

View File

@@ -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;