fix remnant holograms

This commit is contained in:
jascotty2 2019-09-10 16:50:41 -05:00
parent e17b95881a
commit 9f1ec0a8ff
4 changed files with 9 additions and 3 deletions

View File

@ -347,6 +347,10 @@ public class UltimateStacker extends SongodaPlugin {
HologramManager.updateHologram(stack.getLocation(), name); HologramManager.updateHologram(stack.getLocation(), name);
} }
public void removeHologram(Block block) {
HologramManager.removeHologram(block.getLocation());
}
public void updateHologram(Block block) { public void updateHologram(Block block) {
// verify that this is a spawner // verify that this is a spawner
if (block.getType() != CompatibleMaterial.SPAWNER.getMaterial()) return; if (block.getType() != CompatibleMaterial.SPAWNER.getMaterial()) return;

View File

@ -7,6 +7,7 @@ import com.songoda.ultimatestacker.events.SpawnerPlaceEvent;
import com.songoda.ultimatestacker.settings.Settings; import com.songoda.ultimatestacker.settings.Settings;
import com.songoda.ultimatestacker.spawner.SpawnerStack; import com.songoda.ultimatestacker.spawner.SpawnerStack;
import com.songoda.ultimatestacker.utils.Methods; import com.songoda.ultimatestacker.utils.Methods;
import java.util.ArrayList;
import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.math.NumberUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -25,6 +26,8 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BlockStateMeta; import org.bukkit.inventory.meta.BlockStateMeta;
import java.util.List; import java.util.List;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
public class BlockListeners implements Listener { public class BlockListeners implements Listener {

View File

@ -108,7 +108,7 @@ public class EntityListeners implements Listener {
SpawnerStack spawnerStack = plugin.getSpawnerStackManager().removeSpawner(spawnLocation); SpawnerStack spawnerStack = plugin.getSpawnerStackManager().removeSpawner(spawnLocation);
plugin.getDataManager().deleteSpawner(spawnerStack); plugin.getDataManager().deleteSpawner(spawnerStack);
plugin.updateHologram(spawner); plugin.removeHologram(block);
} }
} }
@ -120,7 +120,6 @@ public class EntityListeners implements Listener {
ee.remove(); ee.remove();
} }
} }
} }
for (Block block : toCancel) { for (Block block : toCancel) {

View File

@ -11,7 +11,7 @@ import java.util.Map;
public class SpawnerStackManager { public class SpawnerStackManager {
private final Map<Location, SpawnerStack> registeredSpawners = new HashMap<>(); private final Map<Location, SpawnerStack> registeredSpawners = new HashMap<>();
public void addSpawners(Map<Location, SpawnerStack> spawners) { public void addSpawners(Map<Location, SpawnerStack> spawners) {
this.registeredSpawners.putAll(spawners); this.registeredSpawners.putAll(spawners);