warp player when move to water portal

This commit is contained in:
Ekachai Omkaew 2016-01-25 15:14:30 +07:00
parent c44ec86f20
commit 0c4ffbe2cf

View File

@ -366,6 +366,8 @@ public class PlayerListener implements Listener {
dportal.teleport(player); dportal.teleport(player);
} }
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onTeleport(PlayerTeleportEvent event) { public void onTeleport(PlayerTeleportEvent event) {
@ -581,6 +583,13 @@ public class PlayerListener implements Listener {
public void onMove(PlayerMoveEvent event) { public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
DLootInventory inventory = DLootInventory.getByPlayer(player); 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) { if (inventory == null) {
return; return;
@ -596,6 +605,7 @@ public class PlayerListener implements Listener {
inventory.setInventoryView(inventory.getPlayer().openInventory(inventory.getInventory())); inventory.setInventoryView(inventory.getPlayer().openInventory(inventory.getInventory()));
inventory.setTime(System.currentTimeMillis()); inventory.setTime(System.currentTimeMillis());
} }
} }
} }