From 69ea8ed2a0219d806557e9c5bb1fdcbb177a5eb2 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sun, 15 Jun 2014 15:00:18 +1200 Subject: [PATCH] Change listener to monitor and make sure that PlayerPortalEvent isn't cancelled before removing disguises --- src/me/libraryaddict/disguise/DisguiseListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/me/libraryaddict/disguise/DisguiseListener.java b/src/me/libraryaddict/disguise/DisguiseListener.java index 556b3f21..2ac59d4f 100644 --- a/src/me/libraryaddict/disguise/DisguiseListener.java +++ b/src/me/libraryaddict/disguise/DisguiseListener.java @@ -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(); }