diff options
author | EdGruberman <ed@rjump.com> | 2013-02-03 12:55:51 -0700 |
---|---|---|
committer | feildmaster <admin@feildmaster.com> | 2013-02-04 18:53:06 -0600 |
commit | efe8e9a7f504aed2d187e4aeb3bc55460ddf8eca (patch) | |
tree | 57d0e2fc9539addc6bdb8d822bdf96237998701b /src/main/java/net/minecraft/server/PlayerList.java | |
parent | 4d3865a03639eac0da60cd830ba4feee0bb53121 (diff) | |
download | craftbukkit-efe8e9a7f504aed2d187e4aeb3bc55460ddf8eca.tar craftbukkit-efe8e9a7f504aed2d187e4aeb3bc55460ddf8eca.tar.gz craftbukkit-efe8e9a7f504aed2d187e4aeb3bc55460ddf8eca.tar.lz craftbukkit-efe8e9a7f504aed2d187e4aeb3bc55460ddf8eca.tar.xz craftbukkit-efe8e9a7f504aed2d187e4aeb3bc55460ddf8eca.zip |
Always return a TravelAgent; Fixes BUKKIT-3541
Recent changes caused PlayerPortalEvent to suddenly return null
unexpectedly and could end up in NPEs resulting that did not before.
This commit addresses that situation by always ensuring a TravelAgent
instance is returned.
The TravelAgent for world 0 is returned arbitrarily in an effort to
compensate for plugins that are implementation dependent and expect some
form of a TravelAgent to be accessible in the event at all times.
Diffstat (limited to 'src/main/java/net/minecraft/server/PlayerList.java')
-rw-r--r-- | src/main/java/net/minecraft/server/PlayerList.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java index c9810b4b..b0bb672e 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); |