diff --git a/src/me/libraryaddict/disguise/DisguiseAPI.java b/src/me/libraryaddict/disguise/DisguiseAPI.java index c92e8aac..b7a3f9ef 100644 --- a/src/me/libraryaddict/disguise/DisguiseAPI.java +++ b/src/me/libraryaddict/disguise/DisguiseAPI.java @@ -73,6 +73,19 @@ public class DisguiseAPI { return hearSelfDisguise; } + public static void disguiseNextEntity(Disguise disguise) { + if (disguise == null) + return; + try { + Field field = net.minecraft.server.v1_6_R2.Entity.class.getDeclaredField("entityCount"); + field.setAccessible(true); + int id = field.getInt(null); + disguises.put(id, disguise); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + /** * @param Player * - The player to disguise @@ -103,19 +116,6 @@ public class DisguiseAPI { setupPlayer((Player) entity); } - public static void disguiseNextEntity(Disguise disguise) { - if (disguise == null) - return; - try { - Field field = net.minecraft.server.v1_6_R2.Entity.class.getDeclaredField("entityCount"); - field.setAccessible(true); - int id = field.getInt(null); - disguises.put(id, disguise); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - public static void enableSounds(boolean isSoundsEnabled) { if (soundsEnabled != isSoundsEnabled) { soundsEnabled = isSoundsEnabled; diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java index e8461324..aeed7cbf 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java @@ -155,6 +155,58 @@ public class Disguise { watcher = tempWatcher; } + public boolean equals(Disguise disguise) { + if (getType() != disguise.getType()) + return false; + if (replaceSounds() != disguise.replaceSounds()) + return false; + if (!getWatcher().equals(disguise.getWatcher())) + return false; + return true; + } + + public org.bukkit.entity.Entity getEntity() { + return entity; + } + + protected EntityPlayer[] getPerverts() { + EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ((CraftEntity) entity).getHandle().world).tracker.trackedEntities + .get(entity.getEntityId()); + if (entry != null) { + EntityPlayer[] players = (EntityPlayer[]) entry.trackedPlayers.toArray(new EntityPlayer[entry.trackedPlayers.size()]); + return players; + } + return new EntityPlayer[0]; + } + + public BukkitRunnable getScheduler() { + return runnable; + } + + public DisguiseType getType() { + return disguiseType; + } + + public FlagWatcher getWatcher() { + return watcher; + } + + public boolean isMiscDisguise() { + return this instanceof MiscDisguise; + } + + public boolean isMobDisguise() { + return this instanceof MobDisguise; + } + + public boolean isPlayerDisguise() { + return this instanceof PlayerDisguise; + } + + public boolean replaceSounds() { + return replaceSounds; + } + public void setEntity(final org.bukkit.entity.Entity entity) { if (this.entity != null) throw new RuntimeException("This disguise is already in use! Try .clone()"); @@ -279,58 +331,6 @@ public class Disguise { runnable.runTaskTimer(plugin, 1, 1); } - public boolean equals(Disguise disguise) { - if (getType() != disguise.getType()) - return false; - if (replaceSounds() != disguise.replaceSounds()) - return false; - if (!getWatcher().equals(disguise.getWatcher())) - return false; - return true; - } - - public org.bukkit.entity.Entity getEntity() { - return entity; - } - - protected EntityPlayer[] getPerverts() { - EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ((CraftEntity) entity).getHandle().world).tracker.trackedEntities - .get(entity.getEntityId()); - if (entry != null) { - EntityPlayer[] players = (EntityPlayer[]) entry.trackedPlayers.toArray(new EntityPlayer[entry.trackedPlayers.size()]); - return players; - } - return new EntityPlayer[0]; - } - - public BukkitRunnable getScheduler() { - return runnable; - } - - public DisguiseType getType() { - return disguiseType; - } - - public FlagWatcher getWatcher() { - return watcher; - } - - public boolean isMiscDisguise() { - return this instanceof MiscDisguise; - } - - public boolean isMobDisguise() { - return this instanceof MobDisguise; - } - - public boolean isPlayerDisguise() { - return this instanceof PlayerDisguise; - } - - public boolean replaceSounds() { - return replaceSounds; - } - public void setReplaceSounds(boolean areSoundsReplaced) { replaceSounds = areSoundsReplaced; } diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/Values.java b/src/me/libraryaddict/disguise/DisguiseTypes/Values.java index d80544eb..6228ce40 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/Values.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/Values.java @@ -60,10 +60,6 @@ public class Values { declared = classType; } - public EnumEntitySize getEntitySize() { - return enumEntitySize; - } - public HashMap getAttributesValues() { return attributesValues; } @@ -72,6 +68,10 @@ public class Values { return declared; } + public EnumEntitySize getEntitySize() { + return enumEntitySize; + } + public HashMap getMetaValues() { return metaValues; }