Rename discard() to removeDisguise(). Make the disguise reusable

This commit is contained in:
Andrew 2013-08-13 21:57:21 +12:00
parent 448c227303
commit 2b2f5d4aed
2 changed files with 4 additions and 8 deletions

@ -106,7 +106,7 @@ public class DisguiseAPI {
setupPlayerFakeDisguise(disguise);
// Discard the disguise
if (oldDisguise != null)
oldDisguise.discard();
oldDisguise.removeDisguise();
}
/**
@ -368,7 +368,7 @@ public class DisguiseAPI {
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled())
return;
disguise.discard();
disguise.removeDisguise();
}
public HashMap<Integer, Disguise> getDisguises() {

@ -205,18 +205,14 @@ public class Disguise {
}
/**
* Destroys the disguise and undisguises the entity if its using this disguise. This doesn't fire a UndisguiseEvent
* Removes the disguise and undisguises the entity if its using this disguise. This doesn't fire a UndisguiseEvent
*/
public void discard() {
// If the runnable is null. Just return. Its been discarded already.
if (runnable == null)
return;
public void removeDisguise() {
// Why the hell can't I safely check if its running?!?!
try {
runnable.cancel();
} catch (Exception ex) {
}
runnable = null;
HashMap<Integer, Disguise> disguises = disguiseAPI.getDisguises();
// If this disguise has a entity set
if (getEntity() != null) {