From 9f1ec0a8ff60174c2e88a16647b87e552ecd38a4 Mon Sep 17 00:00:00 2001 From: jascotty2 Date: Tue, 10 Sep 2019 16:50:41 -0500 Subject: [PATCH] fix remnant holograms --- .../java/com/songoda/ultimatestacker/UltimateStacker.java | 4 ++++ .../com/songoda/ultimatestacker/listeners/BlockListeners.java | 3 +++ .../songoda/ultimatestacker/listeners/EntityListeners.java | 3 +-- .../songoda/ultimatestacker/spawner/SpawnerStackManager.java | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java b/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java index b8677d9..446e434 100644 --- a/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java +++ b/src/main/java/com/songoda/ultimatestacker/UltimateStacker.java @@ -347,6 +347,10 @@ public class UltimateStacker extends SongodaPlugin { HologramManager.updateHologram(stack.getLocation(), name); } + public void removeHologram(Block block) { + HologramManager.removeHologram(block.getLocation()); + } + public void updateHologram(Block block) { // verify that this is a spawner if (block.getType() != CompatibleMaterial.SPAWNER.getMaterial()) return; diff --git a/src/main/java/com/songoda/ultimatestacker/listeners/BlockListeners.java b/src/main/java/com/songoda/ultimatestacker/listeners/BlockListeners.java index 5ba20bd..6eaa4e1 100644 --- a/src/main/java/com/songoda/ultimatestacker/listeners/BlockListeners.java +++ b/src/main/java/com/songoda/ultimatestacker/listeners/BlockListeners.java @@ -7,6 +7,7 @@ import com.songoda.ultimatestacker.events.SpawnerPlaceEvent; import com.songoda.ultimatestacker.settings.Settings; import com.songoda.ultimatestacker.spawner.SpawnerStack; import com.songoda.ultimatestacker.utils.Methods; +import java.util.ArrayList; import org.apache.commons.lang.math.NumberUtils; import org.bukkit.Bukkit; import org.bukkit.block.Block; @@ -25,6 +26,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.BlockStateMeta; import java.util.List; +import org.bukkit.event.block.BlockExplodeEvent; +import org.bukkit.event.entity.EntityExplodeEvent; public class BlockListeners implements Listener { diff --git a/src/main/java/com/songoda/ultimatestacker/listeners/EntityListeners.java b/src/main/java/com/songoda/ultimatestacker/listeners/EntityListeners.java index bac9176..affb414 100644 --- a/src/main/java/com/songoda/ultimatestacker/listeners/EntityListeners.java +++ b/src/main/java/com/songoda/ultimatestacker/listeners/EntityListeners.java @@ -108,7 +108,7 @@ public class EntityListeners implements Listener { SpawnerStack spawnerStack = plugin.getSpawnerStackManager().removeSpawner(spawnLocation); plugin.getDataManager().deleteSpawner(spawnerStack); - plugin.updateHologram(spawner); + plugin.removeHologram(block); } } @@ -120,7 +120,6 @@ public class EntityListeners implements Listener { ee.remove(); } } - } for (Block block : toCancel) { diff --git a/src/main/java/com/songoda/ultimatestacker/spawner/SpawnerStackManager.java b/src/main/java/com/songoda/ultimatestacker/spawner/SpawnerStackManager.java index 954d6ac..53f7314 100644 --- a/src/main/java/com/songoda/ultimatestacker/spawner/SpawnerStackManager.java +++ b/src/main/java/com/songoda/ultimatestacker/spawner/SpawnerStackManager.java @@ -11,7 +11,7 @@ import java.util.Map; public class SpawnerStackManager { - private final Map registeredSpawners = new HashMap<>(); + private final Map registeredSpawners = new HashMap<>(); public void addSpawners(Map spawners) { this.registeredSpawners.putAll(spawners);