diff --git a/pom.xml b/pom.xml
index f5420d1f..d7c24aaa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -64,7 +64,7 @@
2.5.0
- 7.3
+ 7.3-SNAPSHOT
diff --git a/src/me/libraryaddict/disguise/DisguiseAPI.java b/src/me/libraryaddict/disguise/DisguiseAPI.java
index e235379a..9fef993a 100644
--- a/src/me/libraryaddict/disguise/DisguiseAPI.java
+++ b/src/me/libraryaddict/disguise/DisguiseAPI.java
@@ -382,4 +382,8 @@ public class DisguiseAPI {
public void removeVisibleDisguise(Player player) {
removeSelfDisguise(player);
}
+
+ public void setupFakeDisguise(Disguise disguise) {
+ setupPlayerFakeDisguise(disguise);
+ }
}
\ No newline at end of file
diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java
index b776a95f..f1d29358 100644
--- a/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java
+++ b/src/me/libraryaddict/disguise/DisguiseTypes/Disguise.java
@@ -204,45 +204,6 @@ public class Disguise {
return disguise;
}
- /**
- * Removes the disguise and undisguises the entity if its using this disguise. This doesn't fire a UndisguiseEvent
- */
- public void removeDisguise() {
- // Why the hell can't I safely check if its running?!?!
- try {
- runnable.cancel();
- } catch (Exception ex) {
- }
- HashMap disguises = disguiseAPI.getDisguises();
- // If this disguise has a entity set
- if (getEntity() != null) {
- // If the entity is valid
- if (((CraftEntity) getEntity()).getHandle().valid) {
- // If this disguise is active
- if (disguises.containsKey(getEntity().getEntityId()) && disguises.get(getEntity().getEntityId()) == this) {
- // Now remove the disguise from the current disguises.
- disguises.remove(getEntity().getEntityId());
- // Gotta do reflection, copy code or open up calls.
- // Reflection is the cleanest?
- if (entity instanceof Player) {
- disguiseAPI.removeVisibleDisguise((Player) entity);
- }
- // Better refresh the entity to undisguise it
- disguiseAPI.refreshWatchingPlayers(getEntity());
- }
- }
- } else {
- // Loop through the disguises because it could be used with a unknown entity id.
- Iterator itel = disguises.keySet().iterator();
- while (itel.hasNext()) {
- int id = itel.next();
- if (disguises.get(id) == this) {
- itel.remove();
- }
- }
- }
- }
-
@Override
public boolean equals(Object obj) {
if (this == obj)
@@ -317,6 +278,45 @@ public class Disguise {
return velocitySent;
}
+ /**
+ * Removes the disguise and undisguises the entity if its using this disguise. This doesn't fire a UndisguiseEvent
+ */
+ public void removeDisguise() {
+ // Why the hell can't I safely check if its running?!?!
+ try {
+ runnable.cancel();
+ } catch (Exception ex) {
+ }
+ HashMap disguises = disguiseAPI.getDisguises();
+ // If this disguise has a entity set
+ if (getEntity() != null) {
+ // If the entity is valid
+ if (((CraftEntity) getEntity()).getHandle().valid) {
+ // If this disguise is active
+ if (disguises.containsKey(getEntity().getEntityId()) && disguises.get(getEntity().getEntityId()) == this) {
+ // Now remove the disguise from the current disguises.
+ disguises.remove(getEntity().getEntityId());
+ // Gotta do reflection, copy code or open up calls.
+ // Reflection is the cleanest?
+ if (entity instanceof Player) {
+ disguiseAPI.removeVisibleDisguise((Player) entity);
+ }
+ // Better refresh the entity to undisguise it
+ disguiseAPI.refreshWatchingPlayers(getEntity());
+ }
+ }
+ } else {
+ // Loop through the disguises because it could be used with a unknown entity id.
+ Iterator itel = disguises.keySet().iterator();
+ while (itel.hasNext()) {
+ int id = itel.next();
+ if (disguises.get(id) == this) {
+ itel.remove();
+ }
+ }
+ }
+ }
+
public boolean replaceSounds() {
return replaceSounds;
}
@@ -424,7 +424,17 @@ public class Disguise {
* Can the disguised view himself as the disguise
*/
public void setViewSelfDisguise(boolean viewSelfDisguise) {
- this.viewSelfDisguise = viewSelfDisguise;
+ if (this.viewSelfDisguise != viewSelfDisguise) {
+ this.viewSelfDisguise = viewSelfDisguise;
+ if (getEntity() != null && getEntity() instanceof Player) {
+ if (DisguiseAPI.getDisguise(getEntity()) == this) {
+ if (viewSelfDisguise) {
+ disguiseAPI.setupFakeDisguise(this);
+ } else
+ disguiseAPI.removeVisibleDisguise((Player) getEntity());
+ }
+ }
+ }
}
public void setWatcher(FlagWatcher newWatcher) {