mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-07-13 23:24:43 +02:00
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:
parent
f6bc6c6415
commit
4e273dab18
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user