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

View File

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

View File

@ -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() { public void removeDisguise() {
// If the runnable is null. Just return. Its been discarded already.
if (runnable == null)
return;
// Why the hell can't I safely check if its running?!?! // Why the hell can't I safely check if its running?!?!
try { try {
runnable.cancel(); runnable.cancel();
} catch (Exception ex) { } catch (Exception ex) {
} }
runnable = null;
HashMap<Integer, Disguise> disguises = disguiseAPI.getDisguises(); HashMap<Integer, Disguise> disguises = disguiseAPI.getDisguises();
// If this disguise has a entity set // If this disguise has a entity set
if (getEntity() != null) { if (getEntity() != null) {