Added Island#hasNetherIsland() & Island#hasEndIsland() (#714)

* Added methods to know if the island has nether/end islands

* Fixed possible NullPointer

* Update src/main/java/world/bentobox/bentobox/database/objects/Island.java

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>

* Update src/main/java/world/bentobox/bentobox/database/objects/Island.java

Co-Authored-By: Florian CUNY <poslovitch@bentobox.world>

* Implemented tastybento's required changes
This commit is contained in:
YellowZaki 2019-06-05 14:48:53 +02:00 committed by Florian CUNY
parent f6bc6c6415
commit 4e273dab18

View File

@ -940,4 +940,28 @@ public class Island implements DataObject {
public void setGameMode(String gameMode) {
this.gameMode = gameMode;
}
}
/**
* Returns if this island has its end island generated.
* @return {@code true} if this island has its end island generated, {@code false} otherwise.
* @since 1.5.0
*/
public boolean hasEndIsland(){
IslandWorldManager iwm = BentoBox.getInstance().getIWM();
return iwm.isEndGenerate(getWorld()) && iwm.isEndIslands(getWorld()) &&
iwm.getEndWorld(getWorld()) != null &&
getCenter().toVector().toLocation(iwm.getEndWorld(getWorld)).getBlock().getType().equals(Material.BEDROCK);
}
/**
* Returns if this island has its nether island generated.
* @return {@code true} if this island has its nether island generated, {@code false} otherwise.
* @since 1.5.0
*/
public boolean hasNetherIsland(){
IslandWorldManager iwm = BentoBox.getInstance().getIWM();
return iwm.isNetherGenerate(getWorld()) && iwm.isNetherIslands(getWorld()) &&
iwm.getNetherWorld(getWorld()) != null &&
getCenter().toVector().toLocation(iwm.getNetherWorld(getWorld)).getBlock().getType().equals(Material.BEDROCK);
}
}