diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 269bbed25..15678e380 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -18,7 +18,6 @@ import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.FixedMetadataValue; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.config.AdvancedConfig; @@ -62,13 +61,14 @@ public class BlockListener implements Listener { */ @EventHandler(priority = EventPriority.MONITOR) public void onBlockPistonExtend(BlockPistonExtendEvent event) { + List blocks = event.getBlocks(); BlockFace direction = event.getDirection(); Block futureEmptyBlock = event.getBlock().getRelative(direction); // Block that would be air after piston is finished for (Block b : blocks) { if (mcMMO.placeStore.isTrue(b)) { - b.getRelative(direction).setMetadata("pistonTrack", new FixedMetadataValue(plugin, true)); + b.getRelative(direction).setMetadata(mcMMO.blockMetadataKey, mcMMO.blockMetadata); if (b.equals(futureEmptyBlock)) { mcMMO.placeStore.setFalse(b); } @@ -76,9 +76,9 @@ public class BlockListener implements Listener { } for (Block b : blocks) { - if (b.getRelative(direction).hasMetadata("pistonTrack")) { + if (b.getRelative(direction).hasMetadata(mcMMO.blockMetadataKey)) { mcMMO.placeStore.setTrue(b.getRelative(direction)); - b.getRelative(direction).removeMetadata("pistonTrack", plugin); + b.getRelative(direction).removeMetadata(mcMMO.blockMetadataKey, plugin); } } } diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index d3da6d84e..b1c2d925a 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -301,10 +301,7 @@ public class EntityListener implements Listener { */ @EventHandler (priority = EventPriority.MONITOR, ignoreCancelled = true) public void onCreatureSpawn(CreatureSpawnEvent event) { - if (Misc.isSpawnerXPEnabled) { - return; - } - else if (event.getEntity() == null) { + if (Misc.isSpawnerXPEnabled || event.getEntity() == null) { return; } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 47236aa1e..095f184ef 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -94,6 +94,10 @@ public class mcMMO extends JavaPlugin { public static FixedMetadataValue entityMetadata; public final static String entityMetadataKey = "mcMMO: Spawned Entity"; + // Block Metadata Values + public static FixedMetadataValue blockMetadata; + public final static String blockMetadataKey = "mcMMO: Piston Tracking"; + /** * Things to be run when the plugin is enabled. */ @@ -102,7 +106,9 @@ public class mcMMO extends JavaPlugin { try { p = this; getLogger().setFilter(new LogFilter(this)); - entityMetadata = new FixedMetadataValue(mcMMO.p, true); + entityMetadata = new FixedMetadataValue(this, true); + blockMetadata = new FixedMetadataValue(this, true); + setupFilePaths(); setupSpout(); loadConfigFiles();