diff --git a/pom.xml b/pom.xml index d9a97d4a..feeb9e8d 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ -LOCAL - 1.12.1 + 1.12.2 BentoBoxWorld_AOneBlock bentobox-world diff --git a/src/main/java/world/bentobox/aoneblock/Settings.java b/src/main/java/world/bentobox/aoneblock/Settings.java index 62142712..207d6689 100644 --- a/src/main/java/world/bentobox/aoneblock/Settings.java +++ b/src/main/java/world/bentobox/aoneblock/Settings.java @@ -13,6 +13,8 @@ import org.bukkit.block.Biome; import org.bukkit.entity.EntityType; +import com.google.common.base.Enums; + import world.bentobox.aoneblock.listeners.BlockListener; import world.bentobox.bentobox.api.configuration.ConfigComment; import world.bentobox.bentobox.api.configuration.ConfigEntry; @@ -159,6 +161,13 @@ public class Settings implements WorldSettings { @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") + @ConfigComment("If sea height is less than about 10, then players will drop right through it") + @ConfigComment("if it exists.") + @ConfigEntry(path = "world.sea-height", needsReset = true) + private int seaHeight = 0; + @ConfigComment("Maximum number of islands in the world. Set to -1 or 0 for unlimited.") @ConfigComment("If the number of islands is greater than this number, it will stop players from creating islands.") @ConfigEntry(path = "world.max-islands") @@ -172,6 +181,12 @@ public class Settings implements WorldSettings { @ConfigComment("The default biome for the overworld") @ConfigEntry(path = "world.default-biome") private Biome defaultBiome = Biome.PLAINS; + @ConfigComment("The default biome for the nether world (this may affect what mobs can spawn)") + @ConfigEntry(path = "world.default-nether-biome") + private Biome defaultNetherBiome = Enums.getIfPresent(Biome.class, "NETHER").or(Enums.getIfPresent(Biome.class, "NETHER_WASTES").or(Biome.BADLANDS)); + @ConfigComment("The default biome for the end world (this may affect what mobs can spawn)") + @ConfigEntry(path = "world.default-end-biome") + private Biome defaultEndBiome = Biome.THE_END; @ConfigComment("The maximum number of players a player can ban at any one time in this game mode.") @ConfigComment("The permission acidisland.ban.maxlimit.X where X is a number can also be used per player") @@ -188,6 +203,17 @@ public class Settings implements WorldSettings { @ConfigEntry(path = "world.nether.generate") private boolean netherGenerate = true; + @ConfigComment("Islands in Nether. Change to false for standard vanilla nether.") + @ConfigComment("Note that there is currently no magic block in the Nether") + @ConfigEntry(path = "world.nether.islands", needsReset = true) + private boolean netherIslands = false; + + @ConfigComment("Make the nether roof, if false, there is nothing up there") + @ConfigComment("Change to false if lag is a problem from the generation") + @ConfigComment("Only applies to islands Nether") + @ConfigEntry(path = "world.nether.roof") + private boolean netherRoof = false; + @ConfigComment("Nether spawn protection radius - this is the distance around the nether spawn") @ConfigComment("that will be protected from player interaction (breaking blocks, pouring lava etc.)") @ConfigComment("Minimum is 0 (not recommended), maximum is 100. Default is 25.") @@ -203,11 +229,16 @@ public class Settings implements WorldSettings { private boolean makeNetherPortals = false; // End - @ConfigComment("End world - if this is false, the end world will not be made and access to") + @ConfigComment("End Nether - if this is false, the end world will not be made and access to") @ConfigComment("the end will not occur. Other plugins may still enable portal usage.") @ConfigEntry(path = "world.end.generate") private boolean endGenerate = false; + @ConfigComment("Islands in The End. Change to false for standard vanilla end.") + @ConfigComment("Note that there is currently no magic block in the End") + @ConfigEntry(path = "world.end.islands", needsReset = true) + private boolean endIslands = false; + @ConfigComment("This option indicates if obsidian platform in the end should be generated") @ConfigComment("when player enters the end world.") @ConfigComment("This option requires `allow-end=true` in bukkit.yml.") @@ -613,7 +644,7 @@ public boolean isUseOwnGenerator() { */ @Override public int getSeaHeight() { - return 0; + return seaHeight; } /** @@ -645,7 +676,14 @@ public boolean isNetherGenerate() { */ @Override public boolean isNetherIslands() { - return false; + return netherIslands; + } + + /** + * @return the netherRoof + */ + public boolean isNetherRoof() { + return netherRoof; } /** @@ -669,7 +707,7 @@ public boolean isEndGenerate() { */ @Override public boolean isEndIslands() { - return false; + return endIslands; } /** @@ -1049,6 +1087,13 @@ public void setUseOwnGenerator(boolean useOwnGenerator) { this.useOwnGenerator = useOwnGenerator; } + /** + * @param seaHeight the seaHeight to set + */ + public void setSeaHeight(int seaHeight) { + this.seaHeight = seaHeight; + } + /** * @param maxIslands the maxIslands to set */ @@ -1070,6 +1115,20 @@ public void setNetherGenerate(boolean netherGenerate) { this.netherGenerate = netherGenerate; } + /** + * @param netherIslands the netherIslands to set + */ + public void setNetherIslands(boolean netherIslands) { + this.netherIslands = netherIslands; + } + + /** + * @param netherRoof the netherRoof to set + */ + public void setNetherRoof(boolean netherRoof) { + this.netherRoof = netherRoof; + } + /** * @param netherSpawnRadius the netherSpawnRadius to set */ @@ -1084,6 +1143,13 @@ public void setEndGenerate(boolean endGenerate) { this.endGenerate = endGenerate; } + /** + * @param endIslands the endIslands to set + */ + public void setEndIslands(boolean endIslands) { + this.endIslands = endIslands; + } + /** * @param removeMobsWhitelist the removeMobsWhitelist to set */ @@ -1769,6 +1835,34 @@ public void setDropOnTop(boolean dropOnTop) { this.dropOnTop = dropOnTop; } + /** + * @return the defaultNetherBiome + */ + public Biome getDefaultNetherBiome() { + return defaultNetherBiome; + } + + /** + * @param defaultNetherBiome the defaultNetherBiome to set + */ + public void setDefaultNetherBiome(Biome defaultNetherBiome) { + this.defaultNetherBiome = defaultNetherBiome; + } + + /** + * @return the defaultEndBiome + */ + public Biome getDefaultEndBiome() { + return defaultEndBiome; + } + + /** + * @param defaultEndBiome the defaultEndBiome to set + */ + public void setDefaultEndBiome(Biome defaultEndBiome) { + this.defaultEndBiome = defaultEndBiome; + } + /** * @return the makeNetherPortals */ @@ -1910,4 +2004,4 @@ public int getHologramDuration() { public void setHologramDuration(int hologramDuration) { this.hologramDuration = hologramDuration; } -} +} \ No newline at end of file diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 01b0ec17..2495775d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -99,6 +99,12 @@ world: # If used, you must specify the world name and generator in the bukkit.yml file. # See https://bukkit.gamepedia.com/Bukkit.yml#.2AOPTIONAL.2A_worlds use-own-generator: false + # Sea height (don't changes this mid-game unless you delete the world) + # Minimum is 0 + # If sea height is less than about 10, then players will drop right through it + # if it exists. + # /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds. + sea-height: 0 # Maximum number of islands in the world. Set to -1 or 0 for unlimited. # If the number of islands is greater than this number, it will stop players from creating islands. max-islands: 0 @@ -107,6 +113,10 @@ world: default-game-mode: SURVIVAL # The default biome for the overworld default-biome: PLAINS + # The default biome for the nether world (this may affect what mobs can spawn) + default-nether-biome: NETHER_WASTES + # The default biome for the end world (this may affect what mobs can spawn) + default-end-biome: THE_END # The maximum number of players a player can ban at any one time in this game mode. # The permission acidisland.ban.maxlimit.X where X is a number can also be used per player # -1 = unlimited @@ -118,6 +128,14 @@ world: # Note that with a standard nether all players arrive at the same portal and entering a # portal will return them back to their islands. generate: true + # Islands in Nether. Change to false for standard vanilla nether. + # Note that there is currently no magic block in the Nether + # /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds. + islands: false + # Make the nether roof, if false, there is nothing up there + # Change to false if lag is a problem from the generation + # Only applies to islands Nether + roof: false # Nether spawn protection radius - this is the distance around the nether spawn # that will be protected from player interaction (breaking blocks, pouring lava etc.) # Minimum is 0 (not recommended), maximum is 100. Default is 25. @@ -130,9 +148,13 @@ world: # Added since 1.16. create-and-link-portals: false end: - # End world - if this is false, the end world will not be made and access to + # End Nether - if this is false, the end world will not be made and access to # the end will not occur. Other plugins may still enable portal usage. generate: true + # Islands in The End. Change to false for standard vanilla end. + # Note that there is currently no magic block in the End + # /!\ BentoBox currently does not support changing this value mid-game. If you do need to change it, do a full reset of your databases and worlds. + islands: false # This option indicates if obsidian platform in the end should be generated # when player enters the end world. # This option requires `allow-end=true` in bukkit.yml. @@ -150,6 +172,7 @@ world: PISTON_PUSH: false ISLAND_RESPAWN: true CREEPER_GRIEFING: false + VISITOR_KEEP_INVENTORY: false COARSE_DIRT_TILLING: true ENDERMAN_GRIEFING: true CLEAN_SUPER_FLAT: false @@ -514,3 +537,4 @@ protection: do-not-edit-these-settings: # These settings should not be edited reset-epoch: 0 + diff --git a/src/test/java/world/bentobox/aoneblock/SettingsTest.java b/src/test/java/world/bentobox/aoneblock/SettingsTest.java index 96604316..693672f8 100644 --- a/src/test/java/world/bentobox/aoneblock/SettingsTest.java +++ b/src/test/java/world/bentobox/aoneblock/SettingsTest.java @@ -172,6 +172,14 @@ public void testIsNetherIslands() { assertFalse(s.isNetherIslands()); } + /** + * Test method for {@link world.bentobox.aoneblock.Settings#isNetherRoof()}. + */ + @Test + public void testIsNetherRoof() { + assertFalse(s.isNetherRoof()); + } + /** * Test method for {@link world.bentobox.aoneblock.Settings#getNetherSpawnRadius()}. */ @@ -570,6 +578,15 @@ public void testSetUseOwnGenerator() { assertTrue(s.isUseOwnGenerator()); } + /** + * Test method for {@link world.bentobox.aoneblock.Settings#setSeaHeight(int)}. + */ + @Test + public void testSetSeaHeight() { + s.setSeaHeight(12345); + assertEquals(12345, s.getSeaHeight()); + } + /** * Test method for {@link world.bentobox.aoneblock.Settings#setMaxIslands(int)}. */ @@ -599,6 +616,28 @@ public void testSetNetherGenerate() { assertTrue(s.isNetherGenerate()); } + /** + * Test method for {@link world.bentobox.aoneblock.Settings#setNetherIslands(boolean)}. + */ + @Test + public void testSetNetherIslands() { + s.setNetherIslands(false); + assertFalse(s.isNetherIslands()); + s.setNetherIslands(true); + assertTrue(s.isNetherIslands()); + } + + /** + * Test method for {@link world.bentobox.aoneblock.Settings#setNetherRoof(boolean)}. + */ + @Test + public void testSetNetherRoof() { + s.setNetherRoof(false); + assertFalse(s.isNetherRoof()); + s.setNetherRoof(true); + assertTrue(s.isNetherRoof()); + } + /** * Test method for {@link world.bentobox.aoneblock.Settings#setNetherSpawnRadius(int)}. */ @@ -619,6 +658,17 @@ public void testSetEndGenerate() { assertTrue(s.isEndGenerate()); } + /** + * Test method for {@link world.bentobox.aoneblock.Settings#setEndIslands(boolean)}. + */ + @Test + public void testSetEndIslands() { + s.setEndIslands(false); + assertFalse(s.isEndIslands()); + s.setEndIslands(true); + assertTrue(s.isEndIslands()); + } + /** * Test method for {@link world.bentobox.aoneblock.Settings#setRemoveMobsWhitelist(java.util.Set)}. */ @@ -1495,6 +1545,42 @@ public void testSetDropOnTop() { assertTrue(s.isDropOnTop()); } + /** + * Test method for {@link world.bentobox.aoneblock.Settings#getDefaultNetherBiome()}. + */ + @Test + public void testGetDefaultNetherBiome() { + assertEquals(Biome.NETHER_WASTES, s.getDefaultNetherBiome()); + } + + /** + * Test method for {@link world.bentobox.aoneblock.Settings#setDefaultNetherBiome(org.bukkit.block.Biome)}. + */ + @Test + public void testSetDefaultNetherBiome() { + assertEquals(Biome.NETHER_WASTES, s.getDefaultNetherBiome()); + s.setDefaultNetherBiome(Biome.BADLANDS); + assertEquals(Biome.BADLANDS, s.getDefaultNetherBiome()); + } + + /** + * Test method for {@link world.bentobox.aoneblock.Settings#getDefaultEndBiome()}. + */ + @Test + public void testGetDefaultEndBiome() { + assertEquals(Biome.THE_END, s.getDefaultEndBiome()); + } + + /** + * Test method for {@link world.bentobox.aoneblock.Settings#setDefaultEndBiome(org.bukkit.block.Biome)}. + */ + @Test + public void testSetDefaultEndBiome() { + assertEquals(Biome.THE_END, s.getDefaultEndBiome()); + s.setDefaultEndBiome(Biome.BADLANDS); + assertEquals(Biome.BADLANDS, s.getDefaultEndBiome()); + } + /** * Test method for {@link world.bentobox.aoneblock.Settings#isMakeNetherPortals()}. */ @@ -1619,4 +1705,4 @@ public void testSetRespawnBlockCommand() { assertEquals("respawn", s.getRespawnBlockCommand()); } -} +} \ No newline at end of file diff --git a/src/test/java/world/bentobox/aoneblock/listeners/JoinLeaveListenerTest.java b/src/test/java/world/bentobox/aoneblock/listeners/JoinLeaveListenerTest.java index 7a974071..e88d1269 100644 --- a/src/test/java/world/bentobox/aoneblock/listeners/JoinLeaveListenerTest.java +++ b/src/test/java/world/bentobox/aoneblock/listeners/JoinLeaveListenerTest.java @@ -1,10 +1,8 @@ package world.bentobox.aoneblock.listeners; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/src/test/java/world/bentobox/aoneblock/listeners/NoBlockHandlerTest.java b/src/test/java/world/bentobox/aoneblock/listeners/NoBlockHandlerTest.java index 2330dc99..10c4363c 100644 --- a/src/test/java/world/bentobox/aoneblock/listeners/NoBlockHandlerTest.java +++ b/src/test/java/world/bentobox/aoneblock/listeners/NoBlockHandlerTest.java @@ -1,6 +1,5 @@ package world.bentobox.aoneblock.listeners; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.never;