From 949f0de5d8d9797d5544139d5152f25f3bacb252 Mon Sep 17 00:00:00 2001 From: ceze88 Date: Wed, 29 May 2024 14:14:50 +0200 Subject: [PATCH] Fix renamed entities stacked back instantly --- .../tasks/StackingTask.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/UltimateStacker-Plugin/src/main/java/com.craftaro.ultimatestacker/tasks/StackingTask.java b/UltimateStacker-Plugin/src/main/java/com.craftaro.ultimatestacker/tasks/StackingTask.java index 3c42abe..9f93eec 100644 --- a/UltimateStacker-Plugin/src/main/java/com.craftaro.ultimatestacker/tasks/StackingTask.java +++ b/UltimateStacker-Plugin/src/main/java/com.craftaro.ultimatestacker/tasks/StackingTask.java @@ -148,6 +148,10 @@ public class StackingTask extends BukkitRunnable { if (!configurationSection.getBoolean("Mobs." + entity.getType().name() + ".Enabled")) return true; + //Check nametag or custom entity + if ((!stackManager.isStackedEntity(entity) && entity.getCustomName() != null) || plugin.getCustomEntityManager().getCustomEntity(entity) != null) + return true; + // Allow spawn if stack reasons are set and match, or if from a spawner final String spawnReason = entity.hasMetadata("US_REASON") && !entity.getMetadata("US_REASON").isEmpty() ? entity.getMetadata("US_REASON").get(0).asString() : null; @@ -186,12 +190,6 @@ public class StackingTask extends BukkitRunnable { return; } - // If this entity is named or a custom entity skip it. - if (!isStack && (baseEntity.getCustomName() != null && plugin.getCustomEntityManager().getCustomEntity(baseEntity) != null)) { - processed.add(baseEntity.getUniqueId()); - return; - } - // Get similar entities around our entity and make sure those entities are both compatible and stackable. List stackableFriends = getSimilarEntitiesAroundEntity(baseEntity, location);