From 53c8cee1e97ad5b3292dee8b104ce430b58c5ac3 Mon Sep 17 00:00:00 2001 From: Brianna Date: Thu, 17 Sep 2020 19:24:02 -0500 Subject: [PATCH] Items now work with the remove all command. --- .../songoda/ultimatestacker/commands/CommandRemoveAll.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/songoda/ultimatestacker/commands/CommandRemoveAll.java b/src/main/java/com/songoda/ultimatestacker/commands/CommandRemoveAll.java index 59c1bae..1edd082 100644 --- a/src/main/java/com/songoda/ultimatestacker/commands/CommandRemoveAll.java +++ b/src/main/java/com/songoda/ultimatestacker/commands/CommandRemoveAll.java @@ -10,6 +10,7 @@ import org.bukkit.World; import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -43,13 +44,13 @@ public class CommandRemoveAll extends AbstractCommand { EntityStackManager stackManager = plugin.getEntityStackManager(); for (World world : Bukkit.getWorlds()) { for (Entity entityO : world.getEntities()) { - if (entityO instanceof Player || !(entityO instanceof LivingEntity)) continue; + if (entityO instanceof Player) continue; - if (entityO.getType() != EntityType.DROPPED_ITEM && (stackManager.isStackedAndLoaded((LivingEntity)entityO) || all) && type.equalsIgnoreCase("entities")) { + if (entityO instanceof LivingEntity && (stackManager.isStackedAndLoaded((LivingEntity)entityO) || all) && type.equalsIgnoreCase("entities")) { entityO.remove(); amountRemoved++; } else if (entityO.getType() == EntityType.DROPPED_ITEM && type.equalsIgnoreCase("items")) { - if (entityO.isCustomNameVisible() && !entityO.getCustomName().contains(TextUtils.convertToInvisibleString("IS")) || all) + if (!UltimateStacker.hasCustomAmount((Item)entityO) && !all) continue; entityO.remove(); amountRemoved++;