diff options
author | EvilSeph <evilseph@gmail.com> | 2012-03-08 19:50:01 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-03-08 19:50:01 -0500 |
commit | 43a00954f562613c0f5176dfff8ab818b61e02c1 (patch) | |
tree | d9e9ed21447465c2c7e46027ae267431b4665ee0 /src/main/java/net | |
parent | f26fbc3bf306aa171ec7fa629ac7d7031528bd62 (diff) | |
download | craftbukkit-43a00954f562613c0f5176dfff8ab818b61e02c1.tar craftbukkit-43a00954f562613c0f5176dfff8ab818b61e02c1.tar.gz craftbukkit-43a00954f562613c0f5176dfff8ab818b61e02c1.tar.lz craftbukkit-43a00954f562613c0f5176dfff8ab818b61e02c1.tar.xz craftbukkit-43a00954f562613c0f5176dfff8ab818b61e02c1.zip |
Made PlayerPortalEvent fire when leaving The End. Fixes BUKKIT-478
Diffstat (limited to 'src/main/java/net')
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 50f2658c..8c24d43f 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -12,6 +12,7 @@ import java.util.HashSet; import java.util.Timer; import java.util.TimerTask; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.craftbukkit.ChunkCompressionThread; import org.bukkit.Location; @@ -41,6 +42,7 @@ import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSprintEvent; +import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.Event.Result; import org.bukkit.event.inventory.*; import org.bukkit.event.inventory.InventoryType.SlotType; @@ -1093,8 +1095,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener { // CraftBukkit start CraftWorld cworld = (CraftWorld) this.server.getWorlds().get(0); ChunkCoordinates chunkcoordinates = cworld.getHandle().getSpawn(); - Location location = new Location(cworld, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5); - this.player = this.minecraftServer.serverConfigurationManager.moveToWorld(this.player, 0, true, location); + Location toLocation = new Location(cworld, chunkcoordinates.x + 0.5, chunkcoordinates.y, chunkcoordinates.z + 0.5); + + org.bukkit.craftbukkit.PortalTravelAgent pta = new org.bukkit.craftbukkit.PortalTravelAgent(); + PlayerPortalEvent event = new PlayerPortalEvent(this.player.getBukkitEntity(), this.player.getBukkitEntity().getLocation(), toLocation, pta, PlayerPortalEvent.TeleportCause.END_PORTAL); + event.useTravelAgent(false); + + Bukkit.getServer().getPluginManager().callEvent(event); + this.player = this.minecraftServer.serverConfigurationManager.moveToWorld(this.player, 0, true, event.getTo()); // CraftBukkit end } else { if (this.player.getHealth() > 0) { |