diff --git a/src/main/java/world/bentobox/skygrid/generators/SkyGridChunks.java b/src/main/java/world/bentobox/skygrid/generators/SkyGridChunks.java deleted file mode 100644 index a4d8135..0000000 --- a/src/main/java/world/bentobox/skygrid/generators/SkyGridChunks.java +++ /dev/null @@ -1,164 +0,0 @@ -package world.bentobox.skygrid.generators; - -import java.util.ArrayList; -import java.util.List; -import java.util.Random; - -import org.bukkit.Material; -import org.bukkit.World.Environment; -import org.bukkit.block.data.Bisected; -import org.bukkit.block.data.BlockData; - -import com.google.common.base.Enums; - -import world.bentobox.skygrid.SkyGrid; - -/** - * A premade randomized chunk of grid - * @author tastybento - * - */ -public class SkyGridChunks { - - // Blocks that need to be placed on dirt - private static final List NEEDS_DIRT = List.of(Material.ACACIA_SAPLING, Material.ALLIUM, Material.AZURE_BLUET, - Material.BEETROOTS, Material.BIRCH_SAPLING, Material.BLUE_ORCHID, Material.BROWN_MUSHROOM, Material.DANDELION, - Material.DARK_OAK_SAPLING, Material.DEAD_BUSH, Material.FERN, - Enums.getIfPresent(Material.class, "GRASS").or(Material.SHORT_GRASS), Material.JUNGLE_SAPLING, - Material.LARGE_FERN, Material.LILAC, Material.OAK_SAPLING, Material.ORANGE_TULIP, Material.OXEYE_DAISY, - Material.PEONY, Material.PINK_TULIP, Material.POPPY, Material.RED_MUSHROOM, Material.RED_TULIP, - Material.ROSE_BUSH, Material.SPRUCE_SAPLING, Material.SUGAR_CANE, Material.SUNFLOWER, Material.TALL_GRASS, - Material.WHEAT, Material.WHITE_TULIP); - - private static final int PRE_MADE_CHUNKS_NUMBER = 100; - - private final SkyGrid addon; - - private final Random random = new Random(System.currentTimeMillis()); - private final List> chunks = new ArrayList<>(); - private final List> chunksEnd = new ArrayList<>(); - - private final List> chunksNether = new ArrayList<>(); - - public SkyGridChunks(SkyGrid addon) { - super(); - this.addon = addon; - // Make chunks for world, nether and end - BlockProbability prob = addon.getWorldStyles().get(Environment.NORMAL).getProb(); - BlockProbability probNether = addon.getWorldStyles().get(Environment.NETHER).getProb(); - BlockProbability probEnd = addon.getWorldStyles().get(Environment.THE_END).getProb(); - // Generate a number of chunks in advance - addon.log("Making chunks for SkyGrid"); - for (int i = 0; i < PRE_MADE_CHUNKS_NUMBER; i++) { - chunks.add(getChunk(prob)); - chunksNether.add(getChunk(probNether)); - chunksEnd.add(getChunk(probEnd)); - } - addon.log("Done making chunks"); - } - - public Material getBlock(Environment env) { - BlockProbability prob = addon.getWorldStyles().get(env).getProb(); - return prob.getBlock(random, false, false); - /* - // Get a random block and feed in the last block (true if cactus or cane) - Material blockMat = prob.getBlock(random, y == 0, false); - // If blockMat is not "a block" then cannot be generated - if (!blockMat.isAir() && !blockMat.isBlock()) { - blockMat = Material.STONE; - } - // Convert to deep - if (y < 0) { - if (blockMat == Material.STONE) { - blockMat = Material.DEEPSLATE; - - } else if (blockMat == Material.COBBLESTONE) { - blockMat = Material.COBBLED_DEEPSLATE; - } else { - blockMat = Enums.getIfPresent(Material.class, "DEEPSLATE_" + blockMat.name()).or(blockMat); - } - } - return new SkyGridBlock(x, y, z, blockMat);*/ - } - - private List getChunk(BlockProbability prob) { - List result = new ArrayList<>(); - for (int x = 1; x < 16; x += 4) { - for (int z = 1; z < 16; z += 4) { - for (int y = -64; y <= addon.getSettings().getIslandHeight(); y += 4) { - setBlock(prob, x, y, z, result); - } - } - } - return result; - } - - /** - * Get a random skygrid chunk - * @param env - environment - * @return list of sky grid blocks - */ - public List getSkyGridChunk(Environment env) { - return switch (env) { - case NETHER -> chunksNether.get(random.nextInt(chunksNether.size())); - case THE_END -> chunksEnd.get(random.nextInt(chunksEnd.size())); - default -> chunks.get(random.nextInt(chunks.size())); - }; - - } - - private void setBlock(BlockProbability prob, int x, int y, int z, List result) { - // Get a random block and feed in the last block (true if cactus or cane) - Material blockMat = prob.getBlock(random, y == 0, false); - // If blockMat is not "a block" then cannot be generated - if (!blockMat.isAir() && !blockMat.isBlock()) { - blockMat = Material.STONE; - } - // Convert to deep - if (y < 0) { - switch (blockMat) { - case STONE -> blockMat = Material.DEEPSLATE; - case COBBLESTONE -> blockMat = Material.COBBLED_DEEPSLATE; - default -> blockMat = Enums.getIfPresent(Material.class, "DEEPSLATE_" + blockMat.name()).or(blockMat); - } - } - - // Check if the block needs dirt - if (NEEDS_DIRT.contains(blockMat)) { - // Add dirt - result.add(new SkyGridBlock(x, y, z, Material.DIRT.createBlockData())); - BlockData dataBottom = blockMat.createBlockData(); - if (dataBottom instanceof Bisected bisected) { - bisected.setHalf(Bisected.Half.BOTTOM); - BlockData dataTop = blockMat.createBlockData(); - bisected.setHalf(Bisected.Half.TOP); - result.add(new SkyGridBlock(x, y + 1, z, dataBottom)); - result.add(new SkyGridBlock(x, y + 2, z, dataTop)); - } else { - result.add(new SkyGridBlock(x, y+1, z, blockMat.createBlockData())); - } - if (blockMat.equals(Material.SUGAR_CANE)) { - // x will never be more than 12 - result.add(new SkyGridBlock(x+1, y, z, Material.WATER)); - } - } else { - switch (blockMat) { - case CACTUS, DEAD_BUSH -> { - result.add(new SkyGridBlock(x, y, z, Material.SAND)); - result.add(new SkyGridBlock(x, y - 1, z, Material.SANDSTONE)); - result.add(new SkyGridBlock(x, y + 1, z, blockMat)); - } - case NETHER_WART -> { - result.add(new SkyGridBlock(x, y, z, Material.SOUL_SAND)); - result.add(new SkyGridBlock(x, y + 1, z, blockMat)); - } - case END_ROD, CHORUS_PLANT -> { - result.add(new SkyGridBlock(x, y, z, Material.END_STONE)); - result.add(new SkyGridBlock(x, y + 1, z, blockMat)); - } - default -> result.add(new SkyGridBlock(x, y, z, blockMat)); - } - } - - } -} diff --git a/src/main/java/world/bentobox/skygrid/generators/SkyGridGen.java b/src/main/java/world/bentobox/skygrid/generators/SkyGridGen.java index ba063d1..3b9ab7c 100644 --- a/src/main/java/world/bentobox/skygrid/generators/SkyGridGen.java +++ b/src/main/java/world/bentobox/skygrid/generators/SkyGridGen.java @@ -78,7 +78,20 @@ private boolean checkPlants(Material nextBlock, int x, int y, int z, ChunkData r result.setBlock(x, y, z, Material.END_STONE); result.setBlock(x, y + 1, z, nextBlock); } - + case SUGAR_CANE -> { + result.setBlock(x, y, z, Material.SANDSTONE); + result.setBlock(x, y + 1, z, Material.SAND); + result.setBlock(x, y + 2, z, nextBlock); + result.setBlock(x+1, y + 1, z, Material.WATER); + } + case SHORT_GRASS, TALL_GRASS -> { + result.setBlock(x, y, z, Material.DIRT); + result.setBlock(x, y + 1, z, nextBlock); + } + case RED_MUSHROOM, BROWN_MUSHROOM -> { + result.setBlock(x, y, z, Material.PODZOL); + result.setBlock(x, y + 1, z, nextBlock); + } default -> { result.setBlock(x, y, z, nextBlock); return false; diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml index 40431a4..aaeed0f 100755 --- a/src/main/resources/addon.yml +++ b/src/main/resources/addon.yml @@ -4,7 +4,7 @@ version: ${version}${build.number} metrics: true repository: "BentoBoxWorld/SkyGrid" icon: "COBWEB" -api-version: 2.7.1 +api-version: 3.3.1 authors: tastybento diff --git a/src/main/resources/locales/en-US.yml b/src/main/resources/locales/en-US.yml index a4606c3..0849bde 100755 --- a/src/main/resources/locales/en-US.yml +++ b/src/main/resources/locales/en-US.yml @@ -1,19 +1,21 @@ ########################################################################################### -# This is a YML file. Be careful when editing. Check your edits in a YAML checker like # -# the one at http://yaml-online-parser.appspot.com # +# This is a YML file. Be careful when editing. Check your edits in a YAML checker like +# the one at http://yaml-online-parser.appspot.com ########################################################################################### # These strings are deltas to the strings in BentoBox. Any BentoBox string can be # overridden by placing it under the skygrid key. skygrid: - # General strings - general: - errors: - no-island: "&c You do not have an area!" - player-has-island: "&c Player already has an area!" - player-has-no-island: "&c That player has no area!" - already-have-island: "&c You already have an area!" - no-safe-location: "&c No safe location found in area!" - not-owner: "&c You are not the owner of your team!" + sign: + line0: '&1Welcome to Skygrid' + line1: '[name]' + line2: "The grid is life." + line3: "The grid is death." + prefixes: + island: area + Island: Area + an-island: an area + islands: areas + Islands: Areas commands: #Main SkyGrid command skygrid: @@ -21,195 +23,4 @@ skygrid: description: "Start a SkyGrid game or teleport to your SkyGrid home" go: description: "Go home" - tip: "&c You cannot teleport when falling!" - - # Override BentoBox default island command strings - island: - info: - description: "display info about your area or the player's area" - reset: - description: "restart in another area" - parameters: "" - must-remove-members: "&c You must remove all team players before you can restart (/[label] team kick )." - sethome: - must-be-on-your-island: "&c You must be in your area to set home!" - home-set: "&6 Your home has been set to your current location." - setname: - description: "set a name for your area" - resetname: - description: "reset your area name" - team: - coop: - description: "make a player coop rank" - uncoop: - you-are-no-longer-a-coop-member: "&c You are no longer a coop member of [name]'s area" - all-members-logged-off: "&c All team members logged off so you are no longer a coop member of [name]'s area" - trust: - description: "give a player trusted rank" - invite: - description: "invite a player to join your team" - name-has-invited-you: "&a [name] has invited you to join their team." - to-accept-or-reject: "&a Do /[label] team accept to accept, or /[label] team reject to reject" - you-will-lose-your-island: "&c WARNING! You will lose your our area if you accept!" - errors: - island-is-full: "&c Your team is full, you can't invite anyone else." - accept: - you-joined-island: "&a You joined a team! Use /[label] team info to see the other members." - name-joined-your-island: "&a [name] joined your team!" - confirmation: |- - &c Are you sure you want to accept this invite? - &c&l This will &n WIPE &r&c&l your current area! - reject: - you-rejected-invite: "&a You rejected the invitation to join a team." - name-rejected-your-invite: "&c [name] rejected your invite!" - cancel: - description: "cancel the pending invite to join your team" - leave: - description: "leave your team" - left-your-island: "&c [name] &c left your team" - kick: - description: "remove a team member" - owner-kicked: "&c The owner kicked you from the team!" - demote: - description: "demote a player one rank" - promote: - description: "promote a player one rank" - setowner: - description: "transfer team ownership to a member" - errors: - target-is-not-member: "&c That player is not part of your team!" - name-is-the-owner: "&a [name] is now the area owner!" - you-are-the-owner: "&a You are now the area owner!" - ban: - description: "ban a player from your area" - cannot-ban-more-players: "&c You reached the ban limit, you cannot ban any more players." - owner-banned-you: "&b [name]&c banned you from their area!" - you-are-banned: "&b You are banned from this area!" - unban: - description: "unban a player from your area" - you-are-unbanned: "&b [name]&a unbanned you from their area!" - banlist: - noone: "&a No one is banned on this area" - settings: - description: "display area settings" - # Admin command /sgadmin - admin: - team: - add: - name-has-island: "&c [name] has an area. Unregister or delete them first!" - setowner: - description: "transfers area ownership to the player" - already-owner: "&c Player is already the owner of this area!" - range: - description: "Admin area range command" - display: - description: "Show/hide area range indicators" - hint: |- - &c Red Barrier icons &f show the current protected range limit. - &7 Gray Particles &f show the max limit. - &a Green Particles &f show the default protected range if the protection range differs from it. - set: - description: "Sets the area protected range" - reset: - description: "Resets the protected range to the world default" - register: - parameters: "" - description: "register player to unowned area you are in" - registered-island: "&a Registered player to area at [xyz]." - already-owned: "&c Area is already owned by another player!" - no-island-here: "&c There is no player area here. Confirm to make one." - in-deletion: "&c This space is currently being regenerated. Try later." - unregister: - description: "unregister owner from an area, but keep area blocks as-is" - unregistered-island: "&a Unregistered player from area at [xyz]." - info: - description: "get info on where you are or on player" - no-island: "&c You are not in a registered area right now..." - island-location: "Area location: [xyz]" - island-coords: "Area coordinates: [xz1] to [xz2]" - is-spawn: "Area is a spawn island" - setrange: - description: "set the range of player's area" - range-updated: "Area range updated to [number]" - tp: - description: "teleport to a player's area" - getrank: - description: "get a player's rank in their area" - rank-is: "&a Rank is [rank] in their area." - setrank: - description: "set a player's rank in their area" - setspawn: - description: "set an area as spawn for this world" - already-spawn: "&c This area is already a spawn!" - no-island-here: "&c There is no registered area here." - confirmation: "&c Are you sure you want to set this area as the spawn for this world?" - delete: - description: "deletes a player and regenerates their area" - deleted-island: "&a Area at &e [xyz] &a has been successfully regenerated." - - protection: - flags: - ELYTRA: - description: "Toggle use" - ENDERMAN_GRIEFING: - description: |- - &a Endermen can remove - &a blocks - ENTER_EXIT_MESSAGES: - description: "Display entry and exit messages" - island: "[name]'s protected area" - name: "Enter/Exit messages" - now-entering: '&a Now entering &b [name]&a .' - now-entering-your-island: '&a Now entering your area.' - now-leaving: '&a Now leaving &b [name]&a .' - now-leaving-your-island: '&a Now leaving your area.' - GEO_LIMIT_MOBS: - description: |- - &a Remove mobs that go - &a outside protected - &a player space - name: "&e Limit mobs to player area" - ISLAND_RESPAWN: - description: |- - &a Players respawn - &a in their area - name: "Area respawn" - LOCK: - name: "Lock player area" - OFFLINE_REDSTONE: - description: |- - &a When disabled, redstone - &a will not operate in areas - &a where all members are offline. - &a May help reduce lag. - PISTON_PUSH: - description: |- - &a Allow pistons to push - &a blocks outside a player's area - PVP_OVERWORLD: - description: |- - &c Enable/Disable PVP - &c in protected area. - REMOVE_MOBS: - description: |- - &a Remove monsters when - &a teleporting to an area - PREVENT_TELEPORT_WHEN_FALLING: - description: |- - &a Prevent players from teleporting - &a if they are falling. - hint: "&c You cannot teleport while you are falling!" - locked: "&c This area is locked!" - protected: "&c Area protected: [description]" - - panel: - PROTECTION: - title: "&6 Protection" - description: |- - &a Protection settings - &a for this area - SETTING: - description: |- - &a General settings - &a for this area - + tip: "&c You cannot teleport when falling!" \ No newline at end of file