From 38155e3af42e1453aae99c38e1008b3d6e508a8e Mon Sep 17 00:00:00 2001 From: GJ Date: Sat, 23 Feb 2013 18:13:12 -0500 Subject: [PATCH] Use the same MetadataValue for both of these --- .../com/gmail/nossr50/listeners/BlockListener.java | 2 +- .../com/gmail/nossr50/listeners/EntityListener.java | 4 ++-- src/main/java/com/gmail/nossr50/mcMMO.java | 10 +++------- .../skills/taming/CallOfTheWildEventHandler.java | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 15678e380..f4cc8ee7f 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -68,7 +68,7 @@ public class BlockListener implements Listener { for (Block b : blocks) { if (mcMMO.placeStore.isTrue(b)) { - b.getRelative(direction).setMetadata(mcMMO.blockMetadataKey, mcMMO.blockMetadata); + b.getRelative(direction).setMetadata(mcMMO.blockMetadataKey, mcMMO.metadataValue); if (b.equals(futureEmptyBlock)) { mcMMO.placeStore.setFalse(b); } diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index b1c2d925a..cd3d7a3e8 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -67,7 +67,7 @@ public class EntityListener implements Listener { if (mcMMO.placeStore.isTrue(block) && !entity.hasMetadata(mcMMO.entityMetadataKey)) { mcMMO.placeStore.setFalse(block); - entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.entityMetadata); + entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue); } else if (entity.hasMetadata(mcMMO.entityMetadataKey)) { mcMMO.placeStore.setTrue(block); @@ -308,7 +308,7 @@ public class EntityListener implements Listener { SpawnReason reason = event.getSpawnReason(); if (reason == SpawnReason.SPAWNER || reason == SpawnReason.SPAWNER_EGG) { - event.getEntity().setMetadata(mcMMO.entityMetadataKey, mcMMO.entityMetadata); + event.getEntity().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue); } } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 095f184ef..5fb634214 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -90,12 +90,9 @@ public class mcMMO extends JavaPlugin { // XP Event Check private boolean xpEventEnabled = false; - // Entity Metadata Values - public static FixedMetadataValue entityMetadata; + // Metadata Values + public static FixedMetadataValue metadataValue; public final static String entityMetadataKey = "mcMMO: Spawned Entity"; - - // Block Metadata Values - public static FixedMetadataValue blockMetadata; public final static String blockMetadataKey = "mcMMO: Piston Tracking"; /** @@ -106,8 +103,7 @@ public class mcMMO extends JavaPlugin { try { p = this; getLogger().setFilter(new LogFilter(this)); - entityMetadata = new FixedMetadataValue(this, true); - blockMetadata = new FixedMetadataValue(this, true); + metadataValue = new FixedMetadataValue(this, true); setupFilePaths(); setupSpout(); diff --git a/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java b/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java index a253b1d24..02ad5a499 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java @@ -67,7 +67,7 @@ public class CallOfTheWildEventHandler { return; LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type); - entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.entityMetadata); + entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue); ((Tameable) entity).setOwner(player);