Use the same MetadataValue for both of these

This commit is contained in:
GJ 2013-02-23 18:13:12 -05:00
parent 3036d4fa90
commit 38155e3af4
4 changed files with 7 additions and 11 deletions

View File

@ -68,7 +68,7 @@ public class BlockListener implements Listener {
for (Block b : blocks) { for (Block b : blocks) {
if (mcMMO.placeStore.isTrue(b)) { 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)) { if (b.equals(futureEmptyBlock)) {
mcMMO.placeStore.setFalse(b); mcMMO.placeStore.setFalse(b);
} }

View File

@ -67,7 +67,7 @@ public class EntityListener implements Listener {
if (mcMMO.placeStore.isTrue(block) && !entity.hasMetadata(mcMMO.entityMetadataKey)) { if (mcMMO.placeStore.isTrue(block) && !entity.hasMetadata(mcMMO.entityMetadataKey)) {
mcMMO.placeStore.setFalse(block); mcMMO.placeStore.setFalse(block);
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.entityMetadata); entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
} }
else if (entity.hasMetadata(mcMMO.entityMetadataKey)) { else if (entity.hasMetadata(mcMMO.entityMetadataKey)) {
mcMMO.placeStore.setTrue(block); mcMMO.placeStore.setTrue(block);
@ -308,7 +308,7 @@ public class EntityListener implements Listener {
SpawnReason reason = event.getSpawnReason(); SpawnReason reason = event.getSpawnReason();
if (reason == SpawnReason.SPAWNER || reason == SpawnReason.SPAWNER_EGG) { if (reason == SpawnReason.SPAWNER || reason == SpawnReason.SPAWNER_EGG) {
event.getEntity().setMetadata(mcMMO.entityMetadataKey, mcMMO.entityMetadata); event.getEntity().setMetadata(mcMMO.entityMetadataKey, mcMMO.metadataValue);
} }
} }

View File

@ -90,12 +90,9 @@ public class mcMMO extends JavaPlugin {
// XP Event Check // XP Event Check
private boolean xpEventEnabled = false; private boolean xpEventEnabled = false;
// Entity Metadata Values // Metadata Values
public static FixedMetadataValue entityMetadata; public static FixedMetadataValue metadataValue;
public final static String entityMetadataKey = "mcMMO: Spawned Entity"; public final static String entityMetadataKey = "mcMMO: Spawned Entity";
// Block Metadata Values
public static FixedMetadataValue blockMetadata;
public final static String blockMetadataKey = "mcMMO: Piston Tracking"; public final static String blockMetadataKey = "mcMMO: Piston Tracking";
/** /**
@ -106,8 +103,7 @@ public class mcMMO extends JavaPlugin {
try { try {
p = this; p = this;
getLogger().setFilter(new LogFilter(this)); getLogger().setFilter(new LogFilter(this));
entityMetadata = new FixedMetadataValue(this, true); metadataValue = new FixedMetadataValue(this, true);
blockMetadata = new FixedMetadataValue(this, true);
setupFilePaths(); setupFilePaths();
setupSpout(); setupSpout();

View File

@ -67,7 +67,7 @@ public class CallOfTheWildEventHandler {
return; return;
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type); 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); ((Tameable) entity).setOwner(player);