mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-24 00:51:40 +01:00
Added a setting to be able to disable auto nether/end island pasting
https://github.com/BentoBoxWorld/BentoBox/issues/1063 Note that corresponding settings must be added to game mode addons. Also, note that I added this as a default method so that it will not break current older game mode addons.
This commit is contained in:
parent
81b4fe5bf0
commit
e8810d41d9
@ -413,4 +413,14 @@ public interface WorldSettings extends ConfigObject {
|
||||
* @since 1.9.0
|
||||
*/
|
||||
boolean isCreateIslandOnFirstLoginAbortOnLogout();
|
||||
|
||||
/**
|
||||
* Check if nether or end islands should be pasted on teleporting
|
||||
* @return true if missing nether or end islands should be pasted
|
||||
* @since 1.10.0
|
||||
*/
|
||||
default boolean isPasteMissingIslands() {
|
||||
// Note that glitches can enable bedrock to be removed in ways that will not generate events.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,9 @@ public class PortalTeleportationListener implements Listener {
|
||||
Location to = optionalIsland.map(i -> i.getSpawnPoint(Environment.THE_END)).orElse(e.getFrom().toVector().toLocation(endWorld));
|
||||
e.setCancelled(true);
|
||||
// Check if there is a missing end island
|
||||
if (!plugin.getIWM().isUseOwnGenerator(overWorld) && plugin.getIWM().isEndGenerate(overWorld)
|
||||
if (plugin.getIWM().pasteMissingIslands(overWorld)
|
||||
&& !plugin.getIWM().isUseOwnGenerator(overWorld)
|
||||
&& plugin.getIWM().isEndGenerate(overWorld)
|
||||
&& plugin.getIWM().isEndIslands(overWorld)
|
||||
&& plugin.getIWM().getEndWorld(overWorld) != null
|
||||
&& !optionalIsland.map(Island::hasEndIsland).orElse(true)) {
|
||||
@ -185,7 +187,8 @@ public class PortalTeleportationListener implements Listener {
|
||||
Location to = optionalIsland.map(i -> i.getSpawnPoint(Environment.NETHER)).orElse(e.getFrom().toVector().toLocation(nether));
|
||||
e.setCancelled(true);
|
||||
// Check if there is an island there or not
|
||||
if (!plugin.getIWM().isUseOwnGenerator(overWorld) && plugin.getIWM().isNetherGenerate(overWorld)
|
||||
if (plugin.getIWM().pasteMissingIslands(overWorld) &&
|
||||
!plugin.getIWM().isUseOwnGenerator(overWorld) && plugin.getIWM().isNetherGenerate(overWorld)
|
||||
&& plugin.getIWM().isNetherIslands(overWorld)
|
||||
&& plugin.getIWM().getNetherWorld(overWorld) != null
|
||||
&& !optionalIsland.map(Island::hasNetherIsland).orElse(true)) {
|
||||
|
@ -828,4 +828,14 @@ public class IslandWorldManager {
|
||||
public boolean isCreateIslandOnFirstLoginAbortOnLogout(@NonNull World world) {
|
||||
return gameModes.containsKey(world) && gameModes.get(world).getWorldSettings().isCreateIslandOnFirstLoginAbortOnLogout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if nether or end islands should be pasted on teleporting
|
||||
* @param world - over world
|
||||
* @return true if missing nether or end islands should be pasted
|
||||
* @since 1.10.0
|
||||
*/
|
||||
public boolean pasteMissingIslands(@NonNull World world) {
|
||||
return gameModes.containsKey(world) && gameModes.get(world).getWorldSettings().isPasteMissingIslands();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user