diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db8c77b..17b8df6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,21 +11,22 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Set up JDK 17 - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: + distribution: 'adopt' java-version: 17 - name: Cache SonarCloud packages - uses: actions/cache@v1 + uses: actions/cache@v3 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - name: Cache Maven packages - uses: actions/cache@v1 + uses: actions/cache@v3 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} diff --git a/README.md b/README.md index d754351..80662f1 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,54 @@ [![Discord](https://img.shields.io/discord/272499714048524288.svg?logo=discord)](https://discord.bentobox.world) [![Build Status](https://ci.codemc.org/buildStatus/icon?job=BentoBoxWorld/CaveBlock)](https://ci.codemc.org/job/BentoBoxWorld/job/CaveBlock/) -CaveBlock is an addon for BentoBox, so to run CaveBlock, you must have BentoBox installed. It is not a Bukkit plugin and trying to use it as one will not work. +# Welcome to CaveBlock for BentoBox! -## Translation +🌌 **Embark on a Subterranean Adventure!** + +CaveBlock is an enthralling GameMode addon for BentoBox, designed to take your Minecraft experience to new depths. In this unique underground world, every adventure, challenge, and mystery lies beneath the surface. + + + +## What is CaveBlock? + +CaveBlock transforms the familiar Minecraft landscape into a vast underground realm. As a player, you begin your journey in a modest cave, equipped with only essential items. Your mission is to mine, explore, and expand your subterranean domain. + +### Key Features: + +- **Start Small, Dream Big:** Begin in a small cave and use your mining skills to expand your territory. +- **Treasure Hunting:** Delve deeper to discover hidden treasures and rare resources. +- **Beware of the Dark:** Monsters lurk in the shadows. Prepare for encounters with creatures of the deep. +- **Build and Craft:** Utilize your resources to craft tools, build structures, and create your own underground empire. + +## Getting Started with CaveBlock + +CaveBlock is an addon for BentoBox, a Bukkit plugin for Minecraft. To dive into this underground adventure, you'll need to have BentoBox installed on your Minecraft server. + +### Installation: + +1. **Install BentoBox:** Make sure BentoBox is installed and running on your server. +2. **Download CaveBlock:** Get the CaveBlock addon from the [official download site](https://download.bentobox.world). Or download from the releases in this repo. +3. **Add to BentoBox:** Place the CaveBlock file in your BentoBox addons folder. +4. **Restart Your Server:** Once installed, restart your server to activate CaveBlock. + +### Dive Into the Depths! + +Are you ready to explore the unknown and carve out your own piece of the underground world? Download CaveBlock now and start your subterranean adventure! + +🔍 **Stay Updated:** For the latest updates, follow our [Discord](https://discord.gg/tqQbNA5X9A). + +--- + +*Note: CaveBlock is constantly being updated with new features and improvements. Keep an eye on our release notes for the latest enhancements.* + +**Happy Mining!** 🌐🛠️👾 + +## Translations Like most BentoBox projects, the CaveBlock Addon is translatable into any language. Everyone can contribute, and translate some parts of the addon into their language via [GitLocalize](https://gitlocalize.com/repo/2968). If your language is not in the list, please contact the developers via Discord, and it will be added. -## Installation +## Full Installation Instructions 0. Install BentoBox and run it on the server at least once to create its data folders. 1. Place this jar in the addons folder of the BentoBox plugin. diff --git a/pom.xml b/pom.xml index c43b69f..aa44183 100644 --- a/pom.xml +++ b/pom.xml @@ -45,12 +45,12 @@ UTF-8 17 - 1.19.4-R0.1-SNAPSHOT - 1.23.0 + 1.20.2-R0.1-SNAPSHOT + 2.5.0-SNAPSHOT ${build.version}-SNAPSHOT - 1.18.0 + 1.19.0 -LOCAL bentobox-world https://sonarcloud.io @@ -229,7 +229,7 @@ org.jacoco jacoco-maven-plugin - 0.8.3 + 0.8.10 true diff --git a/src/main/java/world/bentobox/caveblock/CaveBlockPladdon.java b/src/main/java/world/bentobox/caveblock/CaveBlockPladdon.java index da0d0d7..f996155 100644 --- a/src/main/java/world/bentobox/caveblock/CaveBlockPladdon.java +++ b/src/main/java/world/bentobox/caveblock/CaveBlockPladdon.java @@ -7,8 +7,13 @@ import world.bentobox.bentobox.api.addons.Pladdon; public class CaveBlockPladdon extends Pladdon { + private Addon addon; + @Override public Addon getAddon() { - return new CaveBlock(); + if (addon == null) { + addon = new CaveBlock(); + } + return addon; } } diff --git a/src/main/java/world/bentobox/caveblock/Settings.java b/src/main/java/world/bentobox/caveblock/Settings.java index 4d32700..a62acff 100644 --- a/src/main/java/world/bentobox/caveblock/Settings.java +++ b/src/main/java/world/bentobox/caveblock/Settings.java @@ -1,7 +1,13 @@ package world.bentobox.caveblock; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.bukkit.Difficulty; import org.bukkit.GameMode; @@ -12,14 +18,12 @@ import org.eclipse.jdt.annotation.NonNull; import com.google.common.base.Enums; +import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.api.configuration.ConfigComment; import world.bentobox.bentobox.api.configuration.ConfigEntry; import world.bentobox.bentobox.api.configuration.StoreAt; import world.bentobox.bentobox.api.configuration.WorldSettings; import world.bentobox.bentobox.api.flags.Flag; -import world.bentobox.bentobox.database.objects.adapters.Adapter; -import world.bentobox.bentobox.database.objects.adapters.FlagSerializer; -import world.bentobox.bentobox.database.objects.adapters.FlagSerializer2; /** @@ -30,6 +34,580 @@ import world.bentobox.bentobox.database.objects.adapters.FlagSerializer2; @ConfigComment("CaveBlock Configuration [version]") public class Settings implements WorldSettings { + + /* Commands */ + @ConfigComment("Cave Command. What command users will run to access their cave.") + @ConfigComment("To define alias, just separate commands with white space.") + @ConfigEntry(path = "caveblock.command.cave") + private String playerCommandAliases = "cave cb"; + + @ConfigComment("The Cave admin command.") + @ConfigComment("To define alias, just separate commands with white space.") + @ConfigEntry(path = "caveblock.command.admin") + private String adminCommandAliases = "cbadmin cba"; + + @ConfigComment("The default action for new player command call.") + @ConfigComment("Sub-command of main player command that will be run on first player command call.") + @ConfigComment("By default it is sub-command 'create'.") + @ConfigEntry(path = "caveblock.command.new-player-action", since = "1.13.0") + private String defaultNewPlayerAction = "create"; + + @ConfigComment("The default action for player command.") + @ConfigComment("Sub-command of main player command that will be run on each player command call.") + @ConfigComment("By default it is sub-command 'go'.") + @ConfigEntry(path = "caveblock.command.default-action", since = "1.13.0") + private String defaultPlayerAction = "go"; + + /* WORLD */ + @ConfigComment("Friendly name for this world. Used in admin commands. Must be a single word") + @ConfigEntry(path = "world.friendly-name") + private String friendlyName = "CaveBlock"; + + @ConfigComment("Name of the world - if it does not exist then it will be generated.") + @ConfigComment("It acts like a prefix for nether and end (e.g. CaveBlock-world, CaveBlock-world_nether, CaveBlock-world_end)") + @ConfigEntry(path = "world.world-name") + private String worldName = "caveblock-world"; + + @ConfigComment("World difficulty setting - PEACEFUL, EASY, NORMAL, HARD") + @ConfigComment("Other plugins may override this setting") + @ConfigEntry(path = "world.difficulty") + private Difficulty difficulty = Difficulty.HARD; + + @ConfigComment("Spawn limits. These override the limits set in bukkit.yml") + @ConfigComment("If set to a negative number, the server defaults will be used") + @ConfigEntry(path = "world.spawn-limits.monsters", since = "1.15.1") + private int spawnLimitMonsters = -1; + @ConfigEntry(path = "world.spawn-limits.animals", since = "1.15.1") + private int spawnLimitAnimals = -1; + @ConfigEntry(path = "world.spawn-limits.water-animals", since = "1.15.1") + private int spawnLimitWaterAnimals = -1; + @ConfigEntry(path = "world.spawn-limits.ambient", since = "1.15.1") + private int spawnLimitAmbient = -1; + @ConfigComment("Setting to 0 will disable animal spawns, but this is not recommended. Minecraft default is 400.") + @ConfigComment("A negative value uses the server default") + @ConfigEntry(path = "world.spawn-limits.ticks-per-animal-spawns", since = "1.15.1") + private int ticksPerAnimalSpawns = -1; + @ConfigComment("Setting to 0 will disable monster spawns, but this is not recommended. Minecraft default is 400.") + @ConfigComment("A negative value uses the server default") + @ConfigEntry(path = "world.spawn-limits.ticks-per-monster-spawns", since = "1.15.1") + private int ticksPerMonsterSpawns = -1; + + @ConfigComment("Radius of cave in blocks. (So distance between caves is twice this)") + @ConfigComment("Will be rounded up to the nearest 16 blocks.") + @ConfigComment("It is the same for every dimension : Overworld, Nether and End.") + @ConfigComment("This value cannot be changed mid-game and the plugin will not start if it is different.") + @ConfigEntry(path = "world.distance-between-caves", needsReset = true) + private int islandDistance = 100; + + @ConfigComment("Default protection range radius in blocks. Cannot be larger than distance.") + @ConfigComment("Admins can change protection sizes for players individually using /cbadmin range set ") + @ConfigComment("or set this permission: caveblock.island.range.") + @ConfigEntry(path = "world.protection-range") + private int islandProtectionRange = 50; + + @ConfigComment("Start caves at these coordinates. This is where new caves will start in the") + @ConfigComment("world. These must be a factor of your cave distance, but the plugin will auto") + @ConfigComment("calculate the closest location on the grid. Caves develop around this location") + @ConfigComment("both positively and negatively in a square grid.") + @ConfigComment("If none of this makes sense, leave it at 0,0.") + @ConfigEntry(path = "world.start-x", needsReset = true) + private int islandStartX = 0; + + @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("Cave height - Lowest is 5.") + @ConfigComment("It is the y coordinate of the bedrock block in the schem.") + @ConfigEntry(path = "world.cave-height") + private int islandHeight = 60; + + @ConfigComment("Maximum number of caves in the world. Set to -1 or 0 for unlimited.") + @ConfigComment("If the number of caves is greater than this number, it will stop players from creating caves.") + @ConfigEntry(path = "world.max-caves") + private int maxIslands = -1; + + @ConfigComment("The number of concurrent caves a player can have") + @ConfigComment("A value of 0 will use the BentoBox config.yml default") + @ConfigEntry(path = "world.concurrent-caves") + private int concurrentIslands = 0; + + @ConfigComment("Disallow team members from having their own caves.") + @ConfigEntry(path = "world.disallow-team-member-caves") + private boolean disallowTeamMemberIslands = true; + + @ConfigComment("The default game mode for this world. Players will be set to this mode when they create") + @ConfigComment("a new cave for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR") + @ConfigEntry(path = "world.default-game-mode") + private GameMode defaultGameMode = GameMode.SURVIVAL; + + @ConfigComment("The default biome for the overworld") + @ConfigEntry(path = "world.default-biome") + private Biome defaultBiome = Enums.getIfPresent(Biome.class, "DRIPSTONE_CAVES").or(Biome.THE_VOID); + + @ConfigComment("The maximum number of players a player can ban at any one time in this game mode.") + @ConfigComment("The permission caveblock.ban.maxlimit.X where X is a number can also be used per player") + @ConfigComment("-1 = unlimited") + @ConfigEntry(path = "world.ban-limit") + private int banLimit = -1; + + @ConfigComment("") + @ConfigComment("This is cave.. no height... only depth. If depth is set smaller than maximal world height, then area above will be empty.") + @ConfigComment("Should not be less than cave height.") + @ConfigEntry(path = "world.world-depth", needsReset = true) + private int worldDepth = 256; + + @ConfigComment("This indicate how many times block should be tried to generate.") + @ConfigEntry(path = "world.generation-tries", needsReset = true) + private int numberOfBlockGenerationTries = 1; + + @ConfigComment("Should we use the new material generator ?") + @ConfigComment("This will generate ores and blocks similar to how vanilla does,") + @ConfigComment("but it will override the blocks settings of each world.") + @ConfigEntry(path = "world.use-new-material-generator", needsReset = true) + private boolean newMaterialGenerator = false; + + @ConfigComment("") + @ConfigComment("Make over world roof of bedrock, if false, it will be made from stone.") + @ConfigEntry(path = "world.normal.roof", needsReset = true) + private boolean normalRoof = true; + + @ConfigComment("") + @ConfigComment("Option allows to toggle if world generator should generate natural(-ish) looking surface with dirt and grass blocks.") + @ConfigComment("Enabling this option will ignore roof setting.") + @ConfigComment("Default value is false.") + @ConfigEntry(path = "world.normal.natural-surface", needsReset = true, experimental = true) + private boolean generateNaturalSurface = false; + + @ConfigComment("") + @ConfigComment("Option allows to toggle if world generator should generate natural looking caves.") + @ConfigComment("Default value is false.") + @ConfigEntry(path = "world.normal.natural-caves", needsReset = true) + private boolean generateCaves = false; + + @ConfigComment("Make over world floor of bedrock, if false, it will be made from stone.") + @ConfigEntry(path = "world.normal.floor", needsReset = true) + private boolean normalFloor = true; + + @ConfigComment("") + @ConfigComment("Option allows to toggle if world generator should generate natural looking bedrock block patterns.") + @ConfigComment("Enabling this option will ignore floor setting.") + @ConfigComment("Default value is false.") + @ConfigEntry(path = "world.normal.natural-bedrock", needsReset = true) + private boolean generateNaturalBedrock = false; + + @ConfigComment("Main block of which world will be generated.") + @ConfigEntry(path = "world.normal.main-block", needsReset = true) + private Material normalMainBlock = Material.STONE; + + @ConfigComment("Blocks that will occasionally replace main block by random chance.") + @ConfigComment("Blocks will replace only main-block and will try to create packs that") + @ConfigComment("are set in their strings. Chance of spawning also is required.") + @ConfigComment("For materials first string must be MATERIAL, for entity: ENTITY.") + @ConfigComment("Entities spawned via generator are not protected from despawing.") + @ConfigComment("Working only with 2 high mobs currently.") + @ConfigComment("Example:") + @ConfigComment("MATERIAL:DIAMOND_ORE:100:5 - means there is 100% chace of spawing diamonds") + @ConfigComment("where max amount in pack are 5 per each subchunk!") + @ConfigEntry(path = "world.normal.blocks", needsReset = true) + private List normalBlocks = new ArrayList<>(); + + // Nether + @ConfigComment("Generate Nether - if this is false, the nether world will not be made and access to") + @ConfigComment("the nether will not occur. Other plugins may still enable portal usage.") + @ConfigComment("Note: Some default challenges will not be possible if there is no nether.") + @ConfigComment("Note that with a standard nether all players arrive at the same portal and entering a") + @ConfigComment("portal will return them back to their caves.") + @ConfigEntry(path = "world.nether.generate") + private boolean netherGenerate = true; + + @ConfigComment("Caves in Nether. Change to false for standard vanilla nether.") + @ConfigEntry(path = "world.nether.caves", needsReset = true) + private boolean netherIslands = true; + + @ConfigComment("The default biome for the nether world (this may affect what mobs can spawn)") + @ConfigEntry(path = "world.nether.biome", since = "1.14.0") + private Biome defaultNetherBiome = Enums.getIfPresent(Biome.class, "NETHER_WASTES").or(Biome.THE_VOID); + + @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.") + @ConfigComment("Only applies to vanilla nether") + @ConfigEntry(path = "world.nether.spawn-radius") + private int netherSpawnRadius = 32; + + @ConfigComment("Make over world roof of bedrock, if false, it will be made from stone") + @ConfigEntry(path = "world.nether.roof", needsReset = true) + private boolean netherRoof = true; + + @ConfigComment("Make over world floor of bedrock, if false, it will be made from stone") + @ConfigEntry(path = "world.nether.floor", needsReset = true) + private boolean netherFloor = true; + + @ConfigComment("Main block of which world will be generated.") + @ConfigEntry(path = "world.nether.main-block", needsReset = true) + private Material netherMainBlock = Material.NETHERRACK; + + @ConfigComment("Blocks that will occasionally replace main block by random chance.") + @ConfigComment("Blocks will replace only main-block and will try to create packs that") + @ConfigComment("are set in their strings. Chance of spawning also is required.") + @ConfigComment("For materials first string must be MATERIAL, for entity: ENTITY.") + @ConfigComment("Entities spawned via generator are not protected from despawing.") + @ConfigComment("Working only with 2 high mobs currently.") + @ConfigComment("Example:") + @ConfigComment("MATERIAL:DIAMOND_ORE:100:5 - means there is 100% chace of spawing diamonds") + @ConfigComment("where max amount in pack are 5 per each subchunk!") + @ConfigEntry(path = "world.nether.blocks", needsReset = true) + private List netherBlocks = new ArrayList<>(); + + @ConfigComment("This option indicates if nether portals should be linked via dimensions.") + @ConfigComment("Option will simulate vanilla portal mechanics that links portals together") + @ConfigComment("or creates a new portal, if there is not a portal in that dimension.") + @ConfigEntry(path = "world.nether.create-and-link-portals") + private boolean makeNetherPortals = false; + + // End + @ConfigEntry(path = "world.end.generate") + private boolean endGenerate = true; + + @ConfigEntry(path = "world.end.caves", needsReset = true) + private boolean endIslands = true; + + @ConfigComment("The default biome for the end world (this may affect what mobs can spawn)") + @ConfigEntry(path = "world.end.biome", since = "1.14.0") + private Biome defaultTheEndBiome = Enums.getIfPresent(Biome.class, "THE_END").or(Biome.THE_VOID); + + @ConfigEntry(path = "world.end.dragon-spawn", experimental = true) + private boolean dragonSpawn = false; + + @ConfigComment("Make over world roof of bedrock, if false, it will be made from stone") + @ConfigEntry(path = "world.end.roof", needsReset = true) + private boolean endRoof = true; + + @ConfigComment("Make over world floor of bedrock, if false, it will be made from stone") + @ConfigEntry(path = "world.end.floor", needsReset = true) + private boolean endFloor = true; + + @ConfigComment("Main block of which world will be generated.") + @ConfigEntry(path = "world.end.main-block", needsReset = true) + private Material endMainBlock = Material.END_STONE; + + @ConfigComment("Blocks that will occasionally replace main block by random chance.") + @ConfigComment("Blocks will replace only main-block and will try to create packs that") + @ConfigComment("are set in their strings. Chance of spawning also is required.") + @ConfigComment("For materials first string must be MATERIAL, for entity: ENTITY.") + @ConfigComment("Entities spawned via generator are not protected from despawing.") + @ConfigComment("Working only with 2 high mobs currently.") + @ConfigComment("Example:") + @ConfigComment("MATERIAL:DIAMOND_ORE:100:5 - means there is 100% chace of spawing diamonds") + @ConfigComment("where max amount in pack are 5 per each subchunk!") + @ConfigEntry(path = "world.end.blocks", needsReset = true) + private List endBlocks = new ArrayList<>(); + + @ConfigComment("This option indicates if obsidian platform in the end should be generated") + @ConfigComment("when player enters the end world.") + @ConfigEntry(path = "world.end.create-obsidian-platform") + private boolean makeEndPortals = false; + + // Other staff. + + @ConfigComment("Mob white list - these mobs will NOT be removed when logging in or doing /cave") + @ConfigEntry(path = "world.remove-mobs-whitelist") + private Set removeMobsWhitelist = new HashSet<>(); + + @ConfigComment("World flags. These are boolean settings for various flags for this world") + @ConfigEntry(path = "world.flags") + private Map worldFlags = new HashMap<>(); + + @ConfigComment("These are the default protection settings for new caves.") + @ConfigComment("The value is the minimum cave rank required allowed to do the action.") + @ConfigComment("Ranks are the following:") + @ConfigComment(" VISITOR = 0") + @ConfigComment(" COOP = 200") + @ConfigComment(" TRUSTED = 400") + @ConfigComment(" MEMBER = 500") + @ConfigComment(" SUB-OWNER = 900") + @ConfigComment(" OWNER = 1000") + @ConfigEntry(path = "world.default-cave-flags") + private Map defaultIslandFlags = new HashMap<>(); + + @ConfigComment("These are the default settings for new caves") + @ConfigEntry(path = "world.default-cave-settings") + private Map defaultIslandSettings = new HashMap<>(); + + @ConfigComment("These settings/flags are hidden from users") + @ConfigComment("Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings") + @ConfigEntry(path = "world.hidden-flags") + private List hiddenFlags = new ArrayList<>(); + + @ConfigComment("Visitor banned commands - Visitors to caves cannot use these commands in this world") + @ConfigEntry(path = "world.visitor-banned-commands") + private List visitorBannedCommands = new ArrayList<>(); + + @ConfigComment("Falling banned commands - players cannot use these commands when falling") + @ConfigComment("if the PREVENT_TELEPORT_WHEN_FALLING world setting flag is active") + @ConfigEntry(path = "world.falling-banned-commands") + private List fallingBannedCommands = new ArrayList<>(); + + // --------------------------------------------- + + /* Cave */ + @ConfigComment("Default max team size") + @ConfigComment("Permission size cannot be less than the default below. ") + @ConfigEntry(path = "cave.max-team-size") + private int maxTeamSize = 4; + + @ConfigComment("Default maximum number of coop rank members per cave") + @ConfigComment("Players can have the caveblock.coop.maxsize. permission to be bigger but") + @ConfigComment("permission size cannot be less than the default below. ") + @ConfigEntry(path = "cave.max-coop-size", since = "1.13.0") + private int maxCoopSize = 4; + + @ConfigComment("Default maximum number of trusted rank members per cave") + @ConfigComment("Players can have the caveblock.trust.maxsize. permission to be bigger but") + @ConfigComment("permission size cannot be less than the default below. ") + @ConfigEntry(path = "cave.max-trusted-size", since = "1.13.0") + private int maxTrustSize = 4; + + @ConfigComment("Default maximum number of homes a player can have. Min = 1") + @ConfigComment("Accessed via /cave sethome or /cave go ") + @ConfigEntry(path = "cave.max-homes") + private int maxHomes = 5; + + // Reset + @ConfigComment("How many resets a player is allowed (override with /cbadmin clearresets )") + @ConfigComment("Value of -1 means unlimited, 0 means hardcore - no resets.") + @ConfigComment("Example, 2 resets means they get 2 resets or 3 caves lifetime") + @ConfigEntry(path = "cave.reset.reset-limit") + private int resetLimit = -1; + + @ConfigComment("Kicked or leaving players lose resets") + @ConfigComment("Players who leave a team will lose a cave reset chance") + @ConfigComment("If a player has zero resets left and leaves a team, they cannot make a new") + @ConfigComment("cave by themselves and can only join a team.") + @ConfigComment("Leave this true to avoid players exploiting free caves") + @ConfigEntry(path = "cave.reset.leavers-lose-reset") + private boolean leaversLoseReset = false; + + @ConfigComment("Allow kicked players to keep their inventory.") + @ConfigComment("Overrides the on-leave inventory reset for kicked players.") + @ConfigEntry(path = "cave.reset.kicked-keep-inventory") + private boolean kickedKeepInventory = false; + + @ConfigComment("What the plugin should reset when the player joins or creates a cave") + @ConfigComment("Reset Money - if this is true, will reset the player's money to the starting money") + @ConfigComment("Recommendation is that this is set to true, but if you run multi-worlds") + @ConfigComment("make sure your economy handles multi-worlds too.") + @ConfigEntry(path = "cave.reset.on-join.money") + private boolean onJoinResetMoney = false; + + @ConfigComment("Reset inventory - if true, the player's inventory will be cleared.") + @ConfigComment("Note: if you have MultiInv running or a similar inventory control plugin, that") + @ConfigComment("plugin may still reset the inventory when the world changes.") + @ConfigEntry(path = "cave.reset.on-join.inventory") + private boolean onJoinResetInventory = false; + + @ConfigComment("Reset health - if true, the player's health will be reset.") + @ConfigEntry(path = "cave.reset.on-join.health") + private boolean onJoinResetHealth = true; + + @ConfigComment("Reset hunger - if true, the player's hunger will be reset.") + @ConfigEntry(path = "cave.reset.on-join.hunger") + private boolean onJoinResetHunger = true; + + @ConfigComment("Reset experience points - if true, the player's experience will be reset.") + @ConfigEntry(path = "cave.reset.on-join.exp") + private boolean onJoinResetXP = false; + + @ConfigComment("Reset Ender Chest - if true, the player's Ender Chest will be cleared.") + @ConfigEntry(path = "cave.reset.on-join.ender-chest") + private boolean onJoinResetEnderChest = false; + + @ConfigComment("What the plugin should reset when the player leaves or is kicked from a cave") + @ConfigComment("Reset Money - if this is true, will reset the player's money to the starting money") + @ConfigComment("Recommendation is that this is set to true, but if you run multi-worlds") + @ConfigComment("make sure your economy handles multi-worlds too.") + @ConfigEntry(path = "cave.reset.on-leave.money") + private boolean onLeaveResetMoney = false; + + @ConfigComment("Reset inventory - if true, the player's inventory will be cleared.") + @ConfigComment("Note: if you have MultiInv running or a similar inventory control plugin, that") + @ConfigComment("plugin may still reset the inventory when the world changes.") + @ConfigEntry(path = "cave.reset.on-leave.inventory") + private boolean onLeaveResetInventory = false; + + @ConfigComment("Reset health - if true, the player's health will be reset.") + @ConfigEntry(path = "cave.reset.on-leave.health") + private boolean onLeaveResetHealth = false; + + @ConfigComment("Reset hunger - if true, the player's hunger will be reset.") + @ConfigEntry(path = "cave.reset.on-leave.hunger") + private boolean onLeaveResetHunger = false; + + @ConfigComment("Reset experience - if true, the player's experience will be reset.") + @ConfigEntry(path = "cave.reset.on-leave.exp") + private boolean onLeaveResetXP = false; + + @ConfigComment("Reset Ender Chest - if true, the player's Ender Chest will be cleared.") + @ConfigEntry(path = "cave.reset.on-leave.ender-chest") + private boolean onLeaveResetEnderChest = false; + + @ConfigComment("Toggles the automatic cave creation upon the player's first login on your server.") + @ConfigComment("If set to true,") + @ConfigComment(" * Upon connecting to your server for the first time, the player will be told that") + @ConfigComment(" a cave will be created for him.") + @ConfigComment(" * Make sure you have a Blueprint Bundle called \"default\": this is the one that will") + @ConfigComment(" be used to create the cave.") + @ConfigComment(" * A cave will be created for the player without needing him to run the create command.") + @ConfigComment("If set to false, this will disable this feature entirely.") + @ConfigComment("Warning:") + @ConfigComment(" * If you are running multiple gamemodes on your server, and all of them have") + @ConfigComment(" this feature enabled, a cave in all the gamemodes will be created simultaneously.") + @ConfigComment(" However, it is impossible to know on which cave the player will be teleported to afterwards.") + @ConfigComment(" * Cave creation can be resource-intensive, please consider the options below to help mitigate") + @ConfigComment(" the potential issues, especially if you expect a lot of players to connect to your server") + @ConfigComment(" in a limited period of time.") + @ConfigEntry(path = "cave.create-cave-on-first-login.enable") + private boolean createIslandOnFirstLoginEnabled; + + @ConfigComment("Time in seconds after the player logged in, before his cave gets created.") + @ConfigComment("If set to 0 or less, the cave will be created directly upon the player's login.") + @ConfigComment("It is recommended to keep this value under a minute's time.") + @ConfigEntry(path = "cave.create-cave-on-first-login.delay") + private int createIslandOnFirstLoginDelay = 5; + + @ConfigComment("Toggles whether the cave creation should be aborted if the player logged off while the") + @ConfigComment("delay (see the option above) has not worn off yet.") + @ConfigComment("If set to true,") + @ConfigComment(" * If the player has logged off the server while the delay (see the option above) has not") + @ConfigComment(" worn off yet, this will cancel the cave creation.") + @ConfigComment(" * If the player relogs afterward, since he will not be recognized as a new player, no cave") + @ConfigComment(" would be created for him.") + @ConfigComment(" * If the cave creation started before the player logged off, it will continue.") + @ConfigComment("If set to false, the player's cave will be created even if he went offline in the meantime.") + @ConfigComment("Note this option has no effect if the delay (see the option above) is set to 0 or less.") + @ConfigEntry(path = "cave.create-cave-on-first-login.abort-on-logout") + private boolean createIslandOnFirstLoginAbortOnLogout = true; + + @ConfigComment("Toggles whether the player should be teleported automatically to his cave when it is created.") + @ConfigComment("If set to false, the player will be told his cave is ready but will have to teleport to his cave using the command.") + @ConfigEntry(path = "cave.teleport-player-to-cave-when-created", since = "1.10.0") + private boolean teleportPlayerToIslandUponIslandCreation = true; + + @ConfigComment("Create Nether or End cave if they are missing when a player goes through a portal.") + @ConfigComment("Nether and End cave are usually pasted when a player makes their cave, but if they are") + @ConfigComment("missing for some reason, you can switch this on.") + @ConfigComment("Note that bedrock removal glitches can exploit this option.") + @ConfigEntry(path = "cave.create-missing-nether-end-caves", since = "1.10.0") + private boolean pasteMissingIslands = false; + + // Commands + @ConfigComment("List of commands to run when a player joins an cave or creates one.") + @ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,") + @ConfigComment("in which case they are executed by the player.") + @ConfigComment("") + @ConfigComment("Available placeholders for the commands are the following:") + @ConfigComment(" * [name]: name of the player") + @ConfigComment("") + @ConfigComment("Here are some examples of valid commands to execute:") + @ConfigComment(" * '[SUDO] bbox version'") + @ConfigComment(" * 'bsbadmin deaths set [player] 0'") + @ConfigComment("") + @ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.") + @ConfigEntry(path = "cave.commands.on-join", since = "1.8.0") + private List onJoinCommands = new ArrayList<>(); + + @ConfigComment("List of commands to run when a player leaves a cave, resets his cave or gets kicked from it.") + @ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,") + @ConfigComment("in which case they are executed by the player.") + @ConfigComment("") + @ConfigComment("Available placeholders for the commands are the following:") + @ConfigComment(" * [name]: name of the player") + @ConfigComment("") + @ConfigComment("Here are some examples of valid commands to execute:") + @ConfigComment(" * '[SUDO] bbox version'") + @ConfigComment(" * 'bsbadmin deaths set [player] 0'") + @ConfigComment("") + @ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.") + @ConfigEntry(path = "cave.commands.on-leave", since = "1.8.0") + private List onLeaveCommands = new ArrayList<>(); + + @ConfigComment("List of commands that should be executed when the player respawns after death if Flags.ISLAND_RESPAWN is true.") + @ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,") + @ConfigComment("in which case they are executed by the player.") + @ConfigComment("") + @ConfigComment("Available placeholders for the commands are the following:") + @ConfigComment(" * [name]: name of the player") + @ConfigComment("") + @ConfigComment("Here are some examples of valid commands to execute:") + @ConfigComment(" * '[SUDO] bbox version'") + @ConfigComment(" * 'bsbadmin deaths set [player] 0'") + @ConfigComment("") + @ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.") + @ConfigEntry(path = "cave.commands.on-respawn", since = "1.14.0") + private List onRespawnCommands = new ArrayList<>(); + + // Sethome + @ConfigComment("Allow setting home in the nether. Only available on nether islands, not vanilla nether.") + @ConfigEntry(path = "cave.sethome.nether.allow") + private boolean allowSetHomeInNether = true; + + @ConfigEntry(path = "cave.sethome.nether.require-confirmation") + private boolean requireConfirmationToSetHomeInNether = true; + + @ConfigComment("Allow setting home in the end. Only available on end islands, not vanilla end.") + @ConfigEntry(path = "cave.sethome.the-end.allow") + private boolean allowSetHomeInTheEnd = true; + + @ConfigEntry(path = "cave.sethome.the-end.require-confirmation") + private boolean requireConfirmationToSetHomeInTheEnd = true; + + // Deaths + @ConfigComment("Whether deaths are counted or not.") + @ConfigEntry(path = "cave.deaths.counted") + private boolean deathsCounted = true; + + @ConfigComment("Maximum number of deaths to count. The death count can be used by add-ons.") + @ConfigEntry(path = "cave.deaths.max") + private int deathsMax = 10; + + @ConfigComment("Reset player death count when they start a new cave or reset a cave") + @ConfigEntry(path = "cave.deaths.reset-on-new") + private boolean deathsResetOnNewIsland = true; + + @ConfigComment("When a player joins a team, reset their death count") + @ConfigEntry(path = "cave.deaths.team-join-reset") + private boolean teamJoinDeathReset = true; + + // --------------------------------------------- + /* PROTECTION */ + + @ConfigComment("Geo restrict mobs.") + @ConfigComment("Mobs that exit the cave space where they were spawned will be removed.") + @ConfigEntry(path = "protection.geo-limit-settings") + private List geoLimitSettings = new ArrayList<>(); + + @ConfigComment("CaveBlock blocked mobs.") + @ConfigComment("List of mobs that should not spawn in the CaveBlock.") + @ConfigEntry(path = "protection.block-mobs", since = "1.13.0") + private List mobLimitSettings = new ArrayList<>(); + + // Invincible visitor settings + @ConfigComment("Invincible visitors. List of damages that will not affect visitors.") + @ConfigComment("Make list blank if visitors should receive all damages") + @ConfigEntry(path = "protection.invincible-visitors") + private List ivSettings = new ArrayList<>(); + + //---------------------------------------------------------------------------------------/ + @ConfigComment("These settings should not be edited") + @ConfigEntry(path = "do-not-edit-these-settings.reset-epoch") + private long resetEpoch = 0; + private boolean debug; + // --------------------------------------------------------------------- // Section: Getters // --------------------------------------------------------------------- @@ -2151,575 +2729,36 @@ public class Settings implements WorldSettings return Collections.emptyMap(); } - - // --------------------------------------------------------------------- - // Section: Variables - // --------------------------------------------------------------------- - - - - - /* Commands */ - @ConfigComment("Cave Command. What command users will run to access their cave.") - @ConfigComment("To define alias, just separate commands with white space.") - @ConfigEntry(path = "caveblock.command.cave") - private String playerCommandAliases = "cave cb"; - - @ConfigComment("The Cave admin command.") - @ConfigComment("To define alias, just separate commands with white space.") - @ConfigEntry(path = "caveblock.command.admin") - private String adminCommandAliases = "cbadmin cba"; - - @ConfigComment("The default action for new player command call.") - @ConfigComment("Sub-command of main player command that will be run on first player command call.") - @ConfigComment("By default it is sub-command 'create'.") - @ConfigEntry(path = "caveblock.command.new-player-action", since = "1.13.0") - private String defaultNewPlayerAction = "create"; - - @ConfigComment("The default action for player command.") - @ConfigComment("Sub-command of main player command that will be run on each player command call.") - @ConfigComment("By default it is sub-command 'go'.") - @ConfigEntry(path = "caveblock.command.default-action", since = "1.13.0") - private String defaultPlayerAction = "go"; - - /* WORLD */ - @ConfigComment("Friendly name for this world. Used in admin commands. Must be a single word") - @ConfigEntry(path = "world.friendly-name") - private String friendlyName = "CaveBlock"; - - @ConfigComment("Name of the world - if it does not exist then it will be generated.") - @ConfigComment("It acts like a prefix for nether and end (e.g. CaveBlock-world, CaveBlock-world_nether, CaveBlock-world_end)") - @ConfigEntry(path = "world.world-name") - private String worldName = "caveblock-world"; - - @ConfigComment("World difficulty setting - PEACEFUL, EASY, NORMAL, HARD") - @ConfigComment("Other plugins may override this setting") - @ConfigEntry(path = "world.difficulty") - private Difficulty difficulty = Difficulty.HARD; - - @ConfigComment("Spawn limits. These override the limits set in bukkit.yml") - @ConfigComment("If set to a negative number, the server defaults will be used") - @ConfigEntry(path = "world.spawn-limits.monsters", since = "1.15.1") - private int spawnLimitMonsters = -1; - @ConfigEntry(path = "world.spawn-limits.animals", since = "1.15.1") - private int spawnLimitAnimals = -1; - @ConfigEntry(path = "world.spawn-limits.water-animals", since = "1.15.1") - private int spawnLimitWaterAnimals = -1; - @ConfigEntry(path = "world.spawn-limits.ambient", since = "1.15.1") - private int spawnLimitAmbient = -1; - @ConfigComment("Setting to 0 will disable animal spawns, but this is not recommended. Minecraft default is 400.") - @ConfigComment("A negative value uses the server default") - @ConfigEntry(path = "world.spawn-limits.ticks-per-animal-spawns", since = "1.15.1") - private int ticksPerAnimalSpawns = -1; - @ConfigComment("Setting to 0 will disable monster spawns, but this is not recommended. Minecraft default is 400.") - @ConfigComment("A negative value uses the server default") - @ConfigEntry(path = "world.spawn-limits.ticks-per-monster-spawns", since = "1.15.1") - private int ticksPerMonsterSpawns = -1; - - @ConfigComment("Radius of cave in blocks. (So distance between caves is twice this)") - @ConfigComment("Will be rounded up to the nearest 16 blocks.") - @ConfigComment("It is the same for every dimension : Overworld, Nether and End.") - @ConfigComment("This value cannot be changed mid-game and the plugin will not start if it is different.") - @ConfigEntry(path = "world.distance-between-caves", needsReset = true) - private int islandDistance = 100; - - @ConfigComment("Default protection range radius in blocks. Cannot be larger than distance.") - @ConfigComment("Admins can change protection sizes for players individually using /cbadmin range set ") - @ConfigComment("or set this permission: caveblock.island.range.") - @ConfigEntry(path = "world.protection-range") - private int islandProtectionRange = 50; - - @ConfigComment("Start caves at these coordinates. This is where new caves will start in the") - @ConfigComment("world. These must be a factor of your cave distance, but the plugin will auto") - @ConfigComment("calculate the closest location on the grid. Caves develop around this location") - @ConfigComment("both positively and negatively in a square grid.") - @ConfigComment("If none of this makes sense, leave it at 0,0.") - @ConfigEntry(path = "world.start-x", needsReset = true) - private int islandStartX = 0; - - @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("Cave height - Lowest is 5.") - @ConfigComment("It is the y coordinate of the bedrock block in the schem.") - @ConfigEntry(path = "world.cave-height") - private int islandHeight = 60; - - @ConfigComment("Maximum number of caves in the world. Set to -1 or 0 for unlimited.") - @ConfigComment("If the number of caves is greater than this number, it will stop players from creating caves.") - @ConfigEntry(path = "world.max-caves") - private int maxIslands = -1; - - @ConfigComment("The default game mode for this world. Players will be set to this mode when they create") - @ConfigComment("a new cave for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR") - @ConfigEntry(path = "world.default-game-mode") - private GameMode defaultGameMode = GameMode.SURVIVAL; - - @ConfigComment("The default biome for the overworld") - @ConfigEntry(path = "world.default-biome") - private Biome defaultBiome = Enums.getIfPresent(Biome.class, "DRIPSTONE_CAVES").or(Biome.THE_VOID); - - @ConfigComment("The maximum number of players a player can ban at any one time in this game mode.") - @ConfigComment("The permission caveblock.ban.maxlimit.X where X is a number can also be used per player") - @ConfigComment("-1 = unlimited") - @ConfigEntry(path = "world.ban-limit") - private int banLimit = -1; - - @ConfigComment("") - @ConfigComment("This is cave.. no height... only depth. If depth is set smaller than maximal world height, then area above will be empty.") - @ConfigComment("Should not be less than cave height.") - @ConfigEntry(path = "world.world-depth", needsReset = true) - private int worldDepth = 256; - - @ConfigComment("This indicate how many times block should be tried to generate.") - @ConfigEntry(path = "world.generation-tries", needsReset = true) - private int numberOfBlockGenerationTries = 1; - - @ConfigComment("Should we use the new material generator ?") - @ConfigComment("This will generate ores and blocks similar to how vanilla does,") - @ConfigComment("but it will override the blocks settings of each world.") - @ConfigEntry(path = "world.use-new-material-generator", needsReset = true) - private boolean newMaterialGenerator = false; - - @ConfigComment("") - @ConfigComment("Make over world roof of bedrock, if false, it will be made from stone.") - @ConfigEntry(path = "world.normal.roof", needsReset = true) - private boolean normalRoof = true; - - @ConfigComment("") - @ConfigComment("Option allows to toggle if world generator should generate natural(-ish) looking surface with dirt and grass blocks.") - @ConfigComment("Enabling this option will ignore roof setting.") - @ConfigComment("Default value is false.") - @ConfigEntry(path = "world.normal.natural-surface", needsReset = true, experimental = true) - private boolean generateNaturalSurface = false; - - @ConfigComment("") - @ConfigComment("Option allows to toggle if world generator should generate natural looking caves.") - @ConfigComment("Default value is false.") - @ConfigEntry(path = "world.normal.natural-caves", needsReset = true) - private boolean generateCaves = false; - - @ConfigComment("Make over world floor of bedrock, if false, it will be made from stone.") - @ConfigEntry(path = "world.normal.floor", needsReset = true) - private boolean normalFloor = true; - - @ConfigComment("") - @ConfigComment("Option allows to toggle if world generator should generate natural looking bedrock block patterns.") - @ConfigComment("Enabling this option will ignore floor setting.") - @ConfigComment("Default value is false.") - @ConfigEntry(path = "world.normal.natural-bedrock", needsReset = true) - private boolean generateNaturalBedrock = false; - - @ConfigComment("Main block of which world will be generated.") - @ConfigEntry(path = "world.normal.main-block", needsReset = true) - private Material normalMainBlock = Material.STONE; - - @ConfigComment("Blocks that will occasionally replace main block by random chance.") - @ConfigComment("Blocks will replace only main-block and will try to create packs that") - @ConfigComment("are set in their strings. Chance of spawning also is required.") - @ConfigComment("For materials first string must be MATERIAL, for entity: ENTITY.") - @ConfigComment("Entities spawned via generator are not protected from despawing.") - @ConfigComment("Working only with 2 high mobs currently.") - @ConfigComment("Example:") - @ConfigComment("MATERIAL:DIAMOND_ORE:100:5 - means there is 100% chace of spawing diamonds") - @ConfigComment("where max amount in pack are 5 per each subchunk!") - @ConfigEntry(path = "world.normal.blocks", needsReset = true) - private List normalBlocks = new ArrayList<>(); - - // Nether - @ConfigComment("Generate Nether - if this is false, the nether world will not be made and access to") - @ConfigComment("the nether will not occur. Other plugins may still enable portal usage.") - @ConfigComment("Note: Some default challenges will not be possible if there is no nether.") - @ConfigComment("Note that with a standard nether all players arrive at the same portal and entering a") - @ConfigComment("portal will return them back to their caves.") - @ConfigEntry(path = "world.nether.generate") - private boolean netherGenerate = true; - - @ConfigComment("Caves in Nether. Change to false for standard vanilla nether.") - @ConfigEntry(path = "world.nether.caves", needsReset = true) - private boolean netherIslands = true; - - @ConfigComment("The default biome for the nether world (this may affect what mobs can spawn)") - @ConfigEntry(path = "world.nether.biome", since = "1.14.0") - private Biome defaultNetherBiome = Enums.getIfPresent(Biome.class, "NETHER_WASTES").or(Biome.THE_VOID); - - @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.") - @ConfigComment("Only applies to vanilla nether") - @ConfigEntry(path = "world.nether.spawn-radius") - private int netherSpawnRadius = 32; - - @ConfigComment("Make over world roof of bedrock, if false, it will be made from stone") - @ConfigEntry(path = "world.nether.roof", needsReset = true) - private boolean netherRoof = true; - - @ConfigComment("Make over world floor of bedrock, if false, it will be made from stone") - @ConfigEntry(path = "world.nether.floor", needsReset = true) - private boolean netherFloor = true; - - @ConfigComment("Main block of which world will be generated.") - @ConfigEntry(path = "world.nether.main-block", needsReset = true) - private Material netherMainBlock = Material.NETHERRACK; - - @ConfigComment("Blocks that will occasionally replace main block by random chance.") - @ConfigComment("Blocks will replace only main-block and will try to create packs that") - @ConfigComment("are set in their strings. Chance of spawning also is required.") - @ConfigComment("For materials first string must be MATERIAL, for entity: ENTITY.") - @ConfigComment("Entities spawned via generator are not protected from despawing.") - @ConfigComment("Working only with 2 high mobs currently.") - @ConfigComment("Example:") - @ConfigComment("MATERIAL:DIAMOND_ORE:100:5 - means there is 100% chace of spawing diamonds") - @ConfigComment("where max amount in pack are 5 per each subchunk!") - @ConfigEntry(path = "world.nether.blocks", needsReset = true) - private List netherBlocks = new ArrayList<>(); - - @ConfigComment("This option indicates if nether portals should be linked via dimensions.") - @ConfigComment("Option will simulate vanilla portal mechanics that links portals together") - @ConfigComment("or creates a new portal, if there is not a portal in that dimension.") - @ConfigEntry(path = "world.nether.create-and-link-portals") - private boolean makeNetherPortals = false; - - // End - @ConfigEntry(path = "world.end.generate") - private boolean endGenerate = true; - - @ConfigEntry(path = "world.end.caves", needsReset = true) - private boolean endIslands = true; - - @ConfigComment("The default biome for the end world (this may affect what mobs can spawn)") - @ConfigEntry(path = "world.end.biome", since = "1.14.0") - private Biome defaultTheEndBiome = Enums.getIfPresent(Biome.class, "THE_END").or(Biome.THE_VOID); - - @ConfigEntry(path = "world.end.dragon-spawn", experimental = true) - private boolean dragonSpawn = false; - - @ConfigComment("Make over world roof of bedrock, if false, it will be made from stone") - @ConfigEntry(path = "world.end.roof", needsReset = true) - private boolean endRoof = true; - - @ConfigComment("Make over world floor of bedrock, if false, it will be made from stone") - @ConfigEntry(path = "world.end.floor", needsReset = true) - private boolean endFloor = true; - - @ConfigComment("Main block of which world will be generated.") - @ConfigEntry(path = "world.end.main-block", needsReset = true) - private Material endMainBlock = Material.END_STONE; - - @ConfigComment("Blocks that will occasionally replace main block by random chance.") - @ConfigComment("Blocks will replace only main-block and will try to create packs that") - @ConfigComment("are set in their strings. Chance of spawning also is required.") - @ConfigComment("For materials first string must be MATERIAL, for entity: ENTITY.") - @ConfigComment("Entities spawned via generator are not protected from despawing.") - @ConfigComment("Working only with 2 high mobs currently.") - @ConfigComment("Example:") - @ConfigComment("MATERIAL:DIAMOND_ORE:100:5 - means there is 100% chace of spawing diamonds") - @ConfigComment("where max amount in pack are 5 per each subchunk!") - @ConfigEntry(path = "world.end.blocks", needsReset = true) - private List endBlocks = new ArrayList<>(); - - @ConfigComment("This option indicates if obsidian platform in the end should be generated") - @ConfigComment("when player enters the end world.") - @ConfigEntry(path = "world.end.create-obsidian-platform") - private boolean makeEndPortals = false; - - // Other staff. - - @ConfigComment("Mob white list - these mobs will NOT be removed when logging in or doing /cave") - @ConfigEntry(path = "world.remove-mobs-whitelist") - private Set removeMobsWhitelist = new HashSet<>(); - - @ConfigComment("World flags. These are boolean settings for various flags for this world") - @ConfigEntry(path = "world.flags") - private Map worldFlags = new HashMap<>(); - - @ConfigComment("These are the default protection settings for new caves.") - @ConfigComment("The value is the minimum cave rank required allowed to do the action.") - @ConfigComment("Ranks are the following:") - @ConfigComment(" VISITOR = 0") - @ConfigComment(" COOP = 200") - @ConfigComment(" TRUSTED = 400") - @ConfigComment(" MEMBER = 500") - @ConfigComment(" SUB-OWNER = 900") - @ConfigComment(" OWNER = 1000") - @ConfigEntry(path = "world.default-cave-flags") - private Map defaultIslandFlags = new HashMap<>(); - - @ConfigComment("These are the default settings for new caves") - @ConfigEntry(path = "world.default-cave-settings") - private Map defaultIslandSettings = new HashMap<>(); - - @ConfigComment("These settings/flags are hidden from users") - @ConfigComment("Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings") - @ConfigEntry(path = "world.hidden-flags") - private List hiddenFlags = new ArrayList<>(); - - @ConfigComment("Visitor banned commands - Visitors to caves cannot use these commands in this world") - @ConfigEntry(path = "world.visitor-banned-commands") - private List visitorBannedCommands = new ArrayList<>(); - - @ConfigComment("Falling banned commands - players cannot use these commands when falling") - @ConfigComment("if the PREVENT_TELEPORT_WHEN_FALLING world setting flag is active") - @ConfigEntry(path = "world.falling-banned-commands") - private List fallingBannedCommands = new ArrayList<>(); - - // --------------------------------------------- - - /* Cave */ - @ConfigComment("Default max team size") - @ConfigComment("Permission size cannot be less than the default below. ") - @ConfigEntry(path = "cave.max-team-size") - private int maxTeamSize = 4; - - @ConfigComment("Default maximum number of coop rank members per cave") - @ConfigComment("Players can have the caveblock.coop.maxsize. permission to be bigger but") - @ConfigComment("permission size cannot be less than the default below. ") - @ConfigEntry(path = "cave.max-coop-size", since = "1.13.0") - private int maxCoopSize = 4; - - @ConfigComment("Default maximum number of trusted rank members per cave") - @ConfigComment("Players can have the caveblock.trust.maxsize. permission to be bigger but") - @ConfigComment("permission size cannot be less than the default below. ") - @ConfigEntry(path = "cave.max-trusted-size", since = "1.13.0") - private int maxTrustSize = 4; - - @ConfigComment("Default maximum number of homes a player can have. Min = 1") - @ConfigComment("Accessed via /cave sethome or /cave go ") - @ConfigEntry(path = "cave.max-homes") - private int maxHomes = 5; - - // Reset - @ConfigComment("How many resets a player is allowed (override with /cbadmin clearresets )") - @ConfigComment("Value of -1 means unlimited, 0 means hardcore - no resets.") - @ConfigComment("Example, 2 resets means they get 2 resets or 3 caves lifetime") - @ConfigEntry(path = "cave.reset.reset-limit") - private int resetLimit = -1; - - @ConfigComment("Kicked or leaving players lose resets") - @ConfigComment("Players who leave a team will lose a cave reset chance") - @ConfigComment("If a player has zero resets left and leaves a team, they cannot make a new") - @ConfigComment("cave by themselves and can only join a team.") - @ConfigComment("Leave this true to avoid players exploiting free caves") - @ConfigEntry(path = "cave.reset.leavers-lose-reset") - private boolean leaversLoseReset = false; - - @ConfigComment("Allow kicked players to keep their inventory.") - @ConfigComment("Overrides the on-leave inventory reset for kicked players.") - @ConfigEntry(path = "cave.reset.kicked-keep-inventory") - private boolean kickedKeepInventory = false; - - @ConfigComment("What the plugin should reset when the player joins or creates a cave") - @ConfigComment("Reset Money - if this is true, will reset the player's money to the starting money") - @ConfigComment("Recommendation is that this is set to true, but if you run multi-worlds") - @ConfigComment("make sure your economy handles multi-worlds too.") - @ConfigEntry(path = "cave.reset.on-join.money") - private boolean onJoinResetMoney = false; - - @ConfigComment("Reset inventory - if true, the player's inventory will be cleared.") - @ConfigComment("Note: if you have MultiInv running or a similar inventory control plugin, that") - @ConfigComment("plugin may still reset the inventory when the world changes.") - @ConfigEntry(path = "cave.reset.on-join.inventory") - private boolean onJoinResetInventory = false; - - @ConfigComment("Reset health - if true, the player's health will be reset.") - @ConfigEntry(path = "cave.reset.on-join.health") - private boolean onJoinResetHealth = true; - - @ConfigComment("Reset hunger - if true, the player's hunger will be reset.") - @ConfigEntry(path = "cave.reset.on-join.hunger") - private boolean onJoinResetHunger = true; - - @ConfigComment("Reset experience points - if true, the player's experience will be reset.") - @ConfigEntry(path = "cave.reset.on-join.exp") - private boolean onJoinResetXP = false; - - @ConfigComment("Reset Ender Chest - if true, the player's Ender Chest will be cleared.") - @ConfigEntry(path = "cave.reset.on-join.ender-chest") - private boolean onJoinResetEnderChest = false; - - @ConfigComment("What the plugin should reset when the player leaves or is kicked from a cave") - @ConfigComment("Reset Money - if this is true, will reset the player's money to the starting money") - @ConfigComment("Recommendation is that this is set to true, but if you run multi-worlds") - @ConfigComment("make sure your economy handles multi-worlds too.") - @ConfigEntry(path = "cave.reset.on-leave.money") - private boolean onLeaveResetMoney = false; - - @ConfigComment("Reset inventory - if true, the player's inventory will be cleared.") - @ConfigComment("Note: if you have MultiInv running or a similar inventory control plugin, that") - @ConfigComment("plugin may still reset the inventory when the world changes.") - @ConfigEntry(path = "cave.reset.on-leave.inventory") - private boolean onLeaveResetInventory = false; - - @ConfigComment("Reset health - if true, the player's health will be reset.") - @ConfigEntry(path = "cave.reset.on-leave.health") - private boolean onLeaveResetHealth = false; - - @ConfigComment("Reset hunger - if true, the player's hunger will be reset.") - @ConfigEntry(path = "cave.reset.on-leave.hunger") - private boolean onLeaveResetHunger = false; - - @ConfigComment("Reset experience - if true, the player's experience will be reset.") - @ConfigEntry(path = "cave.reset.on-leave.exp") - private boolean onLeaveResetXP = false; - - @ConfigComment("Reset Ender Chest - if true, the player's Ender Chest will be cleared.") - @ConfigEntry(path = "cave.reset.on-leave.ender-chest") - private boolean onLeaveResetEnderChest = false; - - @ConfigComment("Toggles the automatic cave creation upon the player's first login on your server.") - @ConfigComment("If set to true,") - @ConfigComment(" * Upon connecting to your server for the first time, the player will be told that") - @ConfigComment(" a cave will be created for him.") - @ConfigComment(" * Make sure you have a Blueprint Bundle called \"default\": this is the one that will") - @ConfigComment(" be used to create the cave.") - @ConfigComment(" * A cave will be created for the player without needing him to run the create command.") - @ConfigComment("If set to false, this will disable this feature entirely.") - @ConfigComment("Warning:") - @ConfigComment(" * If you are running multiple gamemodes on your server, and all of them have") - @ConfigComment(" this feature enabled, a cave in all the gamemodes will be created simultaneously.") - @ConfigComment(" However, it is impossible to know on which cave the player will be teleported to afterwards.") - @ConfigComment(" * Cave creation can be resource-intensive, please consider the options below to help mitigate") - @ConfigComment(" the potential issues, especially if you expect a lot of players to connect to your server") - @ConfigComment(" in a limited period of time.") - @ConfigEntry(path = "cave.create-cave-on-first-login.enable") - private boolean createIslandOnFirstLoginEnabled; - - @ConfigComment("Time in seconds after the player logged in, before his cave gets created.") - @ConfigComment("If set to 0 or less, the cave will be created directly upon the player's login.") - @ConfigComment("It is recommended to keep this value under a minute's time.") - @ConfigEntry(path = "cave.create-cave-on-first-login.delay") - private int createIslandOnFirstLoginDelay = 5; - - @ConfigComment("Toggles whether the cave creation should be aborted if the player logged off while the") - @ConfigComment("delay (see the option above) has not worn off yet.") - @ConfigComment("If set to true,") - @ConfigComment(" * If the player has logged off the server while the delay (see the option above) has not") - @ConfigComment(" worn off yet, this will cancel the cave creation.") - @ConfigComment(" * If the player relogs afterward, since he will not be recognized as a new player, no cave") - @ConfigComment(" would be created for him.") - @ConfigComment(" * If the cave creation started before the player logged off, it will continue.") - @ConfigComment("If set to false, the player's cave will be created even if he went offline in the meantime.") - @ConfigComment("Note this option has no effect if the delay (see the option above) is set to 0 or less.") - @ConfigEntry(path = "cave.create-cave-on-first-login.abort-on-logout") - private boolean createIslandOnFirstLoginAbortOnLogout = true; - - @ConfigComment("Toggles whether the player should be teleported automatically to his cave when it is created.") - @ConfigComment("If set to false, the player will be told his cave is ready but will have to teleport to his cave using the command.") - @ConfigEntry(path = "cave.teleport-player-to-cave-when-created", since = "1.10.0") - private boolean teleportPlayerToIslandUponIslandCreation = true; - - @ConfigComment("Create Nether or End cave if they are missing when a player goes through a portal.") - @ConfigComment("Nether and End cave are usually pasted when a player makes their cave, but if they are") - @ConfigComment("missing for some reason, you can switch this on.") - @ConfigComment("Note that bedrock removal glitches can exploit this option.") - @ConfigEntry(path = "cave.create-missing-nether-end-caves", since = "1.10.0") - private boolean pasteMissingIslands = false; - - // Commands - @ConfigComment("List of commands to run when a player joins an cave or creates one.") - @ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,") - @ConfigComment("in which case they are executed by the player.") - @ConfigComment("") - @ConfigComment("Available placeholders for the commands are the following:") - @ConfigComment(" * [name]: name of the player") - @ConfigComment("") - @ConfigComment("Here are some examples of valid commands to execute:") - @ConfigComment(" * '[SUDO] bbox version'") - @ConfigComment(" * 'bsbadmin deaths set [player] 0'") - @ConfigComment("") - @ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.") - @ConfigEntry(path = "cave.commands.on-join", since = "1.8.0") - private List onJoinCommands = new ArrayList<>(); - - @ConfigComment("List of commands to run when a player leaves a cave, resets his cave or gets kicked from it.") - @ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,") - @ConfigComment("in which case they are executed by the player.") - @ConfigComment("") - @ConfigComment("Available placeholders for the commands are the following:") - @ConfigComment(" * [name]: name of the player") - @ConfigComment("") - @ConfigComment("Here are some examples of valid commands to execute:") - @ConfigComment(" * '[SUDO] bbox version'") - @ConfigComment(" * 'bsbadmin deaths set [player] 0'") - @ConfigComment("") - @ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.") - @ConfigEntry(path = "cave.commands.on-leave", since = "1.8.0") - private List onLeaveCommands = new ArrayList<>(); - - @ConfigComment("List of commands that should be executed when the player respawns after death if Flags.ISLAND_RESPAWN is true.") - @ConfigComment("These commands are run by the console, unless otherwise stated using the [SUDO] prefix,") - @ConfigComment("in which case they are executed by the player.") - @ConfigComment("") - @ConfigComment("Available placeholders for the commands are the following:") - @ConfigComment(" * [name]: name of the player") - @ConfigComment("") - @ConfigComment("Here are some examples of valid commands to execute:") - @ConfigComment(" * '[SUDO] bbox version'") - @ConfigComment(" * 'bsbadmin deaths set [player] 0'") - @ConfigComment("") - @ConfigComment("Note that player-executed commands might not work, as these commands can be run with said player being offline.") - @ConfigEntry(path = "cave.commands.on-respawn", since = "1.14.0") - private List onRespawnCommands = new ArrayList<>(); - - // Sethome - @ConfigComment("Allow setting home in the nether. Only available on nether islands, not vanilla nether.") - @ConfigEntry(path = "cave.sethome.nether.allow") - private boolean allowSetHomeInNether = true; - - @ConfigEntry(path = "cave.sethome.nether.require-confirmation") - private boolean requireConfirmationToSetHomeInNether = true; - - @ConfigComment("Allow setting home in the end. Only available on end islands, not vanilla end.") - @ConfigEntry(path = "cave.sethome.the-end.allow") - private boolean allowSetHomeInTheEnd = true; - - @ConfigEntry(path = "cave.sethome.the-end.require-confirmation") - private boolean requireConfirmationToSetHomeInTheEnd = true; - - // Deaths - @ConfigComment("Whether deaths are counted or not.") - @ConfigEntry(path = "cave.deaths.counted") - private boolean deathsCounted = true; - - @ConfigComment("Maximum number of deaths to count. The death count can be used by add-ons.") - @ConfigEntry(path = "cave.deaths.max") - private int deathsMax = 10; - - @ConfigComment("Reset player death count when they start a new cave or reset a cave") - @ConfigEntry(path = "cave.deaths.reset-on-new") - private boolean deathsResetOnNewIsland = true; - - @ConfigComment("When a player joins a team, reset their death count") - @ConfigEntry(path = "cave.deaths.team-join-reset") - private boolean teamJoinDeathReset = true; - - // --------------------------------------------- - /* PROTECTION */ - - @ConfigComment("Geo restrict mobs.") - @ConfigComment("Mobs that exit the cave space where they were spawned will be removed.") - @ConfigEntry(path = "protection.geo-limit-settings") - private List geoLimitSettings = new ArrayList<>(); - - @ConfigComment("CaveBlock blocked mobs.") - @ConfigComment("List of mobs that should not spawn in the CaveBlock.") - @ConfigEntry(path = "protection.block-mobs", since = "1.13.0") - private List mobLimitSettings = new ArrayList<>(); - - // Invincible visitor settings - @ConfigComment("Invincible visitors. List of damages that will not affect visitors.") - @ConfigComment("Make list blank if visitors should receive all damages") - @ConfigEntry(path = "protection.invincible-visitors") - private List ivSettings = new ArrayList<>(); - - //---------------------------------------------------------------------------------------/ - @ConfigComment("These settings should not be edited") - @ConfigEntry(path = "do-not-edit-these-settings.reset-epoch") - private long resetEpoch = 0; - private boolean debug; + /** + * @return the disallowTeamMemberIslands + */ + @Override + public boolean isDisallowTeamMemberIslands() { + return disallowTeamMemberIslands; + } + + /** + * @param disallowTeamMemberIslands the disallowTeamMemberIslands to set + */ + public void setDisallowTeamMemberIslands(boolean disallowTeamMemberIslands) { + this.disallowTeamMemberIslands = disallowTeamMemberIslands; + } + + /** + * @return the concurrentIslands + */ + @Override + public int getConcurrentIslands() { + if (concurrentIslands <= 0) { + return BentoBox.getInstance().getSettings().getIslandNumber(); + } + return concurrentIslands; + } + + /** + * @param concurrentIslands the concurrentIslands to set + */ + public void setConcurrentIslands(int concurrentIslands) { + this.concurrentIslands = concurrentIslands; + } } diff --git a/src/main/java/world/bentobox/caveblock/generators/populators/NewMaterialPopulator.java b/src/main/java/world/bentobox/caveblock/generators/populators/NewMaterialPopulator.java index 11f1074..75e217f 100644 --- a/src/main/java/world/bentobox/caveblock/generators/populators/NewMaterialPopulator.java +++ b/src/main/java/world/bentobox/caveblock/generators/populators/NewMaterialPopulator.java @@ -1,16 +1,22 @@ package world.bentobox.caveblock.generators.populators; +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.LimitedRegion; import org.bukkit.generator.WorldInfo; + import world.bentobox.caveblock.Utils; import world.bentobox.caveblock.generators.Ore; -import java.util.*; - /** * @author tastybento */ @@ -19,95 +25,102 @@ public class NewMaterialPopulator extends BlockPopulator { private static final Map> ORES; static { - Map> ores = new EnumMap<>(World.Environment.class); - // Source https://minecraft.fandom.com/wiki/Blob - List worldOres = new ArrayList<>(); - worldOres.add(new Ore(-64, 7, Material.DEEPSLATE_DIAMOND_ORE, 1, 10, true)); - worldOres.add(new Ore(7, 16, Material.DIAMOND_ORE, 1, 10, true)); - worldOres.add(new Ore(-64, 7, Material.DEEPSLATE_LAPIS_ORE, 1, 7, true)); - worldOres.add(new Ore(7, 64, Material.LAPIS_ORE, 1, 7, true)); - worldOres.add(new Ore(-64, 7, Material.DEEPSLATE_GOLD_ORE, 2, 9, true)); - worldOres.add(new Ore(7, 30, Material.GOLD_ORE, 2, 9, true)); - worldOres.add(new Ore(0, 16, Material.TUFF, 2, 33, false)); - worldOres.add(new Ore(-64, 7, Material.DEEPSLATE_REDSTONE_ORE, 8, 8, true)); - worldOres.add(new Ore(7, 16, Material.REDSTONE_ORE, 8, 8, true)); - worldOres.add(new Ore(0, 16, Material.GRAVEL, 8, 33, false)); - worldOres.add(new Ore(0, 79, Material.GRANITE, 5, 33, false)); - worldOres.add(new Ore(0, 79, Material.ANDESITE, 5, 33, false)); - worldOres.add(new Ore(0, 79, Material.DIORITE, 5, 33, false)); - worldOres.add(new Ore(32, 320, Material.EMERALD_ORE, 11, 1, true)); - worldOres.add(new Ore(95, 136, Material.COAL_ORE, 20, 17, false)); - worldOres.add(new Ore(0, 7, Material.DEEPSLATE_COPPER_ORE, 20, 9, true)); - worldOres.add(new Ore(7, 96, Material.COPPER_ORE, 20, 9, true)); - worldOres.add(new Ore(-64, 7, Material.DEEPSLATE_IRON_ORE, 20, 9, true)); - worldOres.add(new Ore(7, 320, Material.IRON_ORE, 20, 9, true)); - worldOres.add(new Ore(-64, 320, Material.CAVE_AIR, 8, 33, false)); - ores.put(World.Environment.NORMAL, worldOres); - List netherOres = new ArrayList<>(); - netherOres.add(new Ore(1, 22, Material.ANCIENT_DEBRIS, 1, 5, true)); - netherOres.add(new Ore(-64, 30, Material.NETHER_GOLD_ORE, 2, 9, true)); - netherOres.add(new Ore(0, 16, Material.GRAVEL, 8, 33, false)); - netherOres.add(new Ore(0, 320, Material.BASALT, 8, 33, false)); - netherOres.add(new Ore(0, 320, Material.BLACKSTONE, 8, 33, false)); - netherOres.add(new Ore(0, 320, Material.FIRE, 8, 33, false)); - netherOres.add(new Ore(200, 320, Material.GLOWSTONE, 8, 33, false)); - netherOres.add(new Ore(-64, 320, Material.CAVE_AIR, 8, 33, false)); - netherOres.add(new Ore(-64, 320, Material.LAVA, 8, 33, false)); - netherOres.add(new Ore(0, 16, Material.MAGMA_BLOCK, 8, 33, false)); - netherOres.add(new Ore(0, 320, Material.CRIMSON_FUNGUS, 8, 33, false)); - netherOres.add(new Ore(0, 320, Material.WARPED_FUNGUS, 8, 33, false)); - netherOres.add(new Ore(0, 320, Material.CRIMSON_NYLIUM, 8, 33, false)); - netherOres.add(new Ore(0, 320, Material.WARPED_NYLIUM, 8, 33, false)); - netherOres.add(new Ore(0, 320, Material.SHROOMLIGHT, 8, 33, false)); - netherOres.add(new Ore(0, 320, Material.CRIMSON_STEM, 8, 33, false)); - netherOres.add(new Ore(0, 320, Material.WARPED_STEM, 8, 33, false)); - netherOres.add(new Ore(-64, 34, Material.SOUL_SOIL, 20, 17, false)); - netherOres.add(new Ore(0, 96, Material.NETHER_QUARTZ_ORE, 20, 9, true)); - netherOres.add(new Ore(-64, 320, Material.BONE_BLOCK, 20, 9, true)); - ores.put(World.Environment.NETHER, netherOres); - List endOres = new ArrayList<>(); - endOres.add(new Ore(32, 320, Material.PURPUR_BLOCK, 11, 1, true)); - endOres.add(new Ore(95, 136, Material.OBSIDIAN, 20, 17, false)); - endOres.add(new Ore(-64, 320, Material.CAVE_AIR, 8, 33, false)); - ores.put(World.Environment.THE_END, endOres); - ORES = Collections.unmodifiableMap(ores); + Map> ores = new EnumMap<>(World.Environment.class); + // Source https://minecraft.fandom.com/wiki/Blob + List worldOres = new ArrayList<>(); + worldOres.add(new Ore(-64, 7, Material.DEEPSLATE_DIAMOND_ORE, 1, 10, true)); + worldOres.add(new Ore(7, 16, Material.DIAMOND_ORE, 1, 10, true)); + worldOres.add(new Ore(-64, 7, Material.DEEPSLATE_LAPIS_ORE, 1, 7, true)); + worldOres.add(new Ore(7, 64, Material.LAPIS_ORE, 1, 7, true)); + worldOres.add(new Ore(-64, 7, Material.DEEPSLATE_GOLD_ORE, 2, 9, true)); + worldOres.add(new Ore(7, 30, Material.GOLD_ORE, 2, 9, true)); + worldOres.add(new Ore(0, 16, Material.TUFF, 2, 33, false)); + worldOres.add(new Ore(-64, 7, Material.DEEPSLATE_REDSTONE_ORE, 8, 8, true)); + worldOres.add(new Ore(7, 16, Material.REDSTONE_ORE, 8, 8, true)); + worldOres.add(new Ore(0, 16, Material.GRAVEL, 8, 33, false)); + worldOres.add(new Ore(0, 79, Material.GRANITE, 5, 33, false)); + worldOres.add(new Ore(0, 79, Material.ANDESITE, 5, 33, false)); + worldOres.add(new Ore(0, 79, Material.DIORITE, 5, 33, false)); + worldOres.add(new Ore(32, 320, Material.EMERALD_ORE, 11, 1, true)); + worldOres.add(new Ore(95, 136, Material.COAL_ORE, 20, 17, false)); + worldOres.add(new Ore(0, 7, Material.DEEPSLATE_COPPER_ORE, 20, 9, true)); + worldOres.add(new Ore(7, 96, Material.COPPER_ORE, 20, 9, true)); + worldOres.add(new Ore(-64, 7, Material.DEEPSLATE_IRON_ORE, 20, 9, true)); + worldOres.add(new Ore(7, 320, Material.IRON_ORE, 20, 9, true)); + worldOres.add(new Ore(-64, 320, Material.CAVE_AIR, 8, 33, false)); + ores.put(World.Environment.NORMAL, worldOres); + List netherOres = new ArrayList<>(); + netherOres.add(new Ore(1, 22, Material.ANCIENT_DEBRIS, 1, 5, true)); + netherOres.add(new Ore(-64, 30, Material.NETHER_GOLD_ORE, 2, 9, true)); + netherOres.add(new Ore(0, 16, Material.GRAVEL, 8, 33, false)); + netherOres.add(new Ore(0, 320, Material.BASALT, 8, 33, false)); + netherOres.add(new Ore(0, 320, Material.BLACKSTONE, 8, 33, false)); + netherOres.add(new Ore(0, 320, Material.FIRE, 8, 33, false)); + netherOres.add(new Ore(200, 320, Material.GLOWSTONE, 8, 33, false)); + netherOres.add(new Ore(-64, 320, Material.CAVE_AIR, 8, 33, false)); + netherOres.add(new Ore(-64, 320, Material.LAVA, 8, 33, false)); + netherOres.add(new Ore(0, 16, Material.MAGMA_BLOCK, 8, 33, false)); + netherOres.add(new Ore(0, 320, Material.CRIMSON_FUNGUS, 8, 33, false)); + netherOres.add(new Ore(0, 320, Material.WARPED_FUNGUS, 8, 33, false)); + netherOres.add(new Ore(0, 320, Material.CRIMSON_NYLIUM, 8, 33, false)); + netherOres.add(new Ore(0, 320, Material.WARPED_NYLIUM, 8, 33, false)); + netherOres.add(new Ore(0, 320, Material.SHROOMLIGHT, 8, 33, false)); + netherOres.add(new Ore(0, 320, Material.CRIMSON_STEM, 8, 33, false)); + netherOres.add(new Ore(0, 320, Material.WARPED_STEM, 8, 33, false)); + netherOres.add(new Ore(-64, 34, Material.SOUL_SOIL, 20, 17, false)); + netherOres.add(new Ore(0, 96, Material.NETHER_QUARTZ_ORE, 20, 9, true)); + netherOres.add(new Ore(-64, 320, Material.BONE_BLOCK, 20, 9, true)); + ores.put(World.Environment.NETHER, netherOres); + List endOres = new ArrayList<>(); + endOres.add(new Ore(32, 320, Material.PURPUR_BLOCK, 11, 1, true)); + endOres.add(new Ore(95, 136, Material.OBSIDIAN, 20, 17, false)); + endOres.add(new Ore(-64, 320, Material.CAVE_AIR, 8, 33, false)); + ores.put(World.Environment.THE_END, endOres); + ORES = Collections.unmodifiableMap(ores); } private final int worldDepth; + /** + * @param worldDepth - Depth. If depth is set smaller than the world height, + * then the area above will be empty. Should not be less than + * cave height. + */ public NewMaterialPopulator(int worldDepth) { - this.worldDepth = worldDepth; + this.worldDepth = worldDepth; } @Override public void populate(WorldInfo worldInfo, Random random, int chunkX, int chunkZ, LimitedRegion limitedRegion) { - final int worldHeight = Math.min(worldInfo.getMaxHeight(), this.worldDepth); - for (int y = worldInfo.getMinHeight(); y < worldHeight - 1; y++) { - for (Ore o : ORES.get(worldInfo.getEnvironment())) { - if (y > o.minY() && y < o.maxY() && random.nextInt(100) <= o.chance()) { - pasteBlob(worldInfo, random, chunkX, chunkZ, limitedRegion, y, o); - if (o.cont()) { - break; - } - } - } - } + final int worldHeight = Math.min(worldInfo.getMaxHeight(), this.worldDepth); + for (int y = worldInfo.getMinHeight() + 1; y < worldHeight - 1; y++) { + for (Ore o : ORES.get(worldInfo.getEnvironment())) { + if (y > o.minY() && y < o.maxY() && random.nextInt(100) <= o.chance()) { + pasteBlob(worldInfo, random, chunkX, chunkZ, limitedRegion, y, o); + if (o.cont()) { + break; + } + } + } + } } - private void pasteBlob(WorldInfo worldInfo, Random random, int chunkX, int chunkZ, LimitedRegion limitedRegion, int y, Ore o) { - int offset = random.nextInt(16); - for (int x = Math.max(0, offset - BLOB_SIZE); x < Math.min(16, offset + BLOB_SIZE); x++) { - for (int z = Math.max(0, offset - BLOB_SIZE); z < Math.min(16, offset + BLOB_SIZE); z++) { - for (int yy = Math.max(worldInfo.getMinHeight(), y - BLOB_SIZE); yy < Math.min(worldInfo.getMaxHeight(), y + BLOB_SIZE); yy++) { - Location location = Utils.getLocationFromChunkLocation(x, yy, z, chunkX, chunkZ); - if (!limitedRegion.isInRegion(location)) { - continue; - } - if (limitedRegion.getType(location).isSolid() && random.nextBoolean()) { - limitedRegion.setType(location, o.material()); - } - } - } - } + private void pasteBlob(WorldInfo worldInfo, Random random, int chunkX, int chunkZ, LimitedRegion limitedRegion, + int y, Ore o) { + int offset = random.nextInt(16); + for (int x = Math.max(0, offset - BLOB_SIZE); x < Math.min(16, offset + BLOB_SIZE); x++) { + for (int z = Math.max(0, offset - BLOB_SIZE); z < Math.min(16, offset + BLOB_SIZE); z++) { + for (int yy = Math.max(worldInfo.getMinHeight() + 1, y - BLOB_SIZE); yy < Math + .min(worldInfo.getMaxHeight() - 1, y + BLOB_SIZE); yy++) { + Location location = Utils.getLocationFromChunkLocation(x, yy, z, chunkX, chunkZ); + if (!limitedRegion.isInRegion(location)) { + continue; + } + if (limitedRegion.getType(location).isSolid() && random.nextBoolean()) { + limitedRegion.setType(location, o.material()); + } + } + } + } } } diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml index d1a8bfe..6d89523 100644 --- a/src/main/resources/addon.yml +++ b/src/main/resources/addon.yml @@ -1,7 +1,7 @@ name: CaveBlock main: world.bentobox.caveblock.CaveBlock version: ${version}${build.number} -api-version: 1.23.0 +api-version: 2.5.0 metrics: true repository: "BentoBoxWorld/CaveBlock" icon: "STONE_PICKAXE" diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 6dd742c..25d5d16 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,4 +1,4 @@ -# CaveBlock Configuration 1.15.0-SNAPSHOT-LOCAL +# CaveBlock Configuration ${version} caveblock: command: # Cave Command. What command users will run to access their cave. @@ -72,6 +72,11 @@ world: # Maximum number of caves in the world. Set to -1 or 0 for unlimited. # If the number of caves is greater than this number, it will stop players from creating caves. max-caves: 0 + # The number of concurrent caves a player can have + # A value of 0 will use the BentoBox config.yml default + concurrent-caves: 0 + # Disallow team members from having their own caves. + disallow-team-member-caves: true # The default game mode for this world. Players will be set to this mode when they create # a new cave for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR default-game-mode: SURVIVAL @@ -81,7 +86,7 @@ world: # The permission caveblock.ban.maxlimit.X where X is a number can also be used per player # -1 = unlimited ban-limit: -1 - # + # # This is cave.. no height... only depth. If depth is set smaller than maximal world height, then area above will be empty. # Should not be less than cave height. # /!\ 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. @@ -95,18 +100,18 @@ world: # /!\ 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. use-new-material-generator: false normal: - # + # # Make over world roof of bedrock, if false, it will be made from stone. # /!\ 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. roof: true - # + # # Option allows to toggle if world generator should generate natural(-ish) looking surface with dirt and grass blocks. # Enabling this option will ignore roof setting. # Default value is false. # /!\ This feature is experimental and might not work as expected or might not work at all. # /!\ 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. natural-surface: false - # + # # Option allows to toggle if world generator should generate natural looking caves. # Default value is false. # /!\ 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. @@ -114,7 +119,7 @@ world: # Make over world floor of bedrock, if false, it will be made from stone. # /!\ 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. floor: true - # + # # Option allows to toggle if world generator should generate natural looking bedrock block patterns. # Enabling this option will ignore floor setting. # Default value is false. @@ -134,24 +139,24 @@ world: # where max amount in pack are 5 per each subchunk! # /!\ 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. blocks: - - MATERIAL:DIAMOND_ORE:1:5 - - MATERIAL:GOLD_ORE:1:4 - - MATERIAL:IRON_ORE:5:4 - - MATERIAL:COAL_ORE:10:6 - - MATERIAL:EMERALD_ORE:1:1 - - MATERIAL:CLAY:10:6 - - MATERIAL:DIRT:20:10 - - MATERIAL:GRAVEL:40:6 - - MATERIAL:GRANITE:40:10 - - MATERIAL:ANDESITE:20:10 - - MATERIAL:DIORITE:30:8 - - ENTITY:ZOMBIE:10:1 - - ENTITY:ENDERMAN:10:1 - - ENTITY:SKELETON:10:1 - - ENTITY:CREEPER:1:1 - - ENTITY:DOLPHIN:1:1 - - ENTITY:BAT:10:1 - - ENTITY:CAVE_SPIDER:10:1 + - MATERIAL:DIAMOND_ORE:1:5 + - MATERIAL:GOLD_ORE:1:4 + - MATERIAL:IRON_ORE:5:4 + - MATERIAL:COAL_ORE:10:6 + - MATERIAL:EMERALD_ORE:1:1 + - MATERIAL:CLAY:10:6 + - MATERIAL:DIRT:20:10 + - MATERIAL:GRAVEL:40:6 + - MATERIAL:GRANITE:40:10 + - MATERIAL:ANDESITE:20:10 + - MATERIAL:DIORITE:30:8 + - ENTITY:ZOMBIE:10:1 + - ENTITY:ENDERMAN:10:1 + - ENTITY:SKELETON:10:1 + - ENTITY:CREEPER:1:1 + - ENTITY:DOLPHIN:1:1 + - ENTITY:BAT:10:1 + - ENTITY:CAVE_SPIDER:10:1 nether: # Generate Nether - if this is false, the nether world will not be made and access to # the nether will not occur. Other plugins may still enable portal usage. @@ -190,16 +195,16 @@ world: # where max amount in pack are 5 per each subchunk! # /!\ 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. blocks: - - MATERIAL:NETHER_QUARTZ_ORE:30:5 - - MATERIAL:SOUL_SAND:40:10 - - MATERIAL:MAGMA_BLOCK:10:3 - - MATERIAL:GLOWSTONE:20:8 - - MATERIAL:NETHER_BRICKS:10:5 - - MATERIAL:LAVA:10:1 - - ENTITY:MAGMA_CUBE:0.5:1 - - ENTITY:GHAST:0.1:1 - - ENTITY:WITHER_SKELETON:0.1:1 - - MATERIAL:FIRE:10:1 + - MATERIAL:NETHER_QUARTZ_ORE:30:5 + - MATERIAL:SOUL_SAND:40:10 + - MATERIAL:MAGMA_BLOCK:10:3 + - MATERIAL:GLOWSTONE:20:8 + - MATERIAL:NETHER_BRICKS:10:5 + - MATERIAL:LAVA:10:1 + - ENTITY:MAGMA_CUBE:0.5:1 + - ENTITY:GHAST:0.1:1 + - ENTITY:WITHER_SKELETON:0.1:1 + - MATERIAL:FIRE:10:1 # This option indicates if nether portals should be linked via dimensions. # Option will simulate vanilla portal mechanics that links portals together # or creates a new portal, if there is not a portal in that dimension. @@ -233,17 +238,17 @@ world: # where max amount in pack are 5 per each subchunk! # /!\ 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. blocks: - - ENTITY:SHULKER:0.2:1 - - MATERIAL:OBSIDIAN:1:1 - - MATERIAL:CHORUS_PLANT:1:3 + - ENTITY:SHULKER:0.2:1 + - MATERIAL:OBSIDIAN:1:1 + - MATERIAL:CHORUS_PLANT:1:3 # This option indicates if obsidian platform in the end should be generated # when player enters the end world. create-obsidian-platform: false # Mob white list - these mobs will NOT be removed when logging in or doing /cave remove-mobs-whitelist: - - ZOMBIE_VILLAGER - - WITHER - - ENDERMAN + - WITHER + - ENDERMAN + - ZOMBIE_VILLAGER # World flags. These are boolean settings for various flags for this world flags: CREEPER_DAMAGE: true @@ -278,112 +283,33 @@ world: # MEMBER = 500 # SUB-OWNER = 900 # OWNER = 1000 - default-cave-flags: - HURT_ANIMALS: 500 - DRAGON_EGG: 500 - REDSTONE: 500 - BUCKET: 500 - LOCK: 0 - ENDER_PEARL: 500 - DOOR: 500 - BREAK_HOPPERS: 500 - FURNACE: 500 - ANVIL: 500 - MINECART: 500 - FISH_SCOOPING: 500 - END_PORTAL: 500 - BREEDING: 500 - HURT_VILLAGERS: 500 - FROST_WALKER: 500 - TURTLE_EGGS: 500 - COLLECT_LAVA: 500 - BREAK_SPAWNERS: 500 - LEVER: 500 - ELYTRA: 0 - CAKE: 500 - RIDING: 500 - HURT_MONSTERS: 0 - NAME_TAG: 500 - ARMOR_STAND: 500 - TRADING: 0 - EGGS: 500 - ITEM_DROP: 0 - NOTE_BLOCK: 0 - FLINT_AND_STEEL: 500 - NETHER_PORTAL: 500 - LECTERN: 500 - CROP_TRAMPLE: 500 - ITEM_PICKUP: 0 - BREWING: 500 - DROPPER: 500 - TNT_PRIMING: 500 - COLLECT_WATER: 500 - BUTTON: 500 - FIRE_EXTINGUISH: 500 - COMMAND_RANKS: 500 - BEACON: 500 - TRAPDOOR: 500 - PRESSURE_PLATE: 0 - EXPERIENCE_BOTTLE_THROWING: 500 - DYE: 500 - ITEM_FRAME: 500 - PLACE_BLOCKS: 500 - CRAFTING: 0 - SHEARING: 500 - ENCHANTING: 0 - BOAT: 500 - SPAWN_EGGS: 500 - BED: 500 - MILKING: 0 - DISPENSER: 500 - GATE: 0 - EXPERIENCE_PICKUP: 500 - HOPPER: 500 - LEASH: 500 - MOUNT_INVENTORY: 500 - BREAK_BLOCKS: 500 - CHORUS_FRUIT: 500 - CONTAINER: 500 - JUKEBOX: 500 - POTION_THROWING: 500 + default-cave-flags: {} # These are the default settings for new caves - default-cave-settings: - PVP_END: false - PVP_NETHER: false - LEAF_DECAY: true - MONSTER_SPAWNERS_SPAWN: true - TNT_DAMAGE: true - ANIMAL_NATURAL_SPAWN: true - MONSTER_NATURAL_SPAWN: true - FIRE_IGNITE: true - FIRE_SPREAD: true - FIRE_BURNING: true - ANIMAL_SPAWNERS_SPAWN: true - PVP_OVERWORLD: false + default-cave-settings: {} # These settings/flags are hidden from users # Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings hidden-flags: [] # Visitor banned commands - Visitors to caves cannot use these commands in this world visitor-banned-commands: - - spawner - - spawnmob + - spawner + - spawnmob # Falling banned commands - players cannot use these commands when falling # if the PREVENT_TELEPORT_WHEN_FALLING world setting flag is active falling-banned-commands: - - warp - - spawn + - warp + - spawn cave: # Default max team size - # Permission size cannot be less than the default below. + # Permission size cannot be less than the default below. max-team-size: 4 # Default maximum number of coop rank members per cave # Players can have the caveblock.coop.maxsize. permission to be bigger but - # permission size cannot be less than the default below. + # permission size cannot be less than the default below. # Added since 1.13.0. max-coop-size: 4 # Default maximum number of trusted rank members per cave # Players can have the caveblock.trust.maxsize. permission to be bigger but - # permission size cannot be less than the default below. + # permission size cannot be less than the default below. # Added since 1.13.0. max-trusted-size: 4 # Default maximum number of homes a player can have. Min = 1 @@ -485,42 +411,42 @@ cave: # List of commands to run when a player joins an cave or creates one. # These commands are run by the console, unless otherwise stated using the [SUDO] prefix, # in which case they are executed by the player. - # + # # Available placeholders for the commands are the following: # * [name]: name of the player - # + # # Here are some examples of valid commands to execute: # * '[SUDO] bbox version' # * 'bsbadmin deaths set [player] 0' - # + # # Note that player-executed commands might not work, as these commands can be run with said player being offline. # Added since 1.8.0. on-join: [] # List of commands to run when a player leaves a cave, resets his cave or gets kicked from it. # These commands are run by the console, unless otherwise stated using the [SUDO] prefix, # in which case they are executed by the player. - # + # # Available placeholders for the commands are the following: # * [name]: name of the player - # + # # Here are some examples of valid commands to execute: # * '[SUDO] bbox version' # * 'bsbadmin deaths set [player] 0' - # + # # Note that player-executed commands might not work, as these commands can be run with said player being offline. # Added since 1.8.0. on-leave: [] # List of commands that should be executed when the player respawns after death if Flags.ISLAND_RESPAWN is true. # These commands are run by the console, unless otherwise stated using the [SUDO] prefix, # in which case they are executed by the player. - # + # # Available placeholders for the commands are the following: # * [name]: name of the player - # + # # Here are some examples of valid commands to execute: # * '[SUDO] bbox version' # * 'bsbadmin deaths set [player] 0' - # + # # Note that player-executed commands might not work, as these commands can be run with said player being offline. # Added since 1.14.0. on-respawn: [] @@ -546,9 +472,9 @@ protection: # Geo restrict mobs. # Mobs that exit the cave space where they were spawned will be removed. geo-limit-settings: - - GHAST - - BAT - - BLAZE + - GHAST + - BAT + - BLAZE # CaveBlock blocked mobs. # List of mobs that should not spawn in the CaveBlock. # Added since 1.13.0. @@ -556,30 +482,30 @@ protection: # Invincible visitors. List of damages that will not affect visitors. # Make list blank if visitors should receive all damages invincible-visitors: - - BLOCK_EXPLOSION - - CONTACT - - CUSTOM - - DROWNING - - ENTITY_ATTACK - - ENTITY_EXPLOSION - - FALL - - FALLING_BLOCK - - FIRE - - FIRE_TICK - - LAVA - - LIGHTNING - - MAGIC - - POISON - - PROJECTILE - - STARVATION - - SUFFOCATION - - THORNS - - WITHER - - DRAGON_BREATH - - FLY_INTO_WALL - - HOT_FLOOR - - CRAMMING - - VOID + - BLOCK_EXPLOSION + - CONTACT + - CUSTOM + - DROWNING + - ENTITY_ATTACK + - ENTITY_EXPLOSION + - FALL + - FALLING_BLOCK + - FIRE + - FIRE_TICK + - LAVA + - LIGHTNING + - MAGIC + - POISON + - PROJECTILE + - STARVATION + - SUFFOCATION + - THORNS + - WITHER + - DRAGON_BREATH + - FLY_INTO_WALL + - HOT_FLOOR + - CRAMMING + - VOID do-not-edit-these-settings: # These settings should not be edited reset-epoch: 0