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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user