Items now work with the remove all command.

This commit is contained in:
Brianna 2020-09-17 19:24:02 -05:00
parent fae3383ab1
commit 53c8cee1e9
1 changed files with 4 additions and 3 deletions

View File

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