9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-25 09:59:20 +00:00

prevent stage drops

This commit is contained in:
XiaoMoMi
2024-03-15 20:05:36 +08:00
parent 6b492aeacb
commit 559a46da65
2 changed files with 8 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ package net.momirealms.customcrops.mechanic.item.custom;
import net.momirealms.customcrops.api.CustomCropsPlugin;
import net.momirealms.customcrops.api.manager.ConfigManager;
import net.momirealms.customcrops.api.manager.WorldManager;
import net.momirealms.customcrops.api.mechanic.item.Crop;
import net.momirealms.customcrops.api.mechanic.item.Pot;
import net.momirealms.customcrops.api.mechanic.item.Sprinkler;
import net.momirealms.customcrops.api.mechanic.item.WateringCan;
@@ -107,6 +108,12 @@ public abstract class AbstractCustomListener implements Listener {
Item item = event.getEntity();
ItemStack itemStack = item.getItemStack();
String itemID = this.itemManager.getItemID(itemStack);
Crop.Stage stage = this.itemManager.getCropStageByStageID(itemID);
if (stage != null) {
event.setCancelled(true);
return;
}
Sprinkler sprinkler = this.itemManager.getSprinklerBy3DItemID(itemID);
if (sprinkler != null) {
ItemStack newItem = this.itemManager.getItemStack(null, sprinkler.get2DItemID());