Fixed spawner type on place for non ops.

This commit is contained in:
Brianna O'Keefe 2019-01-15 01:53:01 -05:00
parent 8b27dc8a80
commit 33b8c3a5c9

View File

@ -87,11 +87,18 @@ public class BlockListeners implements Listener {
Block block = event.getBlock(); Block block = event.getBlock();
if (!event.isCancelled()) { if (!event.isCancelled()) {
if (block == null || block.getType() != Material.MOB_SPAWNER) return; if (block == null
|| block.getType() != Material.MOB_SPAWNER
if (!instance.spawnersEnabled()) return; || !instance.spawnersEnabled())
return;
SpawnerStack stack = instance.getSpawnerStackManager().addSpawner(new SpawnerStack(block.getLocation(), getSpawnerAmount(event.getItemInHand()))); SpawnerStack stack = instance.getSpawnerStackManager().addSpawner(new SpawnerStack(block.getLocation(), getSpawnerAmount(event.getItemInHand())));
CreatureSpawner cs = (CreatureSpawner) block.getState();
CreatureSpawner cs2 = (CreatureSpawner) ((BlockStateMeta) event.getItemInHand().getItemMeta()).getBlockState();
cs.setSpawnedType(cs2.getSpawnedType());
cs.update();
instance.getHologramHandler().updateHologram(stack); instance.getHologramHandler().updateHologram(stack);
} }