From 3505541d7920d70938eba6b36d661bec10a7178a Mon Sep 17 00:00:00 2001 From: Joooo Date: Mon, 2 Jan 2012 22:24:37 +0100 Subject: [PATCH] MyWorlds Portals don't work as Nether Portals anymore --- src/com/bergerkiller/bukkit/mw/MWPlayerListener.java | 6 ++++++ src/com/bergerkiller/bukkit/mw/MyWorlds.java | 1 + 2 files changed, 7 insertions(+) diff --git a/src/com/bergerkiller/bukkit/mw/MWPlayerListener.java b/src/com/bergerkiller/bukkit/mw/MWPlayerListener.java index 254b741..dbec5e7 100644 --- a/src/com/bergerkiller/bukkit/mw/MWPlayerListener.java +++ b/src/com/bergerkiller/bukkit/mw/MWPlayerListener.java @@ -19,6 +19,7 @@ import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerPortalEvent; public class MWPlayerListener extends PlayerListener { @@ -34,6 +35,11 @@ public static boolean isSolid(Block b, BlockFace direction) { } } + public void onPlayerPortal(PlayerPortalEvent event) { + if(Portal.get(event.getFrom(), 5)!=null) + event.setCancelled(true); + } + @Override public void onPlayerInteract(PlayerInteractEvent event) { if (event.isCancelled()) return; diff --git a/src/com/bergerkiller/bukkit/mw/MyWorlds.java b/src/com/bergerkiller/bukkit/mw/MyWorlds.java index 199a72a..7b4f736 100644 --- a/src/com/bergerkiller/bukkit/mw/MyWorlds.java +++ b/src/com/bergerkiller/bukkit/mw/MyWorlds.java @@ -61,6 +61,7 @@ public void onEnable() { pm.registerEvent(Event.Type.PLAYER_JOIN, playerListener, Priority.Monitor, this); pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Monitor, this); pm.registerEvent(Event.Type.PLAYER_CHANGED_WORLD, playerListener, Priority.Monitor, this); + pm.registerEvent(Event.Type.PLAYER_PORTAL, playerListener, Priority.High, this); pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Priority.Lowest, this); pm.registerEvent(Event.Type.SIGN_CHANGE, blockListener, Priority.Normal, this); pm.registerEvent(Event.Type.WORLD_LOAD, worldListener, Priority.Monitor, this);