diff --git a/CLAUDE.md b/CLAUDE.md
index facb31c..3f278c6 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -60,3 +60,92 @@ Surefire is configured with `--add-opens` JVM args for Java 21 module access (ne
- `config.yml` — Default configuration (island settings, world properties, biomes, game rules)
- `locales/` — 22 language files
- `blueprints/` — Island blueprint `.blu` and `.json` files
+
+## Dependency Source Lookup
+
+When you need to inspect source code for a dependency (e.g., BentoBox, addons):
+
+1. **Check local Maven repo first**: `~/.m2/repository/` — sources jars are named `*-sources.jar`
+2. **Check the workspace**: Look for sibling directories or Git submodules that may contain the dependency as a local project (e.g., `../bentoBox`, `../addon-*`)
+3. **Check Maven local cache for already-extracted sources** before downloading anything
+4. Only download a jar or fetch from the internet if the above steps yield nothing useful
+
+Prefer reading `.java` source files directly from a local Git clone over decompiling or extracting a jar.
+
+In general, the latest version of BentoBox should be targeted.
+
+## Project Layout
+
+Related projects are checked out as siblings under `~/git/`:
+
+**Core:**
+- `bentobox/` — core BentoBox framework
+
+**Game modes:**
+- `addon-acidisland/` — AcidIsland game mode
+- `addon-bskyblock/` — BSkyBlock game mode
+- `Boxed/` — Boxed game mode (expandable box area)
+- `CaveBlock/` — CaveBlock game mode
+- `OneBlock/` — AOneBlock game mode
+- `SkyGrid/` — SkyGrid game mode
+- `RaftMode/` — Raft survival game mode
+- `StrangerRealms/` — StrangerRealms game mode
+- `Brix/` — plot game mode
+- `parkour/` — Parkour game mode
+- `poseidon/` — Poseidon game mode
+- `gg/` — gg game mode
+
+**Addons:**
+- `addon-level/` — island level calculation
+- `addon-challenges/` — challenges system
+- `addon-welcomewarpsigns/` — warp signs
+- `addon-limits/` — block/entity limits
+- `addon-invSwitcher/` / `invSwitcher/` — inventory switcher
+- `addon-biomes/` / `Biomes/` — biomes management
+- `Bank/` — island bank
+- `Border/` — world border for islands
+- `Chat/` — island chat
+- `CheckMeOut/` — island submission/voting
+- `ControlPanel/` — game mode control panel
+- `Converter/` — ASkyBlock to BSkyBlock converter
+- `DimensionalTrees/` — dimension-specific trees
+- `discordwebhook/` — Discord integration
+- `Downloads/` — BentoBox downloads site
+- `DragonFights/` — per-island ender dragon fights
+- `ExtraMobs/` — additional mob spawning rules
+- `FarmersDance/` — twerking crop growth
+- `GravityFlux/` — gravity addon
+- `Greenhouses-addon/` — greenhouse biomes
+- `IslandFly/` — island flight permission
+- `IslandRankup/` — island rankup system
+- `Likes/` — island likes/dislikes
+- `Limits/` — block/entity limits
+- `lost-sheep/` — lost sheep adventure
+- `MagicCobblestoneGenerator/` — custom cobblestone generator
+- `PortalStart/` — portal-based island start
+- `pp/` — pp addon
+- `Regionerator/` — region management
+- `Residence/` — residence addon
+- `TopBlock/` — top ten for OneBlock
+- `TwerkingForTrees/` — twerking tree growth
+- `Upgrades/` — island upgrades (Vault)
+- `Visit/` — island visiting
+- `weblink/` — web link addon
+- `CrowdBound/` — CrowdBound addon
+
+**Data packs:**
+- `BoxedDataPack/` — advancement datapack for Boxed
+
+**Documentation & tools:**
+- `docs/` — main documentation site
+- `docs-chinese/` — Chinese documentation
+- `docs-french/` — French documentation
+- `BentoBoxWorld.github.io/` — GitHub Pages site
+- `website/` — website
+- `translation-tool/` — translation tool
+
+Check these for source before any network fetch.
+
+## Key Dependencies (source locations)
+
+- `world.bentobox:bentobox` → `~/git/bentobox/src/`
diff --git a/README.md b/README.md
index b48819b..82abfed 100755
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
[](https://sonarcloud.io/summary/new_code?id=BentoBoxWorld_BSkyBlock)
[](https://sonarcloud.io/summary/new_code?id=BentoBoxWorld_BSkyBlock)
-
+
## About
Play SkyBlock with your friends! Don't fall! See the config.yml for all the settings. This is an addon for BentoBox.
diff --git a/pom.xml b/pom.xml
index 86e4bf2..0e2585f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,7 @@
-LOCAL
- 2.0.0
+ 1.20.0
BentoBoxWorld_BSkyBlock
bentobox-world
@@ -273,6 +273,7 @@
**/*Test??.java
+ ${argLine}
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.math=ALL-UNNAMED
--add-opens java.base/java.io=ALL-UNNAMED
@@ -345,7 +346,7 @@
org.jacoco
jacoco-maven-plugin
- 0.8.10
+ 0.8.13
true
diff --git a/src/main/java/world/bentobox/bskyblock/BSkyBlock.java b/src/main/java/world/bentobox/bskyblock/BSkyBlock.java
index 4cbf7e8..fa0bba2 100644
--- a/src/main/java/world/bentobox/bskyblock/BSkyBlock.java
+++ b/src/main/java/world/bentobox/bskyblock/BSkyBlock.java
@@ -3,7 +3,6 @@
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.WorldCreator;
-import org.bukkit.WorldType;
import org.bukkit.entity.SpawnCategory;
import org.bukkit.event.Listener;
import org.bukkit.generator.ChunkGenerator;
@@ -129,30 +128,33 @@ private World getWorld(String worldName2, Environment env, ChunkGeneratorWorld c
worldName2 = env.equals(World.Environment.THE_END) ? worldName2 + THE_END : worldName2;
WorldCreator wc = WorldCreator.name(worldName2).environment(env);
World w = settings.isUseOwnGenerator() ? wc.createWorld() : wc.generator(chunkGenerator2).createWorld();
- // Set spawn rates
- // Set spawn rates
- if (w != null && getSettings() != null) {
- if (getSettings().getSpawnLimitMonsters() > 0) {
- w.setSpawnLimit(SpawnCategory.MONSTER, getSettings().getSpawnLimitMonsters());
- }
- if (getSettings().getSpawnLimitAmbient() > 0) {
- w.setSpawnLimit(SpawnCategory.AMBIENT, getSettings().getSpawnLimitAmbient());
- }
- if (getSettings().getSpawnLimitAnimals() > 0) {
- w.setSpawnLimit(SpawnCategory.ANIMAL, getSettings().getSpawnLimitAnimals());
- }
- if (getSettings().getSpawnLimitWaterAnimals() > 0) {
- w.setSpawnLimit(SpawnCategory.WATER_ANIMAL, getSettings().getSpawnLimitWaterAnimals());
- }
- if (getSettings().getTicksPerAnimalSpawns() > 0) {
- w.setTicksPerSpawns(SpawnCategory.ANIMAL, getSettings().getTicksPerAnimalSpawns());
- }
- if (getSettings().getTicksPerMonsterSpawns() > 0) {
- w.setTicksPerSpawns(SpawnCategory.MONSTER, getSettings().getTicksPerMonsterSpawns());
- }
- }
+ applySpawnLimits(w);
return w;
+ }
+ private void applySpawnLimits(World w) {
+ if (w == null || getSettings() == null) {
+ return;
+ }
+ Settings s = getSettings();
+ if (s.getSpawnLimitMonsters() > 0) {
+ w.setSpawnLimit(SpawnCategory.MONSTER, s.getSpawnLimitMonsters());
+ }
+ if (s.getSpawnLimitAmbient() > 0) {
+ w.setSpawnLimit(SpawnCategory.AMBIENT, s.getSpawnLimitAmbient());
+ }
+ if (s.getSpawnLimitAnimals() > 0) {
+ w.setSpawnLimit(SpawnCategory.ANIMAL, s.getSpawnLimitAnimals());
+ }
+ if (s.getSpawnLimitWaterAnimals() > 0) {
+ w.setSpawnLimit(SpawnCategory.WATER_ANIMAL, s.getSpawnLimitWaterAnimals());
+ }
+ if (s.getTicksPerAnimalSpawns() > 0) {
+ w.setTicksPerSpawns(SpawnCategory.ANIMAL, s.getTicksPerAnimalSpawns());
+ }
+ if (s.getTicksPerMonsterSpawns() > 0) {
+ w.setTicksPerSpawns(SpawnCategory.MONSTER, s.getTicksPerMonsterSpawns());
+ }
}
@Override
diff --git a/src/main/java/world/bentobox/bskyblock/Settings.java b/src/main/java/world/bentobox/bskyblock/Settings.java
index 4eb7b1b..2f7342e 100644
--- a/src/main/java/world/bentobox/bskyblock/Settings.java
+++ b/src/main/java/world/bentobox/bskyblock/Settings.java
@@ -700,8 +700,10 @@ public Map getWorldFlags() {
/**
* @return the defaultIslandFlags
- * @deprecated since 1.21
+ * @deprecated since 1.21, kept for BentoBox API compatibility; use {@link #getDefaultIslandFlagNames()}.
*/
+ @SuppressWarnings("java:S1133")
+ @Deprecated(since = "1.21", forRemoval = true)
@Override
public Map getDefaultIslandFlags()
{
@@ -711,8 +713,10 @@ public Map getDefaultIslandFlags()
/**
* @return the defaultIslandSettings
- * @deprecated since 1.21
+ * @deprecated since 1.21, kept for BentoBox API compatibility; use {@link #getDefaultIslandSettingNames()}.
*/
+ @SuppressWarnings("java:S1133")
+ @Deprecated(since = "1.21", forRemoval = true)
@Override
public Map getDefaultIslandSettings()
{
diff --git a/src/main/java/world/bentobox/bskyblock/commands/IslandAboutCommand.java b/src/main/java/world/bentobox/bskyblock/commands/IslandAboutCommand.java
index 1406333..191d7dd 100644
--- a/src/main/java/world/bentobox/bskyblock/commands/IslandAboutCommand.java
+++ b/src/main/java/world/bentobox/bskyblock/commands/IslandAboutCommand.java
@@ -23,7 +23,7 @@ public void setup() {
@Override
public boolean execute(User user, String label, List args) {
user.sendRawMessage("About " + getAddon().getDescription().getName() + " " + getAddon().getDescription().getVersion() + ":");
- user.sendRawMessage("Copyright (c) 2017 - 2022 tastybento, Poslovitch");
+ user.sendRawMessage("Copyright (c) 2017 - 2026 tastybento, others");
user.sendRawMessage("See https://www.eclipse.org/legal/epl-2.0/");
user.sendRawMessage("for license information.");
return true;
diff --git a/src/main/java/world/bentobox/bskyblock/generators/ChunkGeneratorWorld.java b/src/main/java/world/bentobox/bskyblock/generators/ChunkGeneratorWorld.java
index 5181d84..9ad9020 100644
--- a/src/main/java/world/bentobox/bskyblock/generators/ChunkGeneratorWorld.java
+++ b/src/main/java/world/bentobox/bskyblock/generators/ChunkGeneratorWorld.java
@@ -10,12 +10,14 @@
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
+import org.bukkit.generator.BiomeProvider;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.generator.WorldInfo;
import org.bukkit.util.Vector;
import org.bukkit.util.noise.PerlinOctaveGenerator;
+import org.jspecify.annotations.NonNull;
import world.bentobox.bskyblock.BSkyBlock;
/**
@@ -38,55 +40,56 @@ public ChunkGeneratorWorld(BSkyBlock addon) {
}
@Override
- public boolean shouldGenerateStructures() {
+ public boolean shouldGenerateStructures(@NonNull WorldInfo worldInfo, @NonNull Random random, int chunkX, int chunkZ) {
return false;
-
}
- public ChunkData generateChunks(World world) {
- ChunkData result = createChunkData(world);
- if (world.getEnvironment().equals(Environment.NORMAL) && addon.getSettings().getSeaHeight() > 0) {
- result.setRegion(0, world.getMinHeight(), 0, 16, addon.getSettings().getSeaHeight() + 1, 16, Material.WATER);
+ @Override
+ public void generateNoise(@NonNull WorldInfo worldInfo, @NonNull Random random, int chunkX, int chunkZ, @NonNull ChunkData chunkData) {
+ if (worldInfo.getEnvironment() == Environment.NORMAL && addon.getSettings().getSeaHeight() > 0) {
+ chunkData.setRegion(0, worldInfo.getMinHeight(), 0, 16, addon.getSettings().getSeaHeight() + 1, 16, Material.WATER);
}
- if (world.getEnvironment().equals(Environment.NETHER) && addon.getSettings().isNetherRoof()) {
- roofChunk.forEach((k,v) -> result.setBlock(k.getBlockX(), world.getMaxHeight() + k.getBlockY(), k.getBlockZ(), v));
+ if (worldInfo.getEnvironment() == Environment.NETHER && addon.getSettings().isNetherRoof()) {
+ roofChunk.forEach((k, v) -> chunkData.setBlock(k.getBlockX(), worldInfo.getMaxHeight() + k.getBlockY(), k.getBlockZ(), v));
}
- return result;
}
@Override
- public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, BiomeGrid biomeGrid) {
- setBiome(world, biomeGrid);
- return generateChunks(world);
- }
+ public BiomeProvider getDefaultBiomeProvider(@NonNull WorldInfo worldInfo) {
+ return new BiomeProvider() {
+ @Override
+ public @NonNull Biome getBiome(@NonNull WorldInfo worldInfo, int x, int y, int z) {
+ return defaultBiomeFor(worldInfo.getEnvironment());
+ }
- private void setBiome(World world, BiomeGrid biomeGrid) {
- Biome biome = world.getEnvironment() == Environment.NORMAL ? addon.getSettings().getDefaultBiome() :
- world.getEnvironment() == Environment.NETHER ? addon.getSettings().getDefaultNetherBiome() : addon.getSettings().getDefaultEndBiome();
- for (int x = 0; x < 16; x+=4) {
- for (int z = 0; z < 16; z+=4) {
- for (int y = world.getMinHeight(); y < world.getMaxHeight(); y+=4) {
- biomeGrid.setBiome(x, y, z, biome);
- }
- }
+ @Override
+ public @NonNull List getBiomes(@NonNull WorldInfo worldInfo) {
+ return List.of(defaultBiomeFor(worldInfo.getEnvironment()));
}
+ };
+ }
+ private Biome defaultBiomeFor(Environment env) {
+ return switch (env) {
+ case NORMAL -> addon.getSettings().getDefaultBiome();
+ case NETHER -> addon.getSettings().getDefaultNetherBiome();
+ default -> addon.getSettings().getDefaultEndBiome();
+ };
}
- // This needs to be set to return true to override minecraft's default
- // behavior
+ // This needs to be set to return true to override minecraft's default behavior
@Override
- public boolean canSpawn(World world, int x, int z) {
+ public boolean canSpawn(@NonNull World world, int x, int z) {
return true;
}
@Override
- public boolean shouldGenerateMobs(WorldInfo worldInfo, Random random, int chunkX, int chunkZ){
+ public boolean shouldGenerateMobs(@NonNull WorldInfo worldInfo, @NonNull Random random, int chunkX, int chunkZ) {
return true;
}
@Override
- public List getDefaultPopulators(final World world) {
+ public @NonNull List getDefaultPopulators(final @NonNull World world) {
return Collections.emptyList();
}
@@ -100,64 +103,66 @@ private void makeNetherRoof() {
// Make the roof - common across the world
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
- // Do the ceiling
- setBlock(x, -1, z, Material.BEDROCK);
- // Next three layers are a mix of bedrock and netherrack
- for (int y = 2; y < 5; y++) {
- double r = gen.noise(x, - y, z, 0.5, 0.5);
- if (r > 0D) {
- setBlock(x, - y, z, Material.BEDROCK);
- }
- }
- // Next three layers are a mix of netherrack and air
- for (int y = 5; y < 8; y++) {
- double r = gen.noise(x, - y, z, 0.5, 0.5);
- if (r > 0D) {
- setBlock(x, -y, z, Material.NETHERRACK);
- } else {
- setBlock(x, -y, z, Material.AIR);
- }
- }
- // Layer 8 may be glowstone
- double r = gen.noise(x, - 8, z, rand.nextFloat(), rand.nextFloat());
- if (r > 0.5D) {
- // Have blobs of glowstone
- switch (rand.nextInt(4)) {
- case 1:
- // Single block
- setBlock(x, -8, z, Material.GLOWSTONE);
- if (x < 14 && z < 14) {
- setBlock(x + 1, -8, z + 1, Material.GLOWSTONE);
- setBlock(x + 2, -8, z + 2, Material.GLOWSTONE);
- setBlock(x + 1, -8, z + 2, Material.GLOWSTONE);
- setBlock(x + 1, -8, z + 2, Material.GLOWSTONE);
- }
- break;
- case 2:
- // Stalactite
- for (int i = 0; i < rand.nextInt(10); i++) {
- setBlock(x, - 8 - i, z, Material.GLOWSTONE);
- }
- break;
- case 3:
- setBlock(x, -8, z, Material.GLOWSTONE);
- if (x > 3 && z > 3) {
- for (int xx = 0; xx < 3; xx++) {
- for (int zz = 0; zz < 3; zz++) {
- setBlock(x - xx, - 8 - rand.nextInt(2), z - xx, Material.GLOWSTONE);
- }
- }
- }
- break;
- default:
- setBlock(x, -8, z, Material.GLOWSTONE);
- }
- setBlock(x, -8, z, Material.GLOWSTONE);
- } else {
- setBlock(x, -8, z, Material.AIR);
- }
+ fillRoofColumn(gen, x, z);
}
+ }
+ }
+
+ private void fillRoofColumn(PerlinOctaveGenerator gen, int x, int z) {
+ // Ceiling
+ setBlock(x, -1, z, Material.BEDROCK);
+ // Bedrock/netherrack mix
+ for (int y = 2; y < 5; y++) {
+ if (gen.noise(x, -y, z, 0.5, 0.5) > 0D) {
+ setBlock(x, -y, z, Material.BEDROCK);
+ }
+ }
+ // Netherrack/air mix
+ for (int y = 5; y < 8; y++) {
+ Material m = gen.noise(x, -y, z, 0.5, 0.5) > 0D ? Material.NETHERRACK : Material.AIR;
+ setBlock(x, -y, z, m);
+ }
+ // Layer 8 may be glowstone
+ if (gen.noise(x, -8, z, rand.nextFloat(), rand.nextFloat()) > 0.5D) {
+ placeGlowstoneBlob(x, z);
+ } else {
+ setBlock(x, -8, z, Material.AIR);
+ }
+ }
+
+ private void placeGlowstoneBlob(int x, int z) {
+ switch (rand.nextInt(4)) {
+ case 1 -> placeGlowstoneCluster(x, z);
+ case 2 -> placeGlowstoneStalactite(x, z);
+ case 3 -> placeGlowstonePatch(x, z);
+ default -> setBlock(x, -8, z, Material.GLOWSTONE);
+ }
+ setBlock(x, -8, z, Material.GLOWSTONE);
+ }
+
+ private void placeGlowstoneCluster(int x, int z) {
+ setBlock(x, -8, z, Material.GLOWSTONE);
+ if (x < 14 && z < 14) {
+ setBlock(x + 1, -8, z + 1, Material.GLOWSTONE);
+ setBlock(x + 2, -8, z + 2, Material.GLOWSTONE);
+ setBlock(x + 1, -8, z + 2, Material.GLOWSTONE);
+ }
+ }
+ private void placeGlowstoneStalactite(int x, int z) {
+ for (int i = 0; i < rand.nextInt(10); i++) {
+ setBlock(x, -8 - i, z, Material.GLOWSTONE);
+ }
+ }
+
+ private void placeGlowstonePatch(int x, int z) {
+ setBlock(x, -8, z, Material.GLOWSTONE);
+ if (x > 3 && z > 3) {
+ for (int xx = 0; xx < 3; xx++) {
+ for (int zz = 0; zz < 3; zz++) {
+ setBlock(x - xx, -8 - rand.nextInt(2), z - zz, Material.GLOWSTONE);
+ }
+ }
}
}
diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml
index 957b5d3..6395838 100755
--- a/src/main/resources/addon.yml
+++ b/src/main/resources/addon.yml
@@ -1,7 +1,7 @@
name: BSkyBlock
main: world.bentobox.bskyblock.BSkyBlock
version: ${version}${build.number}
-api-version: 2.7.1
+api-version: 3.13.0
metrics: true
icon: "OAK_SAPLING"
repository: "BentoBoxWorld/BSkyBlock"
diff --git a/src/main/resources/locales/cs.yml b/src/main/resources/locales/cs.yml
index 31e9980..398630f 100644
--- a/src/main/resources/locales/cs.yml
+++ b/src/main/resources/locales/cs.yml
@@ -10,4 +10,4 @@ bskyblock:
line0: '&cBSkyBlock'
line1: Vítej!
line2: '[name]'
- line3: Nespadni! &c<3
+ line3: Nespadni! <3
diff --git a/src/main/resources/locales/de.yml b/src/main/resources/locales/de.yml
index 0abb2d3..96983a2 100644
--- a/src/main/resources/locales/de.yml
+++ b/src/main/resources/locales/de.yml
@@ -1,7 +1,7 @@
---
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: Herzlich Willkommen!
line2: "[name]"
- line3: Fall nicht runter! &c<3
+ line3: Fall nicht runter! <3
diff --git a/src/main/resources/locales/en-US.yml b/src/main/resources/locales/en-US.yml
index 42e0ff6..64ee877 100755
--- a/src/main/resources/locales/en-US.yml
+++ b/src/main/resources/locales/en-US.yml
@@ -5,8 +5,8 @@
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: "Welcome!"
line2: "[name]"
- line3: "Do not fall! &c<3"
+ line3: "Do not fall! <3"
\ No newline at end of file
diff --git a/src/main/resources/locales/es.yml b/src/main/resources/locales/es.yml
index b662d2e..0e47e9a 100644
--- a/src/main/resources/locales/es.yml
+++ b/src/main/resources/locales/es.yml
@@ -5,7 +5,7 @@
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: "Bienvenido!"
line2: "[name]"
- line3: "No te caigas! &c<3"
+ line3: "No te caigas! <3"
diff --git a/src/main/resources/locales/fr.yml b/src/main/resources/locales/fr.yml
index 3474dbb..e2c4b4a 100644
--- a/src/main/resources/locales/fr.yml
+++ b/src/main/resources/locales/fr.yml
@@ -1,10 +1,10 @@
---
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: Bienvenue!
line2: "[name]"
- line3: Ne tombez pas ! &c<3
+ line3: Ne tombez pas ! <3
meta:
authors:
- x9nico
diff --git a/src/main/resources/locales/hu.yml b/src/main/resources/locales/hu.yml
index 0e54a60..dcdfcbf 100644
--- a/src/main/resources/locales/hu.yml
+++ b/src/main/resources/locales/hu.yml
@@ -1,7 +1,7 @@
---
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: Üdvözöljük!
line2: "[name]"
- line3: Ne ess le! &c<3
+ line3: Ne ess le! <3
diff --git a/src/main/resources/locales/id.yml b/src/main/resources/locales/id.yml
index 49c48f7..0c0b09f 100644
--- a/src/main/resources/locales/id.yml
+++ b/src/main/resources/locales/id.yml
@@ -5,7 +5,7 @@
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line2: "[name]"
line3: 'Jangan jatuh! '
line1: Selamat datang!
diff --git a/src/main/resources/locales/it.yml b/src/main/resources/locales/it.yml
index 030059d..7269a32 100644
--- a/src/main/resources/locales/it.yml
+++ b/src/main/resources/locales/it.yml
@@ -1,6 +1,6 @@
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: "Benvenuto/a!"
line2: "[name]"
- line3: "Non cadere! &c<3"
+ line3: "Non cadere! <3"
diff --git a/src/main/resources/locales/ja.yml b/src/main/resources/locales/ja.yml
index ad964f2..6617a69 100644
--- a/src/main/resources/locales/ja.yml
+++ b/src/main/resources/locales/ja.yml
@@ -1,6 +1,6 @@
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line2: "[name]"
line3: 落ちるな!
line1: ようこそ!
diff --git a/src/main/resources/locales/ko.yml b/src/main/resources/locales/ko.yml
index 420b362..fe9f3ff 100644
--- a/src/main/resources/locales/ko.yml
+++ b/src/main/resources/locales/ko.yml
@@ -1,6 +1,6 @@
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line2: "[name]"
line3: '떨어지지 마! '
line1: 환영!
diff --git a/src/main/resources/locales/lv.yml b/src/main/resources/locales/lv.yml
index deaafde..b7a7d86 100644
--- a/src/main/resources/locales/lv.yml
+++ b/src/main/resources/locales/lv.yml
@@ -1,6 +1,6 @@
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: Sveicināts!
line2: "[name]"
- line3: Nenokrīti! &c<3
+ line3: Nenokrīti! <3
diff --git a/src/main/resources/locales/nl.yml b/src/main/resources/locales/nl.yml
index 1cccf59..9a2ad8f 100644
--- a/src/main/resources/locales/nl.yml
+++ b/src/main/resources/locales/nl.yml
@@ -5,7 +5,7 @@
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: "Welkom!"
line2: "[name]"
- line3: "Val niet! &c<3"
+ line3: "Val niet! <3"
diff --git a/src/main/resources/locales/pl.yml b/src/main/resources/locales/pl.yml
index 127c7c8..5c40267 100644
--- a/src/main/resources/locales/pl.yml
+++ b/src/main/resources/locales/pl.yml
@@ -5,8 +5,8 @@
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: "Witaj!"
line2: "[name]"
- line3: "Nie spadnij! &c<3"
+ line3: "Nie spadnij! <3"
diff --git a/src/main/resources/locales/pt.yml b/src/main/resources/locales/pt.yml
index 4b34d1f..ef8ea93 100644
--- a/src/main/resources/locales/pt.yml
+++ b/src/main/resources/locales/pt.yml
@@ -1,7 +1,7 @@
---
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: Bem vindo(a)!
line2: "[name]"
- line3: Não caia! &c<3
+ line3: Não caia! <3
diff --git a/src/main/resources/locales/ro.yml b/src/main/resources/locales/ro.yml
index a2d6b33..d4222c8 100644
--- a/src/main/resources/locales/ro.yml
+++ b/src/main/resources/locales/ro.yml
@@ -1,8 +1,8 @@
---
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: "Bine ai venit!"
line2: "[name]"
- line3: "Sa nu cazi! &c<3"
+ line3: "Sa nu cazi! <3"
diff --git a/src/main/resources/locales/ru.yml b/src/main/resources/locales/ru.yml
index 1bb5b0f..58b1e3f 100644
--- a/src/main/resources/locales/ru.yml
+++ b/src/main/resources/locales/ru.yml
@@ -1,7 +1,11 @@
----
+# ######################################################################################## #
+# Это YML файл. Будьте осторожны при редактировании. Проверяйте свои правки #
+# в YAML валидаторе, например, на http://yaml-online-parser.appspot.com #
+# ######################################################################################## #
+
bskyblock:
sign:
- line0: "&cBSkyBlock"
- line1: Добро пожаловать!
- line2: "[name]"
- line3: Не падай! &c <3
+ line0: 'BSkyBlock'
+ line1: Приветствуем!
+ line2: '[name]'
+ line3: Не падай! <3
diff --git a/src/main/resources/locales/tr.yml b/src/main/resources/locales/tr.yml
index 8b0c5de..cff4222 100644
--- a/src/main/resources/locales/tr.yml
+++ b/src/main/resources/locales/tr.yml
@@ -1,7 +1,7 @@
---
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: Hoş Geldin!
line2: "[name]"
- line3: Aşağı Düşme! &c<3
+ line3: Aşağı Düşme! <3
diff --git a/src/main/resources/locales/vi.yml b/src/main/resources/locales/vi.yml
index e290d78..32dec06 100644
--- a/src/main/resources/locales/vi.yml
+++ b/src/main/resources/locales/vi.yml
@@ -1,7 +1,7 @@
---
bskyblock:
sign:
- line0: "&cBSkyBlock"
+ line0: "BSkyBlock"
line1: Chào mừng!
line2: "[Tên]"
- line3: Đừng ngã xuống! &c<3
+ line3: Đừng ngã xuống! <3
diff --git a/src/main/resources/locales/zh-CN.yml b/src/main/resources/locales/zh-CN.yml
index 4d14bdb..2c70cfc 100644
--- a/src/main/resources/locales/zh-CN.yml
+++ b/src/main/resources/locales/zh-CN.yml
@@ -1,7 +1,7 @@
---
bskyblock:
sign:
- line0: "&c空岛生存"
+ line0: "空岛生存"
line1: 欢迎你来到这里!
line2: "[name]"
- line3: 千万不要掉下去! &c<3
+ line3: 千万不要掉下去! <3
diff --git a/src/main/resources/locales/zh-TW.yml b/src/main/resources/locales/zh-TW.yml
index 436a734..8187314 100644
--- a/src/main/resources/locales/zh-TW.yml
+++ b/src/main/resources/locales/zh-TW.yml
@@ -1,7 +1,7 @@
---
bskyblock:
sign:
- line0: "&c空島生存"
+ line0: "空島生存"
line1: 歡迎!
line2: "[name]"
- line3: 小心不要掉下去喔! &c<3
+ line3: 小心不要掉下去喔! <3
diff --git a/src/test/java/world/bentobox/bskyblock/BSkyBlockTest.java b/src/test/java/world/bentobox/bskyblock/BSkyBlockTest.java
index d42d45d..2448d9e 100644
--- a/src/test/java/world/bentobox/bskyblock/BSkyBlockTest.java
+++ b/src/test/java/world/bentobox/bskyblock/BSkyBlockTest.java
@@ -43,7 +43,7 @@
* @author tastybento
*
*/
-public class BSkyBlockTest extends CommonTestSetup {
+class BSkyBlockTest extends CommonTestSetup {
@Mock
private User user;
diff --git a/src/test/java/world/bentobox/bskyblock/CommonTestSetup.java b/src/test/java/world/bentobox/bskyblock/CommonTestSetup.java
index 5ca1122..533e810 100644
--- a/src/test/java/world/bentobox/bskyblock/CommonTestSetup.java
+++ b/src/test/java/world/bentobox/bskyblock/CommonTestSetup.java
@@ -31,7 +31,6 @@
import org.bukkit.inventory.ItemFactory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
-import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.PluginManager;
import org.bukkit.scheduler.BukkitScheduler;
@@ -131,6 +130,7 @@ public abstract class CommonTestSetup {
@BeforeEach
+ @SuppressWarnings("java:S1130") // subclasses override and need to throw checked exceptions
public void setUp() throws Exception {
// Processes the @Mock annotations and initializes the field
closeable = MockitoAnnotations.openMocks(this);
@@ -206,7 +206,8 @@ public void setUp() throws Exception {
when(island.getMemberSet()).thenReturn(ImmutableSet.of(uuid));
// Enable reporting from Flags class
- MetadataValue mdv = new FixedMetadataValue(plugin, "_why_debug");
+ MetadataValue mdv = mock(MetadataValue.class);
+ when(mdv.asString()).thenReturn("_why_debug");
when(mockPlayer.getMetadata(anyString())).thenReturn(Collections.singletonList(mdv));
// Locales & Placeholders
@@ -228,9 +229,7 @@ public void setUp() throws Exception {
// Util
mockedUtil.when(() -> Util.findFirstMatchingEnum(any(), any())).thenCallRealMethod();
- // Util translate color codes (used in user translate methods)
- //mockedUtil.when(() -> translateColorCodes(anyString())).thenAnswer((Answer) invocation -> invocation.getArgument(0, String.class));
-
+
// Server & Scheduler
mockedBukkit.when(Bukkit::getScheduler).thenReturn(sch);
@@ -285,7 +284,7 @@ public void checkSpigotMessage(String expectedMessage, int expectedOccurrences)
List capturedMessages = captor.getAllValues();
// Count the number of occurrences of the expectedMessage in the captured messages
- long actualOccurrences = capturedMessages.stream().map(component -> component.toLegacyText()) // Convert each TextComponent to plain text
+ long actualOccurrences = capturedMessages.stream().map(component -> component.toLegacyText()) // NOSONAR Convert each TextComponent to plain text
.filter(messageText -> messageText.contains(expectedMessage)) // Check if the message contains the expected text
.count(); // Count how many times the expected message appears
@@ -302,10 +301,10 @@ public void checkSpigotMessage(String expectedMessage, int expectedOccurrences)
* @return
*/
public EntityExplodeEvent getExplodeEvent(Entity entity, Location l, List list) {
- //return new EntityExplodeEvent(entity, l, list, 0, null);
return new EntityExplodeEvent(entity, l, list, 0, null);
}
+ @SuppressWarnings({"deprecation", "removal"})
public PlayerDeathEvent getPlayerDeathEvent(Player player, List drops, int droppedExp, int newExp,
int newTotalExp, int newLevel, @Nullable String deathMessage) {
//Technically this null is not allowed, but it works right now
diff --git a/src/test/java/world/bentobox/bskyblock/SettingsTest.java b/src/test/java/world/bentobox/bskyblock/SettingsTest.java
index 2a4afbd..bb480ec 100644
--- a/src/test/java/world/bentobox/bskyblock/SettingsTest.java
+++ b/src/test/java/world/bentobox/bskyblock/SettingsTest.java
@@ -21,7 +21,7 @@
* @author tastybento
*
*/
-public class SettingsTest extends CommonTestSetup {
+class SettingsTest extends CommonTestSetup {
Settings s;
@@ -45,7 +45,7 @@ public void tearDown() throws Exception {
* Test method for {@link world.bentobox.bskyblock.Settings#setFriendlyName(java.lang.String)}.
*/
@Test
- public void testSetFriendlyName() {
+ void testSetFriendlyName() {
s.setFriendlyName("name");
assertEquals("name", s.getFriendlyName());
}
@@ -54,7 +54,7 @@ public void testSetFriendlyName() {
* Test method for {@link world.bentobox.bskyblock.Settings#setWorldName(java.lang.String)}.
*/
@Test
- public void testSetWorldName() {
+ void testSetWorldName() {
s.setWorldName("name");
assertEquals("name", s.getWorldName());
}
@@ -63,7 +63,7 @@ public void testSetWorldName() {
* Test method for {@link world.bentobox.bskyblock.Settings#setDifficulty(org.bukkit.Difficulty)}.
*/
@Test
- public void testSetDifficulty() {
+ void testSetDifficulty() {
s.setDifficulty(Difficulty.PEACEFUL);
assertEquals(Difficulty.PEACEFUL, s.getDifficulty());
}
@@ -72,7 +72,7 @@ public void testSetDifficulty() {
* Test method for {@link world.bentobox.bskyblock.Settings#setIslandDistance(int)}.
*/
@Test
- public void testSetIslandDistance() {
+ void testSetIslandDistance() {
s.setIslandDistance(123);
assertEquals(123, s.getIslandDistance());
}
@@ -81,7 +81,7 @@ public void testSetIslandDistance() {
* Test method for {@link world.bentobox.bskyblock.Settings#setIslandProtectionRange(int)}.
*/
@Test
- public void testSetIslandProtectionRange() {
+ void testSetIslandProtectionRange() {
s.setIslandProtectionRange(123);
assertEquals(123, s.getIslandProtectionRange());
}
@@ -90,7 +90,7 @@ public void testSetIslandProtectionRange() {
* Test method for {@link world.bentobox.bskyblock.Settings#setIslandStartX(int)}.
*/
@Test
- public void testSetIslandStartX() {
+ void testSetIslandStartX() {
s.setIslandStartX(123);
assertEquals(123, s.getIslandStartX());
}
@@ -99,7 +99,7 @@ public void testSetIslandStartX() {
* Test method for {@link world.bentobox.bskyblock.Settings#setIslandStartZ(int)}.
*/
@Test
- public void testSetIslandStartZ() {
+ void testSetIslandStartZ() {
s.setIslandStartZ(123);
assertEquals(123, s.getIslandStartZ());
}
@@ -108,7 +108,7 @@ public void testSetIslandStartZ() {
* Test method for {@link world.bentobox.bskyblock.Settings#setIslandXOffset(int)}.
*/
@Test
- public void testSetIslandXOffset() {
+ void testSetIslandXOffset() {
s.setIslandXOffset(123);
assertEquals(123, s.getIslandXOffset());
}
@@ -117,7 +117,7 @@ public void testSetIslandXOffset() {
* Test method for {@link world.bentobox.bskyblock.Settings#setIslandZOffset(int)}.
*/
@Test
- public void testSetIslandZOffset() {
+ void testSetIslandZOffset() {
s.setIslandZOffset(123);
assertEquals(123, s.getIslandZOffset());
}
@@ -126,7 +126,7 @@ public void testSetIslandZOffset() {
* Test method for {@link world.bentobox.bskyblock.Settings#setIslandHeight(int)}.
*/
@Test
- public void testSetIslandHeight() {
+ void testSetIslandHeight() {
s.setIslandHeight(123);
assertEquals(123, s.getIslandHeight());
}
@@ -135,7 +135,7 @@ public void testSetIslandHeight() {
* Test method for {@link world.bentobox.bskyblock.Settings#setUseOwnGenerator(boolean)}.
*/
@Test
- public void testSetUseOwnGenerator() {
+ void testSetUseOwnGenerator() {
s.setUseOwnGenerator(true);
assertTrue(s.isUseOwnGenerator());
}
@@ -144,7 +144,7 @@ public void testSetUseOwnGenerator() {
* Test method for {@link world.bentobox.bskyblock.Settings#setSeaHeight(int)}.
*/
@Test
- public void testSetSeaHeight() {
+ void testSetSeaHeight() {
s.setSeaHeight(123);
assertEquals(123, s.getSeaHeight());
}
@@ -153,7 +153,7 @@ public void testSetSeaHeight() {
* Test method for {@link world.bentobox.bskyblock.Settings#setMaxIslands(int)}.
*/
@Test
- public void testSetMaxIslands() {
+ void testSetMaxIslands() {
s.setMaxIslands(123);
assertEquals(123, s.getMaxIslands());
}
@@ -162,7 +162,7 @@ public void testSetMaxIslands() {
* Test method for {@link world.bentobox.bskyblock.Settings#setDefaultGameMode(org.bukkit.GameMode)}.
*/
@Test
- public void testSetDefaultGameMode() {
+ void testSetDefaultGameMode() {
s.setDefaultGameMode(GameMode.CREATIVE);
assertEquals(GameMode.CREATIVE, s.getDefaultGameMode());
}
@@ -171,7 +171,7 @@ public void testSetDefaultGameMode() {
* Test method for {@link world.bentobox.bskyblock.Settings#setNetherGenerate(boolean)}.
*/
@Test
- public void testSetNetherGenerate() {
+ void testSetNetherGenerate() {
s.setNetherGenerate(true);
assertTrue(s.isNetherGenerate());
}
@@ -180,7 +180,7 @@ public void testSetNetherGenerate() {
* Test method for {@link world.bentobox.bskyblock.Settings#setNetherIslands(boolean)}.
*/
@Test
- public void testSetNetherIslands() {
+ void testSetNetherIslands() {
s.setNetherIslands(true);
assertTrue(s.isNetherIslands());
}
@@ -189,7 +189,7 @@ public void testSetNetherIslands() {
* Test method for {@link world.bentobox.bskyblock.Settings#setNetherRoof(boolean)}.
*/
@Test
- public void testSetNetherRoof() {
+ void testSetNetherRoof() {
s.setNetherRoof(true);
assertTrue(s.isNetherRoof());
}
@@ -198,7 +198,7 @@ public void testSetNetherRoof() {
* Test method for {@link world.bentobox.bskyblock.Settings#setNetherSpawnRadius(int)}.
*/
@Test
- public void testSetNetherSpawnRadius() {
+ void testSetNetherSpawnRadius() {
s.setNetherSpawnRadius(123);
assertEquals(123, s.getNetherSpawnRadius());
}
@@ -207,7 +207,7 @@ public void testSetNetherSpawnRadius() {
* Test method for {@link world.bentobox.bskyblock.Settings#setEndGenerate(boolean)}.
*/
@Test
- public void testSetEndGenerate() {
+ void testSetEndGenerate() {
s.setEndGenerate(true);
assertTrue(s.isEndGenerate());
}
@@ -216,7 +216,7 @@ public void testSetEndGenerate() {
* Test method for {@link world.bentobox.bskyblock.Settings#setEndIslands(boolean)}.
*/
@Test
- public void testSetEndIslands() {
+ void testSetEndIslands() {
s.setEndIslands(true);
assertTrue(s.isEndIslands());
}
@@ -225,7 +225,7 @@ public void testSetEndIslands() {
* Test method for {@link world.bentobox.bskyblock.Settings#setDragonSpawn(boolean)}.
*/
@Test
- public void testSetDragonSpawn() {
+ void testSetDragonSpawn() {
s.setDragonSpawn(true);
assertTrue(s.isDragonSpawn());
}
@@ -234,7 +234,7 @@ public void testSetDragonSpawn() {
* Test method for {@link world.bentobox.bskyblock.Settings#setRemoveMobsWhitelist(java.util.Set)}.
*/
@Test
- public void testSetRemoveMobsWhitelist() {
+ void testSetRemoveMobsWhitelist() {
Set wl = Collections.emptySet();
s.setRemoveMobsWhitelist(wl);
assertEquals(wl, s.getRemoveMobsWhitelist());
@@ -244,7 +244,7 @@ public void testSetRemoveMobsWhitelist() {
* Test method for {@link world.bentobox.bskyblock.Settings#setWorldFlags(java.util.Map)}.
*/
@Test
- public void testSetWorldFlags() {
+ void testSetWorldFlags() {
Map worldFlags = Collections.emptyMap();
s.setWorldFlags(worldFlags);
assertEquals(worldFlags, s.getWorldFlags());
@@ -254,7 +254,7 @@ public void testSetWorldFlags() {
* Test method for {@link world.bentobox.bskyblock.Settings#setHiddenFlags(java.util.List)}.
*/
@Test
- public void testSetVisibleSettings() {
+ void testSetVisibleSettings() {
List visibleSettings = Collections.emptyList();
s.setHiddenFlags(visibleSettings);
assertEquals(visibleSettings, s.getHiddenFlags());
@@ -264,7 +264,7 @@ public void testSetVisibleSettings() {
* Test method for {@link world.bentobox.bskyblock.Settings#setVisitorBannedCommands(java.util.List)}.
*/
@Test
- public void testSetVisitorBannedCommands() {
+ void testSetVisitorBannedCommands() {
List visitorBannedCommands = Collections.emptyList();
s.setVisitorBannedCommands(visitorBannedCommands);
assertEquals(visitorBannedCommands, s.getVisitorBannedCommands());
@@ -274,7 +274,7 @@ public void testSetVisitorBannedCommands() {
* Test method for {@link world.bentobox.bskyblock.Settings#setMaxTeamSize(int)}.
*/
@Test
- public void testSetMaxTeamSize() {
+ void testSetMaxTeamSize() {
s.setMaxTeamSize(123);
assertEquals(123, s.getMaxTeamSize());
}
@@ -283,7 +283,7 @@ public void testSetMaxTeamSize() {
* Test method for {@link world.bentobox.bskyblock.Settings#setMaxHomes(int)}.
*/
@Test
- public void testSetMaxHomes() {
+ void testSetMaxHomes() {
s.setMaxHomes(123);
assertEquals(123, s.getMaxHomes());
}
@@ -292,7 +292,7 @@ public void testSetMaxHomes() {
* Test method for {@link world.bentobox.bskyblock.Settings#setResetLimit(int)}.
*/
@Test
- public void testSetResetLimit() {
+ void testSetResetLimit() {
s.setResetLimit(123);
assertEquals(123, s.getResetLimit());
}
@@ -301,7 +301,7 @@ public void testSetResetLimit() {
* Test method for {@link world.bentobox.bskyblock.Settings#setLeaversLoseReset(boolean)}.
*/
@Test
- public void testSetLeaversLoseReset() {
+ void testSetLeaversLoseReset() {
s.setLeaversLoseReset(true);
assertTrue(s.isLeaversLoseReset());
}
@@ -310,7 +310,7 @@ public void testSetLeaversLoseReset() {
* Test method for {@link world.bentobox.bskyblock.Settings#setKickedKeepInventory(boolean)}.
*/
@Test
- public void testSetKickedKeepInventory() {
+ void testSetKickedKeepInventory() {
s.setKickedKeepInventory(true);
assertTrue(s.isKickedKeepInventory());
}
@@ -319,7 +319,7 @@ public void testSetKickedKeepInventory() {
* Test method for {@link world.bentobox.bskyblock.Settings#setOnJoinResetMoney(boolean)}.
*/
@Test
- public void testSetOnJoinResetMoney() {
+ void testSetOnJoinResetMoney() {
s.setOnJoinResetMoney(true);
assertTrue(s.isOnJoinResetMoney());
}
@@ -328,7 +328,7 @@ public void testSetOnJoinResetMoney() {
* Test method for {@link world.bentobox.bskyblock.Settings#setOnJoinResetInventory(boolean)}.
*/
@Test
- public void testSetOnJoinResetInventory() {
+ void testSetOnJoinResetInventory() {
s.setOnJoinResetInventory(true);
assertTrue(s.isOnJoinResetInventory());
}
@@ -337,7 +337,7 @@ public void testSetOnJoinResetInventory() {
* Test method for {@link world.bentobox.bskyblock.Settings#setOnJoinResetEnderChest(boolean)}.
*/
@Test
- public void testSetOnJoinResetEnderChest() {
+ void testSetOnJoinResetEnderChest() {
s.setOnJoinResetEnderChest(true);
assertTrue(s.isOnJoinResetEnderChest());
}
@@ -346,7 +346,7 @@ public void testSetOnJoinResetEnderChest() {
* Test method for {@link world.bentobox.bskyblock.Settings#setOnLeaveResetMoney(boolean)}.
*/
@Test
- public void testSetOnLeaveResetMoney() {
+ void testSetOnLeaveResetMoney() {
s.setOnLeaveResetMoney(true);
assertTrue(s.isOnLeaveResetMoney());
}
@@ -355,7 +355,7 @@ public void testSetOnLeaveResetMoney() {
* Test method for {@link world.bentobox.bskyblock.Settings#setOnLeaveResetInventory(boolean)}.
*/
@Test
- public void testSetOnLeaveResetInventory() {
+ void testSetOnLeaveResetInventory() {
s.setOnLeaveResetInventory(true);
assertTrue(s.isOnLeaveResetInventory());
}
@@ -364,7 +364,7 @@ public void testSetOnLeaveResetInventory() {
* Test method for {@link world.bentobox.bskyblock.Settings#setOnLeaveResetEnderChest(boolean)}.
*/
@Test
- public void testSetOnLeaveResetEnderChest() {
+ void testSetOnLeaveResetEnderChest() {
s.setOnLeaveResetEnderChest(true);
assertTrue(s.isOnLeaveResetEnderChest());
}
@@ -373,7 +373,7 @@ public void testSetOnLeaveResetEnderChest() {
* Test method for {@link world.bentobox.bskyblock.Settings#setDeathsCounted(boolean)}.
*/
@Test
- public void testSetDeathsCounted() {
+ void testSetDeathsCounted() {
s.setDeathsCounted(true);
assertTrue(s.isDeathsCounted());
}
@@ -382,7 +382,7 @@ public void testSetDeathsCounted() {
* Test method for {@link world.bentobox.bskyblock.Settings#setDeathsMax(int)}.
*/
@Test
- public void testSetDeathsMax() {
+ void testSetDeathsMax() {
s.setDeathsMax(123);
assertEquals(123, s.getDeathsMax());
}
@@ -391,7 +391,7 @@ public void testSetDeathsMax() {
* Test method for {@link world.bentobox.bskyblock.Settings#setTeamJoinDeathReset(boolean)}.
*/
@Test
- public void testSetTeamJoinDeathReset() {
+ void testSetTeamJoinDeathReset() {
s.setTeamJoinDeathReset(true);
assertTrue(s.isTeamJoinDeathReset());
}
@@ -400,7 +400,7 @@ public void testSetTeamJoinDeathReset() {
* Test method for {@link world.bentobox.bskyblock.Settings#setGeoLimitSettings(java.util.List)}.
*/
@Test
- public void testSetGeoLimitSettings() {
+ void testSetGeoLimitSettings() {
List geoLimitSettings = Collections.emptyList();
s.setGeoLimitSettings(geoLimitSettings);
assertEquals(geoLimitSettings, s.getGeoLimitSettings());
@@ -410,7 +410,7 @@ public void testSetGeoLimitSettings() {
* Test method for {@link world.bentobox.bskyblock.Settings#setIvSettings(java.util.List)}.
*/
@Test
- public void testSetIvSettings() {
+ void testSetIvSettings() {
List ivSettings = Collections.emptyList();
s.setIvSettings(ivSettings);
assertEquals(ivSettings, s.getIvSettings());
@@ -420,7 +420,7 @@ public void testSetIvSettings() {
* Test method for {@link world.bentobox.bskyblock.Settings#setAllowSetHomeInNether(boolean)}.
*/
@Test
- public void testSetAllowSetHomeInNether() {
+ void testSetAllowSetHomeInNether() {
s.setAllowSetHomeInNether(true);
assertTrue(s.isAllowSetHomeInNether());
}
@@ -429,7 +429,7 @@ public void testSetAllowSetHomeInNether() {
* Test method for {@link world.bentobox.bskyblock.Settings#setAllowSetHomeInTheEnd(boolean)}.
*/
@Test
- public void testSetAllowSetHomeInTheEnd() {
+ void testSetAllowSetHomeInTheEnd() {
s.setAllowSetHomeInTheEnd(true);
assertTrue(s.isAllowSetHomeInTheEnd());
}
@@ -438,7 +438,7 @@ public void testSetAllowSetHomeInTheEnd() {
* Test method for {@link world.bentobox.bskyblock.Settings#setRequireConfirmationToSetHomeInNether(boolean)}.
*/
@Test
- public void testSetRequireConfirmationToSetHomeInNether() {
+ void testSetRequireConfirmationToSetHomeInNether() {
s.setRequireConfirmationToSetHomeInNether(true);
assertTrue(s.isRequireConfirmationToSetHomeInNether());
}
@@ -447,7 +447,7 @@ public void testSetRequireConfirmationToSetHomeInNether() {
* Test method for {@link world.bentobox.bskyblock.Settings#setRequireConfirmationToSetHomeInTheEnd(boolean)}.
*/
@Test
- public void testSetRequireConfirmationToSetHomeInTheEnd() {
+ void testSetRequireConfirmationToSetHomeInTheEnd() {
s.setRequireConfirmationToSetHomeInTheEnd(true);
assertTrue(s.isRequireConfirmationToSetHomeInTheEnd());
}
@@ -456,7 +456,7 @@ public void testSetRequireConfirmationToSetHomeInTheEnd() {
* Test method for {@link world.bentobox.bskyblock.Settings#setResetEpoch(long)}.
*/
@Test
- public void testSetResetEpoch() {
+ void testSetResetEpoch() {
s.setResetEpoch(123);
assertEquals(123, s.getResetEpoch());
}
@@ -465,7 +465,7 @@ public void testSetResetEpoch() {
* Test method for {@link world.bentobox.bskyblock.Settings#getPermissionPrefix()}.
*/
@Test
- public void testGetPermissionPrefix() {
+ void testGetPermissionPrefix() {
assertEquals("bskyblock", s.getPermissionPrefix());
}
@@ -473,7 +473,7 @@ public void testGetPermissionPrefix() {
* Test method for {@link world.bentobox.bskyblock.Settings#isWaterUnsafe()}.
*/
@Test
- public void testIsWaterUnsafe() {
+ void testIsWaterUnsafe() {
assertFalse(s.isWaterUnsafe());
}
@@ -481,7 +481,7 @@ public void testIsWaterUnsafe() {
* Test method for {@link world.bentobox.bskyblock.Settings#setDefaultBiome(org.bukkit.block.Biome)}.
*/
@Test
- public void testSetDefaultBiome() {
+ void testSetDefaultBiome() {
s.setDefaultBiome(Biome.BADLANDS);
assertEquals(Biome.BADLANDS, s.getDefaultBiome());
}
@@ -490,7 +490,7 @@ public void testSetDefaultBiome() {
* Test method for {@link world.bentobox.bskyblock.Settings#setBanLimit(int)}.
*/
@Test
- public void testSetBanLimit() {
+ void testSetBanLimit() {
s.setBanLimit(123);
assertEquals(123, s.getBanLimit());
}
@@ -499,7 +499,7 @@ public void testSetBanLimit() {
* Test method for {@link world.bentobox.bskyblock.Settings#getIslandCommand()}.
*/
@Test
- public void testGetIslandCommand() {
+ void testGetIslandCommand() {
s.setPlayerCommandAliases("island");
assertEquals("island", s.getPlayerCommandAliases());
}
@@ -508,7 +508,7 @@ public void testGetIslandCommand() {
* Test method for {@link world.bentobox.bskyblock.Settings#getAdminCommand()}.
*/
@Test
- public void testGetAdminCommand() {
+ void testGetAdminCommand() {
s.setAdminCommandAliases("admin");
assertEquals("admin", s.getAdminCommandAliases());
}
diff --git a/src/test/java/world/bentobox/bskyblock/TestWorldSettings.java b/src/test/java/world/bentobox/bskyblock/TestWorldSettings.java
index 31d9b0b..bff276b 100644
--- a/src/test/java/world/bentobox/bskyblock/TestWorldSettings.java
+++ b/src/test/java/world/bentobox/bskyblock/TestWorldSettings.java
@@ -28,12 +28,14 @@ public GameMode getDefaultGameMode() {
return GameMode.SURVIVAL;
}
+ @SuppressWarnings("removal")
@Override
public Map getDefaultIslandFlags() {
return Collections.emptyMap();
}
+ @SuppressWarnings("removal")
@Override
public Map getDefaultIslandSettings() {
diff --git a/src/test/java/world/bentobox/bskyblock/commands/IslandAboutCommandTest.java b/src/test/java/world/bentobox/bskyblock/commands/IslandAboutCommandTest.java
index c55d301..e750a5a 100644
--- a/src/test/java/world/bentobox/bskyblock/commands/IslandAboutCommandTest.java
+++ b/src/test/java/world/bentobox/bskyblock/commands/IslandAboutCommandTest.java
@@ -1,5 +1,6 @@
package world.bentobox.bskyblock.commands;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -17,13 +18,13 @@
* @author tastybento
*
*/
-public class IslandAboutCommandTest {
+class IslandAboutCommandTest {
/**
* Test method for {@link world.bentobox.bskyblock.commands.IslandAboutCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/
@Test
- public void testExecuteUserStringListOfString() {
+ void testExecuteUserStringListOfString() {
CompositeCommand ic= mock(CompositeCommand.class);
Addon addon = mock(Addon.class);
AddonDescription desc = new AddonDescription.Builder("","BSkyBlock","1.2.3").build();
@@ -31,10 +32,13 @@ public void testExecuteUserStringListOfString() {
when(ic.getAddon()).thenReturn(addon);
IslandAboutCommand c = new IslandAboutCommand(ic);
User user = mock(User.class);
- c.execute(user, "", Collections.emptyList());
- // Verify
- Mockito.verify(user).sendRawMessage(Mockito.eq("Copyright (c) 2017 - 2022 tastybento, Poslovitch"));
- Mockito.verify(user).sendRawMessage(Mockito.eq("About BSkyBlock 1.2.3:"));
+ boolean result = c.execute(user, "", Collections.emptyList());
+ assertTrue(result);
+ // Verify all four lines
+ Mockito.verify(user).sendRawMessage("About BSkyBlock 1.2.3:");
+ Mockito.verify(user).sendRawMessage("Copyright (c) 2017 - 2026 tastybento, others");
+ Mockito.verify(user).sendRawMessage("See https://www.eclipse.org/legal/epl-2.0/");
+ Mockito.verify(user).sendRawMessage("for license information.");
}
}
diff --git a/src/test/java/world/bentobox/bskyblock/generators/ChunkGeneratorWorldTest.java b/src/test/java/world/bentobox/bskyblock/generators/ChunkGeneratorWorldTest.java
index 3b566d8..c36cd7f 100644
--- a/src/test/java/world/bentobox/bskyblock/generators/ChunkGeneratorWorldTest.java
+++ b/src/test/java/world/bentobox/bskyblock/generators/ChunkGeneratorWorldTest.java
@@ -1,26 +1,23 @@
package world.bentobox.bskyblock.generators;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.Random;
-import org.bukkit.Bukkit;
import org.bukkit.Material;
-import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.block.Biome;
-import org.bukkit.generator.ChunkGenerator.BiomeGrid;
+import org.bukkit.generator.BiomeProvider;
import org.bukkit.generator.ChunkGenerator.ChunkData;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
@@ -35,7 +32,7 @@
* @author tastybento
*
*/
-public class ChunkGeneratorWorldTest extends CommonTestSetup {
+class ChunkGeneratorWorldTest extends CommonTestSetup {
@Mock
private BSkyBlock addon;
@@ -43,27 +40,18 @@ public class ChunkGeneratorWorldTest extends CommonTestSetup {
@Mock
private World cgWorld;
private final Random random = new Random();
- @SuppressWarnings("deprecation")
- @Mock
- private BiomeGrid biomeGrid;
private Settings settings;
@Mock
private ChunkData data;
/**
- * @throws java.lang.Exception
+ * @throws java.lang.Exception - exception
*/
- @SuppressWarnings("deprecation")
@Override
@BeforeEach
public void setUp() throws Exception {
super.setUp();
- // Re-stub Bukkit.getServer() with a Mockito mock so we can control createChunkData()
- Server server = mock(Server.class);
- when(server.createChunkData(any())).thenReturn(data);
- mockedBukkit.when(Bukkit::getServer).thenReturn(server);
-
// Instance
cg = new ChunkGeneratorWorld(addon);
// World
@@ -81,86 +69,91 @@ public void tearDown() throws Exception {
}
/**
- * Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
+ * Test method for {@link ChunkGeneratorWorld#generateNoise} in the overworld with no sea (void).
*/
- @SuppressWarnings("deprecation")
@Test
- void testGenerateChunkDataWorldRandomIntIntBiomeGridOverworldVoid() {
- ChunkData cd = cg.generateChunkData(cgWorld, random, 0, 0, biomeGrid);
- assertEquals(data, cd);
- // Verifications
- verify(biomeGrid, times(64)).setBiome(anyInt(), anyInt(), anyInt(), any());
- // Void
- verify(cd, never()).setRegion(anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), any(Material.class));
+ void testGenerateNoiseOverworldVoid() {
+ cg.generateNoise(cgWorld, random, 0, 0, data);
+ // Void - no water fill
+ verify(data, never()).setRegion(anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), any(Material.class));
}
/**
- * Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
+ * Test method for {@link ChunkGeneratorWorld#generateNoise} in the overworld with a sea.
*/
- @SuppressWarnings("deprecation")
@Test
- void testGenerateChunkDataWorldRandomIntIntBiomeGridOverworldSea() {
+ void testGenerateNoiseOverworldSea() {
// Set sea height
settings.setSeaHeight(10);
- ChunkData cd = cg.generateChunkData(cgWorld, random, 0, 0, biomeGrid);
- assertEquals(data, cd);
- // Verifications
- verify(biomeGrid, times(64)).setBiome(anyInt(), anyInt(), anyInt(),
- argThat(b -> b != null && "plains".equals(b.getKey().getKey())));
+ cg.generateNoise(cgWorld, random, 0, 0, data);
// Water. Blocks = 16 x 16 x 11 because block 0
- verify(cd).setRegion(0, 0, 0, 16, 11, 16, Material.WATER);
+ verify(data).setRegion(0, 0, 0, 16, 11, 16, Material.WATER);
+ }
+
+ /**
+ * Test method for {@link ChunkGeneratorWorld#getDefaultBiomeProvider} in the overworld.
+ */
+ @Test
+ void testGetDefaultBiomeProviderOverworld() {
+ BiomeProvider provider = cg.getDefaultBiomeProvider(cgWorld);
+ Biome biome = provider.getBiome(cgWorld, 0, 0, 0);
+ assertEquals("plains", biome.getKey().getKey());
+ }
+
+ /**
+ * Test method for {@link ChunkGeneratorWorld#getDefaultBiomeProvider} in the End.
+ */
+ @Test
+ void testGetDefaultBiomeProviderEnd() {
+ when(cgWorld.getEnvironment()).thenReturn(World.Environment.THE_END);
+ BiomeProvider provider = cg.getDefaultBiomeProvider(cgWorld);
+ Biome biome = provider.getBiome(cgWorld, 0, 0, 0);
+ assertEquals("the_end", biome.getKey().getKey());
}
/**
- * Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
+ * Test method for {@link ChunkGeneratorWorld#generateNoise} in the End (void).
*/
- @SuppressWarnings("deprecation")
@Test
- void testGenerateChunkDataWorldRandomIntIntBiomeGridEnd() {
+ void testGenerateNoiseEnd() {
when(cgWorld.getEnvironment()).thenReturn(World.Environment.THE_END);
- ChunkData cd = cg.generateChunkData(cgWorld, random, 0, 0, biomeGrid);
- assertEquals(data, cd);
- // Verifications
- // Set biome in end
- verify(biomeGrid, times(64)).setBiome(anyInt(), anyInt(), anyInt(),
- argThat(b -> b != null && "the_end".equals(b.getKey().getKey())));
- // Void
- verify(cd, never()).setRegion(anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), any(Material.class));
+ cg.generateNoise(cgWorld, random, 0, 0, data);
+ // Void - no region fill
+ verify(data, never()).setRegion(anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), anyInt(), any(Material.class));
}
/**
- * Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
+ * Test method for {@link ChunkGeneratorWorld#getDefaultBiomeProvider} in the Nether.
*/
- @SuppressWarnings("deprecation")
@Test
- void testGenerateChunkDataWorldRandomIntIntBiomeGridNetherWithRoof() {
+ void testGetDefaultBiomeProviderNether() {
when(cgWorld.getEnvironment()).thenReturn(World.Environment.NETHER);
- ChunkData cd = cg.generateChunkData(cgWorld, random, 0, 0, biomeGrid);
- assertEquals(data, cd);
- // Verifications
- // Set biome in nether
- verify(biomeGrid, times(64)).setBiome(anyInt(), anyInt(), anyInt(),
- argThat(b -> b != null && "nether_wastes".equals(b.getKey().getKey())));
+ BiomeProvider provider = cg.getDefaultBiomeProvider(cgWorld);
+ Biome biome = provider.getBiome(cgWorld, 0, 0, 0);
+ assertEquals("nether_wastes", biome.getKey().getKey());
+ }
+
+ /**
+ * Test method for {@link ChunkGeneratorWorld#generateNoise} in the Nether with a roof.
+ */
+ @Test
+ void testGenerateNoiseNetherWithRoof() {
+ when(cgWorld.getEnvironment()).thenReturn(World.Environment.NETHER);
+ cg.generateNoise(cgWorld, random, 0, 0, data);
// Nether roof - at least bedrock layer
- verify(cd, atLeast(64)).setBlock(anyInt(), anyInt(), anyInt(), eq(Material.BEDROCK));
+ verify(data, atLeast(64)).setBlock(anyInt(), anyInt(), anyInt(), eq(Material.BEDROCK));
}
/**
- * Test method for {@link world.bentobox.bskyblock.generators.ChunkGeneratorWorld#generateChunkData(org.bukkit.World, java.util.Random, int, int, org.bukkit.generator.ChunkGenerator.BiomeGrid)}.
+ * Test method for {@link ChunkGeneratorWorld#generateNoise} in the Nether with no roof.
*/
- @SuppressWarnings("deprecation")
@Test
- void testGenerateChunkDataWorldRandomIntIntBiomeGridNetherNoRoof() {
+ void testGenerateNoiseNetherNoRoof() {
settings.setNetherRoof(false);
when(cgWorld.getEnvironment()).thenReturn(World.Environment.NETHER);
- ChunkData cd = cg.generateChunkData(cgWorld, random, 0, 0, biomeGrid);
- assertEquals(data, cd);
- // Verifications
- // Set biome in nether
- verify(biomeGrid, times(64)).setBiome(anyInt(), anyInt(), anyInt(),
- argThat(b -> b != null && "nether_wastes".equals(b.getKey().getKey())));
- // Nether roof - at least bedrock layer
- verify(cd, never()).setBlock(anyInt(), anyInt(), anyInt(), any(Material.class));
+ cg.generateNoise(cgWorld, random, 0, 0, data);
+ // No nether roof blocks set
+ verify(data, never()).setBlock(anyInt(), anyInt(), anyInt(), any(Material.class));
}
/**
@@ -178,4 +171,49 @@ void testCanSpawnWorldIntInt() {
void testGetDefaultPopulatorsWorld() {
assertTrue(cg.getDefaultPopulators(mock(World.class)).isEmpty());
}
+
+ /**
+ * Test method for {@link ChunkGeneratorWorld#shouldGenerateStructures}.
+ */
+ @Test
+ void testShouldGenerateStructures() {
+ assertFalse(cg.shouldGenerateStructures(cgWorld, random, 0, 0));
+ }
+
+ /**
+ * Test method for {@link ChunkGeneratorWorld#shouldGenerateMobs}.
+ */
+ @Test
+ void testShouldGenerateMobs() {
+ assertTrue(cg.shouldGenerateMobs(cgWorld, random, 0, 0));
+ }
+
+ /**
+ * Test method for the BiomeProvider's {@code getBiomes} list in each environment.
+ */
+ @Test
+ void testGetBiomesOverworld() {
+ BiomeProvider provider = cg.getDefaultBiomeProvider(cgWorld);
+ var biomes = provider.getBiomes(cgWorld);
+ assertEquals(1, biomes.size());
+ assertEquals("plains", biomes.get(0).getKey().getKey());
+ }
+
+ @Test
+ void testGetBiomesNether() {
+ when(cgWorld.getEnvironment()).thenReturn(World.Environment.NETHER);
+ BiomeProvider provider = cg.getDefaultBiomeProvider(cgWorld);
+ var biomes = provider.getBiomes(cgWorld);
+ assertEquals(1, biomes.size());
+ assertEquals("nether_wastes", biomes.get(0).getKey().getKey());
+ }
+
+ @Test
+ void testGetBiomesEnd() {
+ when(cgWorld.getEnvironment()).thenReturn(World.Environment.THE_END);
+ BiomeProvider provider = cg.getDefaultBiomeProvider(cgWorld);
+ var biomes = provider.getBiomes(cgWorld);
+ assertEquals(1, biomes.size());
+ assertEquals("the_end", biomes.get(0).getKey().getKey());
+ }
}