diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 87efe2cb1f..71707ed197 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -1764,7 +1764,7 @@ public abstract class Entity { Location exit = exitWorld != null ? minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i)) : null; boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END - TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : null; + TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit, agent); event.useTravelAgent(useTravelAgent); event.getEntity().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java index c9810b4b3b..b0bb672e3c 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -451,7 +451,7 @@ public abstract class PlayerList { } } - TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : null; + TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins PlayerPortalEvent event = new PlayerPortalEvent(entityplayer.getBukkitEntity(), enter, exit, agent, cause); event.useTravelAgent(useTravelAgent); Bukkit.getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftTravelAgent.java b/src/main/java/org/bukkit/craftbukkit/CraftTravelAgent.java index b21714e5f2..3a313e5349 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftTravelAgent.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftTravelAgent.java @@ -9,12 +9,17 @@ import org.bukkit.TravelAgent; public class CraftTravelAgent extends PortalTravelAgent implements TravelAgent { + public static TravelAgent DEFAULT = null; + private int searchRadius = 128; private int creationRadius = 16; private boolean canCreatePortal = true; public CraftTravelAgent(WorldServer worldserver) { super(worldserver); + if (DEFAULT == null && worldserver.dimension == 0) { + DEFAULT = (TravelAgent) worldserver.s(); + } } public Location findOrCreate(Location target) {