Change listener to monitor and make sure that PlayerPortalEvent isn't cancelled before removing disguises

This commit is contained in:
libraryaddict 2014-06-15 15:00:18 +12:00
parent b9087f6fc3
commit 69ea8ed2a0

View File

@ -249,9 +249,10 @@ public class DisguiseListener implements Listener {
}
}
@EventHandler
@EventHandler(priority = EventPriority.MONITOR)
public void onWorldSwitch(PlayerPortalEvent event) {
if (DisguiseConfig.isUndisguiseOnWorldChange() && event.getFrom().getWorld() != event.getTo().getWorld()) {
if (!event.isCancelled() && DisguiseConfig.isUndisguiseOnWorldChange()
&& event.getFrom().getWorld() != event.getTo().getWorld()) {
for (Disguise disguise : DisguiseAPI.getDisguises(event.getPlayer())) {
disguise.removeDisguise();
}