|
|
|
@ -36,7 +36,6 @@ public final class SaplingsReplant extends JavaPlugin implements Listener { |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
trackedSaplings.add(item); |
|
|
|
|
logger.info("Spawn: Added Sapling to Tracking-list: " + item.getName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@EventHandler |
|
|
|
@ -48,35 +47,25 @@ public final class SaplingsReplant extends JavaPlugin implements Listener { |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
trackedSaplings.add(item); |
|
|
|
|
logger.info("Drop: Added Sapling to Tracking-list: " + item.getName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@EventHandler |
|
|
|
|
public void onItemDespawn(ItemDespawnEvent event) { |
|
|
|
|
Item item = event.getEntity(); |
|
|
|
|
|
|
|
|
|
boolean removed = trackedSaplings.remove(item); |
|
|
|
|
if (removed){ |
|
|
|
|
logger.info("Despawn: Removed Sapling from Tracking-list: " + item.getName()); |
|
|
|
|
} |
|
|
|
|
trackedSaplings.remove(item); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@EventHandler |
|
|
|
|
public void onItemMerge(ItemMergeEvent event) { |
|
|
|
|
Item item = event.getEntity(); |
|
|
|
|
|
|
|
|
|
boolean removed = trackedSaplings.remove(item); |
|
|
|
|
if (removed){ |
|
|
|
|
logger.info("Merge: Removed Sapling from Tracking-list: " + item.getName()); |
|
|
|
|
} |
|
|
|
|
trackedSaplings.remove(item); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@EventHandler |
|
|
|
|
public void onEntityPickupItem(EntityPickupItemEvent event) { |
|
|
|
|
boolean removed = trackedSaplings.remove(event.getItem()); |
|
|
|
|
if (removed){ |
|
|
|
|
logger.info("Pickup: Removed Sapling from Tracking-list: " + event.getItem().getName()); |
|
|
|
|
} |
|
|
|
|
trackedSaplings.remove(event.getItem()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void handleSaplings() { |
|
|
|
@ -102,10 +91,8 @@ public final class SaplingsReplant extends JavaPlugin implements Listener { |
|
|
|
|
|
|
|
|
|
currentBlock.setType(sapling.getItemStack().getType()); |
|
|
|
|
sapling.getItemStack().setAmount(sapling.getItemStack().getAmount() - 1); |
|
|
|
|
logger.info("Planted: Reduced Sapling Stack amount"); |
|
|
|
|
|
|
|
|
|
if (sapling.getItemStack().getAmount() == 0){ |
|
|
|
|
logger.info("Planted: Removed Sapling from Tracking-list"); |
|
|
|
|
toRemove.add(sapling); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|