From 0c4ffbe2cf6eb134926c8460acd1dea22feb2a95 Mon Sep 17 00:00:00 2001 From: Ekachai Omkaew Date: Mon, 25 Jan 2016 15:14:30 +0700 Subject: [PATCH] warp player when move to water portal --- .../dre2n/dungeonsxl/listener/PlayerListener.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/io/github/dre2n/dungeonsxl/listener/PlayerListener.java b/src/io/github/dre2n/dungeonsxl/listener/PlayerListener.java index c933876f..9e837b3c 100644 --- a/src/io/github/dre2n/dungeonsxl/listener/PlayerListener.java +++ b/src/io/github/dre2n/dungeonsxl/listener/PlayerListener.java @@ -366,6 +366,8 @@ public class PlayerListener implements Listener { dportal.teleport(player); } } + + @EventHandler(priority = EventPriority.HIGH) public void onTeleport(PlayerTeleportEvent event) { @@ -581,6 +583,13 @@ public class PlayerListener implements Listener { public void onMove(PlayerMoveEvent event) { Player player = event.getPlayer(); DLootInventory inventory = DLootInventory.getByPlayer(player); + + DPortal dportal = DPortal.getByLocation(player.getLocation()); + + if (plugin.getMainConfig().useWaterPortal() && dportal != null && DGroup.getByPlayer(player) != null){ + dportal.teleport(player); + return; + } if (inventory == null) { return; @@ -596,6 +605,7 @@ public class PlayerListener implements Listener { inventory.setInventoryView(inventory.getPlayer().openInventory(inventory.getInventory())); inventory.setTime(System.currentTimeMillis()); } + } }