mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-09 01:48:24 +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
@ -136,7 +136,7 @@ public interface WorldSettings extends ConfigObject {
|
|||||||
* @return the visitorBannedCommands
|
* @return the visitorBannedCommands
|
||||||
*/
|
*/
|
||||||
List<String> getVisitorBannedCommands();
|
List<String> getVisitorBannedCommands();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Optional list of commands that are banned when falling. Not applicable to all game modes so defaults to empty.
|
* Optional list of commands that are banned when falling. Not applicable to all game modes so defaults to empty.
|
||||||
* @return the fallingBannedCommands
|
* @return the fallingBannedCommands
|
||||||
@ -413,4 +413,14 @@ public interface WorldSettings extends ConfigObject {
|
|||||||
* @since 1.9.0
|
* @since 1.9.0
|
||||||
*/
|
*/
|
||||||
boolean isCreateIslandOnFirstLoginAbortOnLogout();
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,12 +60,12 @@ public class PortalTeleportationListener implements Listener {
|
|||||||
}
|
}
|
||||||
World fromWorld = e.getFrom().getWorld();
|
World fromWorld = e.getFrom().getWorld();
|
||||||
World overWorld = Util.getWorld(fromWorld);
|
World overWorld = Util.getWorld(fromWorld);
|
||||||
|
|
||||||
if (fromWorld == null || !plugin.getIWM().inWorld(overWorld)) {
|
if (fromWorld == null || !plugin.getIWM().inWorld(overWorld)) {
|
||||||
// Do nothing special
|
// Do nothing special
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1.14.4 requires explicit cancellation to prevent teleporting to the normal nether
|
// 1.14.4 requires explicit cancellation to prevent teleporting to the normal nether
|
||||||
if (!plugin.getIWM().isEndGenerate(overWorld)) {
|
if (!plugin.getIWM().isEndGenerate(overWorld)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(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));
|
Location to = optionalIsland.map(i -> i.getSpawnPoint(Environment.THE_END)).orElse(e.getFrom().toVector().toLocation(endWorld));
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
// Check if there is a missing end island
|
// 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().isEndIslands(overWorld)
|
||||||
&& plugin.getIWM().getEndWorld(overWorld) != null
|
&& plugin.getIWM().getEndWorld(overWorld) != null
|
||||||
&& !optionalIsland.map(Island::hasEndIsland).orElse(true)) {
|
&& !optionalIsland.map(Island::hasEndIsland).orElse(true)) {
|
||||||
@ -143,13 +145,13 @@ public class PortalTeleportationListener implements Listener {
|
|||||||
// Do nothing special
|
// Do nothing special
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1.14.4 requires explicit cancellation to prevent teleporting to the normal nether
|
// 1.14.4 requires explicit cancellation to prevent teleporting to the normal nether
|
||||||
if (!plugin.getIWM().isNetherGenerate(overWorld)) {
|
if (!plugin.getIWM().isNetherGenerate(overWorld)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STANDARD NETHER
|
// STANDARD NETHER
|
||||||
if (!plugin.getIWM().isNetherIslands(overWorld)) {
|
if (!plugin.getIWM().isNetherIslands(overWorld)) {
|
||||||
if (fromWorld.getEnvironment() != Environment.NETHER) {
|
if (fromWorld.getEnvironment() != Environment.NETHER) {
|
||||||
@ -185,7 +187,8 @@ public class PortalTeleportationListener implements Listener {
|
|||||||
Location to = optionalIsland.map(i -> i.getSpawnPoint(Environment.NETHER)).orElse(e.getFrom().toVector().toLocation(nether));
|
Location to = optionalIsland.map(i -> i.getSpawnPoint(Environment.NETHER)).orElse(e.getFrom().toVector().toLocation(nether));
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
// Check if there is an island there or not
|
// 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().isNetherIslands(overWorld)
|
||||||
&& plugin.getIWM().getNetherWorld(overWorld) != null
|
&& plugin.getIWM().getNetherWorld(overWorld) != null
|
||||||
&& !optionalIsland.map(Island::hasNetherIsland).orElse(true)) {
|
&& !optionalIsland.map(Island::hasNetherIsland).orElse(true)) {
|
||||||
|
@ -828,4 +828,14 @@ public class IslandWorldManager {
|
|||||||
public boolean isCreateIslandOnFirstLoginAbortOnLogout(@NonNull World world) {
|
public boolean isCreateIslandOnFirstLoginAbortOnLogout(@NonNull World world) {
|
||||||
return gameModes.containsKey(world) && gameModes.get(world).getWorldSettings().isCreateIslandOnFirstLoginAbortOnLogout();
|
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