diff --git a/src/main/java/us/tastybento/bskyblock/Settings.java b/src/main/java/us/tastybento/bskyblock/Settings.java index 3a9f4e865..2e3bb06e5 100644 --- a/src/main/java/us/tastybento/bskyblock/Settings.java +++ b/src/main/java/us/tastybento/bskyblock/Settings.java @@ -166,7 +166,9 @@ public class Settings implements DataObject, WorldSettings { @ConfigEntry(path = "world.start-z", needsReset = true) private int islandStartZ = 0; + @ConfigEntry(path = "world.offset-x") private int islandXOffset; + @ConfigEntry(path = "world.offset-z") private int islandZOffset; @ConfigComment("Island height - Lowest is 5.") @@ -174,6 +176,11 @@ public class Settings implements DataObject, WorldSettings { @ConfigEntry(path = "world.island-height") private int islandHeight = 100; + @ConfigComment("Use your own world generator for this world. In this case, the plugin will not generate") + @ConfigComment("anything.") + @ConfigEntry(path = "world.use-own-generator") + private boolean useOwnGenerator; + @ConfigComment("Sea height (don't changes this mid-game unless you delete the world)") @ConfigComment("Minimum is 0, which means you are playing Skyblock!") @ConfigComment("If sea height is less than about 10, then players will drop right through it") @@ -422,8 +429,6 @@ public class Settings implements DataObject, WorldSettings { private EntityType companionType = EntityType.COW; - private boolean useOwnGenerator; - private Map limitedBlocks = new HashMap<>(); private boolean teamJoinDeathReset; @@ -943,6 +948,7 @@ public class Settings implements DataObject, WorldSettings { /** * @return the useOwnGenerator */ + @Override public boolean isUseOwnGenerator() { return useOwnGenerator; } diff --git a/src/main/java/us/tastybento/bskyblock/api/configuration/WorldSettings.java b/src/main/java/us/tastybento/bskyblock/api/configuration/WorldSettings.java index 4222a6485..4398f91d6 100644 --- a/src/main/java/us/tastybento/bskyblock/api/configuration/WorldSettings.java +++ b/src/main/java/us/tastybento/bskyblock/api/configuration/WorldSettings.java @@ -203,5 +203,10 @@ public interface WorldSettings { Map getDefaultIslandSettings(); + /** + * @return true if the default world generator should not operate in this world + */ + boolean isUseOwnGenerator(); + } diff --git a/src/main/java/us/tastybento/bskyblock/managers/IslandWorldManager.java b/src/main/java/us/tastybento/bskyblock/managers/IslandWorldManager.java index e72cf820a..2a2595711 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/IslandWorldManager.java +++ b/src/main/java/us/tastybento/bskyblock/managers/IslandWorldManager.java @@ -54,7 +54,25 @@ public class IslandWorldManager { worlds = new HashMap<>(); worldSettings = new HashMap<>(); if (plugin.getSettings().isUseOwnGenerator()) { - // Do nothing + plugin.log("Default world generator disabled."); + islandWorld = Bukkit.getWorld(plugin.getSettings().getWorldName()); + if (plugin.getSettings().isNetherGenerate()) { + netherWorld = plugin.getServer().getWorld(plugin.getSettings().getWorldName() + NETHER); + if (netherWorld == null) { + plugin.logError("Island nether world does not exist - you must create it manually"); + } + } + if (plugin.getSettings().isEndGenerate()) { + endWorld = plugin.getServer().getWorld(plugin.getSettings().getWorldName() + THE_END); + if (endWorld == null) { + plugin.logError("Island end world does not exist - you must create it manually"); + } + } + if (islandWorld != null) { + addWorld(islandWorld, plugin.getSettings()); + } else { + plugin.logError("Island world does not exist - you must create it manually"); + } return; } if (plugin.getServer().getWorld(plugin.getSettings().getWorldName()) == null) { @@ -90,8 +108,12 @@ public class IslandWorldManager { } } + /** + * Registers a world with Multiverse if the plugin exists + * @param world - world + */ private void multiverseReg(World world) { - if (Bukkit.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) { + if (!isUseOwnGenerator(world) && Bukkit.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) { Bukkit.getScheduler().runTask(plugin, () -> Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), MULTIVERSE_IMPORT + world.getName() + " normal -g " + plugin.getName())); Bukkit.getScheduler().runTask(plugin, () -> { @@ -583,4 +605,9 @@ public class IslandWorldManager { public Map getDefaultIslandSettings(World world) { return worldSettings.get(Util.getWorld(world)).getDefaultIslandSettings(); } + + public boolean isUseOwnGenerator(World world) { + return worldSettings.get(Util.getWorld(world)).isUseOwnGenerator(); + } + } diff --git a/src/main/java/us/tastybento/bskyblock/managers/island/NewIsland.java b/src/main/java/us/tastybento/bskyblock/managers/island/NewIsland.java index a8f3f69ea..688c65ed9 100644 --- a/src/main/java/us/tastybento/bskyblock/managers/island/NewIsland.java +++ b/src/main/java/us/tastybento/bskyblock/managers/island/NewIsland.java @@ -221,7 +221,7 @@ public class NewIsland { return Result.ISLAND_FOUND; } - if (!plugin.getSettings().isUseOwnGenerator()) { + if (!plugin.getIWM().isUseOwnGenerator(location.getWorld())) { // Block check if (!location.getBlock().isEmpty() && !location.getBlock().isLiquid()) { plugin.getIslands().createIsland(location);