Updated warp event code and stopped on stopped move events

This commit is contained in:
sekwah 2018-01-14 20:34:48 +00:00
parent 14a453ea1a
commit 72db55a86b

View File

@ -100,7 +100,7 @@ public class Listeners implements Listener {
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onMoveEvent(PlayerMoveEvent event) { public void onMoveEvent(PlayerMoveEvent event) {
// will check if the player is in the portal or not. // will check if the player is in the portal or not.
if (!Portal.portalsActive) { if (!Portal.portalsActive || event.isCancelled()) {
return; return;
} }
@ -123,7 +123,7 @@ public class Listeners implements Listener {
WarpEvent warpEvent = new WarpEvent(player, portal); WarpEvent warpEvent = new WarpEvent(player, portal);
plugin.getServer().getPluginManager().callEvent(warpEvent); plugin.getServer().getPluginManager().callEvent(warpEvent);
if (!event.isCancelled()) Portal.activate(player, portal); if (!warpEvent.isCancelled()) Portal.activate(player, portal);
portal.inPortal.add(player); portal.inPortal.add(player);
} else portal.inPortal.remove(player); } else portal.inPortal.remove(player);