mirror of
https://github.com/PaperMC/Paper.git
synced 2026-11-25 10:29:41 -05:00
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.
This commit is contained in:
1 parent
4d3865a036
commit
efe8e9a7f5
3 files changed
+7
-2
No files matched your search
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user