SPIGOT-5853: DragonBattle#getEndPortalLocation() throws NPE on new world

* Add method to generate the end portal

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot
2020-06-27 11:09:01 +10:00
parent 24a247fce5
commit fe0faa152c
2 changed files with 47 additions and 0 deletions

View File

@@ -30,9 +30,23 @@ public class CraftDragonBattle implements DragonBattle {
@Override
public Location getEndPortalLocation() {
if (handle.exitPortalLocation == null) {
return null;
}
return new Location(handle.world.getWorld(), handle.exitPortalLocation.getX(), handle.exitPortalLocation.getY(), handle.exitPortalLocation.getZ());
}
@Override
public boolean generateEndPortal(boolean withPortals) {
if (handle.exitPortalLocation != null || handle.j() != null) {
return false;
}
this.handle.a(withPortals);
return true;
}
@Override
public boolean hasBeenPreviouslyKilled() {
return handle.isPreviouslyKilled();