From ae26dfaa7483fd585981d7a1e0224f7d744bf629 Mon Sep 17 00:00:00 2001 From: tastybento Date: Tue, 5 Feb 2019 21:29:51 -0800 Subject: [PATCH 01/11] Fixes BEETROOT_SEEDS enum for itemstack in schem https://github.com/BentoBoxWorld/CaveBlock/issues/12 --- src/main/resources/schems/island.schem | Bin 2318 -> 2516 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/schems/island.schem b/src/main/resources/schems/island.schem index 8d861e2ced35b66bbb44503bb8ac58ed0a118ab1..aa706fcb19a0f73ded592133706d5a2aea03b316 100644 GIT binary patch literal 2516 zcma);dpOjI8pnr>=rYXD$aOKZ#`uL;ml)UVV*Lh#K|&2-7bTjQ$|W{)+NF@+7({L{ zqL3Qbh>5Ir2*;%ywWx7RGhtkkbvw>Ef1LJt_Bqda|M)(i@ArM5_wTQp(;f*7LP|;s zL8-JSBfc2PT@H&1KOGTVo$v0-_r+YBnDt)iRVWa)+S_)G-=s2{?8|S$c5w8AtRzwgS@3M%jV|35p}+0Zu(GV$jq4j9&;2@SM#=w$Ql9sy?mA9y~64jy~>cC-lttm zd(N82O=9+wbef+O*In+}PZHGag61v^=<91E|7b3T3~o!*ekm#vwYCOd%8=AuwDZ@u z91PL|l-rGy?n!t^-vylUw@3zA0f(Prj)4dYq7-2#_BU|^a&h3upw^(;;Gsd(pyc58 zK(FH(ZtQwAVKB{c?at0o85AK(tIzKz8b6epBU9J9~M8PP7p0O5l_oYry=LEj~)o@Y@&cbTu5z z&_n)JxSFYF`vC7)-^r_^<^|D~s>*IGu1+MWI%Nb(8|u=4s*#?>S{)j*QoN$bHzm_Y zPhTS+b$m5e%BCDB@#F`4BAsoDfD#XWut&}Q`%$3u9SYFF?u6LcHQd7?OxbQtY%27V zf%GC?tXY%Xu(DF4*J^%qCzaC|MAIuPQ>GGp+T22GSFE|ze)ZW7p>W*{%=w`-)Og)$ zLm`)}UL>Prf0om5S<$|rkIW+1Sj)^uMmVg`28w1GmXAM9ix%&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Wrt zz^Qr=5>Th%cjsD-ANeXKvQ1)&0k-RP3s6gc zqQzU5#hvr+b+?L1o-c&ZPyT6+)!Zy{*QVB}XGi ze=7UUZB3RAub+)hx3jaSSVUXrg;GG*`;~>}dtUze#<5aZXSty@%0(a+Auj4}35I<$yS4V1CeGpN8I1#bb6Bo3t;=il=2@(g{ z8f+Z4y+xhZRX;jpvN8uU=mP#9LyQz-8;5}HI={|V W=1kuS4gh%EkI4?;`7!GO0R9UOj7oR_ From 168cbe1ebcce96b10b058a4a7d0a2c72a4086e53 Mon Sep 17 00:00:00 2001 From: tastybento Date: Wed, 6 Feb 2019 17:42:06 -0800 Subject: [PATCH 02/11] Adds error checking for MATERIALs in config.yml MATERIALs must be blocks otherwise the world populator will throw errors and crash the server. This commit checks that all imported materials are blocks and if they are not logs the error. Updated config.yml to use correct 1.13 material names for blocks. https://github.com/BentoBoxWorld/CaveBlock/issues/11 --- .../caveblock/generators/populators/MaterialPopulator.java | 6 ++++-- src/main/resources/config.yml | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java b/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java index c8bb8a5..5c3d0ff 100644 --- a/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java +++ b/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java @@ -146,11 +146,13 @@ public class MaterialPopulator extends BlockPopulator filter(splitString -> splitString.length == 4). forEach(splitString -> { Material material = Material.getMaterial(splitString[1]); - - if (material != null) + // Material must be a block otherwise the chunk cannot be populated + if (material != null && material.isBlock()) { materialMap.put(material, new Pair<>(Double.parseDouble(splitString[2]), Integer.parseInt(splitString[3]))); + } else { + addon.logError("Could not parse MATERIAL in config.yml: " + splitString[1] + " is not a valid block."); } }); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index dd5a831..14482ff 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -133,11 +133,11 @@ world: # MATERIAL:DIAMOND_ORE:100:5 - means there is 100% chace of spawing diamonds # where max amount in pack are 5 per each subchunk! blocks: - - MATERIAL:QUARTZ_ORE:30:5 + - MATERIAL:NETHER_QUARTZ_ORE:30:5 - MATERIAL:SOUL_SAND:40:10 - MATERIAL:MAGMA_BLOCK:10:3 - MATERIAL:GLOWSTONE:20:8 - - MATERIAL:NETHER_BRICK:10:5 + - MATERIAL:NETHER_BRICKS:10:5 - MATERIAL:LAVA:10:1 - ENTITY:MAGMA_CUBE:0.5:1 - ENTITY:GHAST:0.1:1 @@ -166,7 +166,7 @@ world: blocks: - ENTITY:SHULKER:0.2:1 - MATERIAL:OBSIDIAN:1:1 - - MATERIAL:CHORUS_FRUIT:1:3 + - MATERIAL:CHORUS_PLANT:1:3 # Mob white list - these mobs will NOT be removed when logging in or doing /cave remove-mobs-whitelist: - WITHER From f42c15e2255c30a44cbd9d4a4a4ca1152da9ed20 Mon Sep 17 00:00:00 2001 From: tastybento Date: Fri, 8 Feb 2019 17:51:50 -0800 Subject: [PATCH 03/11] Removes extraneous settings https://github.com/BentoBoxWorld/BentoBox/issues/531 --- .gitignore | 3 + .../world/bentobox/caveblock/Settings.java | 77 ------------------- src/main/resources/config.yml | 7 -- 3 files changed, 3 insertions(+), 84 deletions(-) diff --git a/.gitignore b/.gitignore index c836fce..a581609 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* /target/ +/.DS_Store +/.classpath +/.project diff --git a/src/main/java/world/bentobox/caveblock/Settings.java b/src/main/java/world/bentobox/caveblock/Settings.java index a1571bd..9e74479 100644 --- a/src/main/java/world/bentobox/caveblock/Settings.java +++ b/src/main/java/world/bentobox/caveblock/Settings.java @@ -412,16 +412,6 @@ public class Settings implements DataObject, WorldSettings } - /** - * This method returns the resetConfirmation object. - * @return the resetConfirmation object. - */ - public boolean isResetConfirmation() - { - return resetConfirmation; - } - - /** * This method returns the leaversLoseReset object. * @return the leaversLoseReset object. @@ -508,16 +498,6 @@ public class Settings implements DataObject, WorldSettings } - /** - * This method returns the respawnOnIsland object. - * @return the respawnOnIsland object. - */ - public boolean isRespawnOnIsland() - { - return respawnOnIsland; - } - - /** * This method returns the allowSetHomeInNether object. * @return the allowSetHomeInNether object. @@ -627,16 +607,6 @@ public class Settings implements DataObject, WorldSettings } - /** - * This method returns the closePanelOnClickOutside object. - * @return the closePanelOnClickOutside object. - */ - public boolean isClosePanelOnClickOutside() - { - return closePanelOnClickOutside; - } - - /** * @return the permission prefix */ @@ -1195,17 +1165,6 @@ public class Settings implements DataObject, WorldSettings } - /** - * This method sets the resetConfirmation object value. - * @param resetConfirmation the resetConfirmation object new value. - * - */ - public void setResetConfirmation(boolean resetConfirmation) - { - this.resetConfirmation = resetConfirmation; - } - - /** * This method sets the leaversLoseReset object value. * @param leaversLoseReset the leaversLoseReset object new value. @@ -1294,17 +1253,6 @@ public class Settings implements DataObject, WorldSettings } - /** - * This method sets the respawnOnIsland object value. - * @param respawnOnIsland the respawnOnIsland object new value. - * - */ - public void setRespawnOnIsland(boolean respawnOnIsland) - { - this.respawnOnIsland = respawnOnIsland; - } - - /** * This method sets the allowSetHomeInNether object value. * @param allowSetHomeInNether the allowSetHomeInNether object new value. @@ -1414,18 +1362,6 @@ public class Settings implements DataObject, WorldSettings this.ivSettings = ivSettings; } - - /** - * This method sets the closePanelOnClickOutside object value. - * @param closePanelOnClickOutside the closePanelOnClickOutside object new value. - * - */ - public void setClosePanelOnClickOutside(boolean closePanelOnClickOutside) - { - this.closePanelOnClickOutside = closePanelOnClickOutside; - } - - /** * This method sets the resetEpoch object value. * @param resetEpoch the resetEpoch object new value. @@ -1895,9 +1831,6 @@ public class Settings implements DataObject, WorldSettings @ConfigEntry(path = "island.reset.reset-limit") private int resetLimit = -1; - @ConfigEntry(path = "island.require-confirmation.reset") - private boolean resetConfirmation = true; - @ConfigComment("Kicked or leaving players lose resets") @ConfigComment("Players who leave a team will lose an island reset chance") @ConfigComment("If a player has zero resets left and leaves a team, they cannot make a new") @@ -1946,10 +1879,6 @@ public class Settings implements DataObject, WorldSettings @ConfigEntry(path = "island.reset.on-leave.ender-chest") private boolean onLeaveResetEnderChest = false; - @ConfigComment("Have player's respawn on their island if they die") - @ConfigEntry(path = "island.respawn-on-island") - private boolean respawnOnIsland = true; - // Sethome @ConfigEntry(path = "island.sethome.nether.allow") private boolean allowSetHomeInNether = true; @@ -1993,12 +1922,6 @@ public class Settings implements DataObject, WorldSettings @ConfigEntry(path = "protection.invincible-visitors") private List ivSettings = new ArrayList<>(); - //---------------------------------------------------------------------------------------/ - - @ConfigComment("Whether GUIs should be closed when the player clicks outside.") - @ConfigEntry(path = "panel.close-on-click-outside") - private boolean closePanelOnClickOutside = true; - //---------------------------------------------------------------------------------------/ @ConfigComment("These settings should not be edited") @ConfigEntry(path = "do-not-edit-these-settings.reset-epoch") diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 14482ff..29691c8 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -311,10 +311,6 @@ island: inventory: false # Reset Ender Chest - if true, the player's Ender Chest will be cleared. ender-chest: false - require-confirmation: - reset: true - # Have player's respawn on their island if they die - respawn-on-island: false sethome: nether: allow: true @@ -364,9 +360,6 @@ protection: - HOT_FLOOR - CRAMMING - VOID -panel: - # Whether GUIs should be closed when the player clicks outside. - close-on-click-outside: true do-not-edit-these-settings: # These settings should not be edited reset-epoch: 0 From d9d79a1ca9a939354a9c95d18f4c2e09c4790268 Mon Sep 17 00:00:00 2001 From: BONNe1704 Date: Fri, 15 Feb 2019 16:41:08 +0200 Subject: [PATCH 04/11] Implement ability to change user and admin command in config. --- .../world/bentobox/caveblock/Settings.java | 59 ++++++++++++++++++- .../caveblock/commands/AdminCommand.java | 4 +- .../caveblock/commands/IslandCommand.java | 4 +- src/main/resources/config.yml | 8 +++ 4 files changed, 71 insertions(+), 4 deletions(-) diff --git a/src/main/java/world/bentobox/caveblock/Settings.java b/src/main/java/world/bentobox/caveblock/Settings.java index 9e74479..9f0e7c3 100644 --- a/src/main/java/world/bentobox/caveblock/Settings.java +++ b/src/main/java/world/bentobox/caveblock/Settings.java @@ -798,7 +798,27 @@ public class Settings implements DataObject, WorldSettings } - // --------------------------------------------------------------------- + /** + * This method returns the islandCommand value. + * @return the value of islandCommand. + */ + public String getIslandCommand() + { + return islandCommand; + } + + + /** + * This method returns the adminCommand value. + * @return the value of adminCommand. + */ + public String getAdminCommand() + { + return adminCommand; + } + + + // --------------------------------------------------------------------- // Section: Setters // --------------------------------------------------------------------- @@ -1565,10 +1585,45 @@ public class Settings implements DataObject, WorldSettings this.debug = debug; } - // --------------------------------------------------------------------- + + /** + * This method sets the islandCommand value. + * @param islandCommand the islandCommand new value. + * + */ + public void setIslandCommand(String islandCommand) + { + this.islandCommand = islandCommand; + } + + + /** + * This method sets the adminCommand value. + * @param adminCommand the adminCommand new value. + * + */ + public void setAdminCommand(String adminCommand) + { + this.adminCommand = adminCommand; + } + + + // --------------------------------------------------------------------- // 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 = "cave.command.island") + private String islandCommand = "cave cb"; + + @ConfigComment("The Cave admin command.") + @ConfigComment("To define alias, just separate commands with white space.") + @ConfigEntry(path = "cave.command.admin") + private String adminCommand = "cbadmin cba"; + /* WORLD */ @ConfigComment("Friendly name for this world. Used in admin commands. Must be a single word") @ConfigEntry(path = "world.friendly-name") diff --git a/src/main/java/world/bentobox/caveblock/commands/AdminCommand.java b/src/main/java/world/bentobox/caveblock/commands/AdminCommand.java index 30a8df1..5dd5ef5 100644 --- a/src/main/java/world/bentobox/caveblock/commands/AdminCommand.java +++ b/src/main/java/world/bentobox/caveblock/commands/AdminCommand.java @@ -21,7 +21,9 @@ import world.bentobox.caveblock.CaveBlock; public class AdminCommand extends CompositeCommand { public AdminCommand(CaveBlock addon) { - super(addon, "cbadmin", "cba"); + super(addon, + addon.getSettings().getAdminCommand().split(" ")[0], + addon.getSettings().getAdminCommand().split(" ")); } @Override diff --git a/src/main/java/world/bentobox/caveblock/commands/IslandCommand.java b/src/main/java/world/bentobox/caveblock/commands/IslandCommand.java index 971dd77..df73586 100644 --- a/src/main/java/world/bentobox/caveblock/commands/IslandCommand.java +++ b/src/main/java/world/bentobox/caveblock/commands/IslandCommand.java @@ -15,7 +15,9 @@ import world.bentobox.caveblock.CaveBlock; public class IslandCommand extends CompositeCommand { public IslandCommand(CaveBlock addon) { - super(addon, "cave", "cb"); + super(addon, + addon.getSettings().getIslandCommand().split(" ")[0], + addon.getSettings().getIslandCommand().split(" ")); } /* (non-Javadoc) diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 29691c8..a6fb763 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -2,6 +2,14 @@ # This config file is dynamic and saved when the server is shutdown. # If you edit it while the server is running use /cbadmin reload # otherwise your settings will be lost. +caveblock: + command: + # Cave Command. What command users will run to access their cave. + # To define alias, just separate commands with white space. + island: cave cb + # The Cave admin command. + # To define alias, just separate commands with white space. + admin: cbadmin cba world: # Friendly name for this world. Used in admin commands. Must be a single word friendly-name: CaveBlock From 207733527d6f85f6fec5267a97d719a2dc8b0eb1 Mon Sep 17 00:00:00 2001 From: BONNe1704 Date: Mon, 25 Feb 2019 16:31:06 +0200 Subject: [PATCH 05/11] Improve CaveBlock pom.xml Remove unnecessary things. Add dependency projects in properties Add BuildNumber to version tag. --- pom.xml | 69 +++++++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 44 deletions(-) diff --git a/pom.xml b/pom.xml index c01cbfb..cc57814 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ world.bentobox caveblock - 0.1.0 + ${revision} CaveBlock CaveBlock is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland. @@ -44,9 +44,30 @@ UTF-8 UTF-8 1.8 - 1.7.4 + + 1.13.2-R0.1-SNAPSHOT + 1.3.0 + + ${build.version} + + 1.3.0-SNAPSHOT + + + ci + + + env.BUILD_NUMBER + + + + + ${build.version} #${env.BUILD_NUMBER} + + + + spigot-repo @@ -62,31 +83,13 @@ org.spigotmc spigot-api - 1.13.2-R0.1-SNAPSHOT + ${spigot.version} provided - - org.mockito - mockito-all - 1.10.19 - test - - - org.powermock - powermock-module-junit4 - ${powermock.version} - test - - - org.powermock - powermock-api-mockito - ${powermock.version} - test - world.bentobox bentobox - 1.2.0 + ${bentobox.version} provided @@ -199,28 +202,6 @@ maven-deploy-plugin 2.8.2 - - org.jacoco - jacoco-maven-plugin - 0.8.1 - - true - - - - pre-unit-test - - prepare-agent - - - - post-unit-test - - report - - - - \ No newline at end of file From f301e56ea6c0a81b98e3a63a1e341f43c9e3e747 Mon Sep 17 00:00:00 2001 From: BONNe1704 Date: Mon, 25 Feb 2019 16:37:52 +0200 Subject: [PATCH 06/11] Add BentoBox 1.3.0 admin commands --- .../world/bentobox/caveblock/commands/AdminCommand.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/world/bentobox/caveblock/commands/AdminCommand.java b/src/main/java/world/bentobox/caveblock/commands/AdminCommand.java index 5dd5ef5..4b88eee 100644 --- a/src/main/java/world/bentobox/caveblock/commands/AdminCommand.java +++ b/src/main/java/world/bentobox/caveblock/commands/AdminCommand.java @@ -64,6 +64,12 @@ public class AdminCommand extends CompositeCommand { new AdminReloadCommand(this); // Spawn new AdminSetspawnCommand(this); + // Reset flags + new AdminResetFlagsCommand(this); + // Trash + new AdminTrashCommand(this); + new AdminEmptyTrashCommand(this); + new AdminSwitchtoCommand(this); } @Override From a720f7097c80f147ccf1ae124d3017fa599c33cb Mon Sep 17 00:00:00 2001 From: BONNe Date: Tue, 5 Mar 2019 11:22:09 +0200 Subject: [PATCH 07/11] Remove BeaconEnabler as it is not necessary. Beacon can shine through bedrock. Update pom as Challenges addon. --- pom.xml | 21 +- .../world/bentobox/caveblock/CaveBlock.java | 2 - .../caveblock/listeners/BeaconEnabler.java | 203 ------------------ 3 files changed, 18 insertions(+), 208 deletions(-) delete mode 100644 src/main/java/world/bentobox/caveblock/listeners/BeaconEnabler.java diff --git a/pom.xml b/pom.xml index cc57814..f583b0f 100644 --- a/pom.xml +++ b/pom.xml @@ -50,12 +50,12 @@ ${build.version} - 1.3.0-SNAPSHOT + 1.3.0 - ci + develop env.BUILD_NUMBER @@ -63,7 +63,22 @@ - ${build.version} #${env.BUILD_NUMBER} + ${build.version}-SNAPSHOT #${env.BUILD_NUMBER} + + + + + master + + + env.GIT_BRANCH + origin/master + + + + + ${build.version} + diff --git a/src/main/java/world/bentobox/caveblock/CaveBlock.java b/src/main/java/world/bentobox/caveblock/CaveBlock.java index c170de6..bc1acf7 100644 --- a/src/main/java/world/bentobox/caveblock/CaveBlock.java +++ b/src/main/java/world/bentobox/caveblock/CaveBlock.java @@ -13,7 +13,6 @@ import world.bentobox.bentobox.api.configuration.WorldSettings; import world.bentobox.caveblock.commands.AdminCommand; import world.bentobox.caveblock.commands.IslandCommand; import world.bentobox.caveblock.generators.ChunkGeneratorWorld; -import world.bentobox.caveblock.listeners.BeaconEnabler; import world.bentobox.caveblock.listeners.CustomHeightLimitations; @@ -165,7 +164,6 @@ public class CaveBlock extends GameModeAddon } this.getServer().getPluginManager().registerEvents(new CustomHeightLimitations(this), this.getPlugin()); - this.getServer().getPluginManager().registerEvents(new BeaconEnabler(this), this.getPlugin()); } diff --git a/src/main/java/world/bentobox/caveblock/listeners/BeaconEnabler.java b/src/main/java/world/bentobox/caveblock/listeners/BeaconEnabler.java deleted file mode 100644 index 61a8f4f..0000000 --- a/src/main/java/world/bentobox/caveblock/listeners/BeaconEnabler.java +++ /dev/null @@ -1,203 +0,0 @@ -package world.bentobox.caveblock.listeners; - - -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockDamageEvent; -import org.bukkit.event.block.BlockExplodeEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityExplodeEvent; - -import world.bentobox.bentobox.util.Util; -import world.bentobox.caveblock.CaveBlock; -import world.bentobox.caveblock.Settings; - - -/** - * This class allows to enable beacon in CaveBlock, if cave roof is made of bedrock. - * It will replace Bedrock with black glass. - */ -public class BeaconEnabler implements Listener -{ - /** - * Constructor BeaconEnabler creates a new BeaconEnabler instance. - * - * @param addon of type CaveBlock - */ - public BeaconEnabler(CaveBlock addon) - { - this.addon = addon; - this.settings = addon.getSettings(); - } - - - /** - * Method onBlockPlacement detects if beacon is placed and replace roof bedrock with black glass. - * - * @param event of type BlockPlaceEvent - */ - @EventHandler(priority = EventPriority.LOWEST) - public void onBlockPlacement(BlockPlaceEvent event) - { - World world = event.getPlayer().getWorld(); - - if (!Util.sameWorld(this.addon.getOverWorld(), world) || - !this.settings.isBeaconAllowed() || - !this.isRoofEnabled(world) || - !event.getBlock().getType().equals(Material.BEACON)) - { - // This should work only if it is cave block world or world has roof from bedrock. Otherwise, - // players can dig till top themself. - return; - } - - - Block roofBlock = world.getBlockAt(event.getBlock().getX(), this.settings.getWorldDepth() - 1, event.getBlock().getZ()); - - if (roofBlock.getType().equals(Material.BEDROCK)) - { - // Replace only bedrock. - roofBlock.setType(Material.BLACK_STAINED_GLASS); - } - } - - - /** - * Method onBlockBreak detects if beacon is destroyed and replace roof black glass with bedrock. - * - * @param event of type BlockBreakEvent - */ - @EventHandler(priority = EventPriority.LOWEST) - public void onBlockBreak(BlockBreakEvent event) - { - World world = event.getPlayer().getWorld(); - - if (!Util.sameWorld(this.addon.getOverWorld(), world) || - !this.isRoofEnabled(world) || - !this.settings.isBeaconAllowed() || - !event.getBlock().getType().equals(Material.BEACON)) - { - // This should work only if it is cave block world or world has roof from bedrock. - return; - } - - Block roofBlock = world.getBlockAt(event.getBlock().getX(), this.settings.getWorldDepth() - 1, event.getBlock().getZ()); - - if (roofBlock.getType().equals(Material.BLACK_STAINED_GLASS)) - { - // Replace only black glass. - roofBlock.setType(Material.BEDROCK); - } - } - - - /** - * Method onBlockDamage detects if user tries to destroy black glass on roof and disable it. - * - * @param event of type BlockDamageEvent - */ - @EventHandler(priority = EventPriority.LOWEST) - public void onBlockDamage(BlockDamageEvent event) - { - World world = event.getPlayer().getWorld(); - - if (!Util.sameWorld(this.addon.getOverWorld(), world) || - !this.isRoofEnabled(world) || - !this.settings.isBeaconAllowed() || - event.getBlock().getY() != this.settings.getWorldDepth() - 1) - { - // This should work only if it is cave block world or world has roof from bedrock. - return; - } - - // Cancel break event if it is black glass. - event.setCancelled(event.getBlock().getType().equals(Material.BLACK_STAINED_GLASS)); - } - - - /** - * Method onBlockExplode detects if explosion tries to destroy black glass on roof and disable it. - * - * @param event of type BlockExplodeEvent - */ - @EventHandler(priority = EventPriority.LOWEST) - public void onBlockExplode(BlockExplodeEvent event) - { - World world = event.getBlock().getWorld(); - - if (!Util.sameWorld(this.addon.getOverWorld(), world) || - !this.isRoofEnabled(world) || - !this.settings.isBeaconAllowed() || - event.getBlock().getY() < this.settings.getWorldDepth() - 9) - { - // This should work only if it is cave block world or world has roof from bedrock. - return; - } - - final int blockY = this.settings.getWorldDepth() - 1; - - // Remove all black stained glass from explosion block list if it is on the roof. - event.blockList().removeIf(block -> - block.getY() == blockY && block.getType().equals(Material.BLACK_STAINED_GLASS)); - } - - - /** - * Method onEntityExplode detects if explosion tries to destroy black glass on roof and disable it. - * - * @param event of type EntityExplodeEvent - */ - @EventHandler(priority = EventPriority.LOWEST) - public void onEntityExplode(EntityExplodeEvent event) - { - World world = event.getLocation().getWorld(); - - if (!Util.sameWorld(this.addon.getOverWorld(), world) || - !this.isRoofEnabled(world) || - !this.settings.isBeaconAllowed() || - event.getLocation().getY() < this.settings.getWorldDepth() - 9) - { - // This should work only if it is cave block world or world has roof from bedrock. - return; - } - - final int blockY = this.settings.getWorldDepth() - 1; - - // Remove all black stained glass from explosion block list if it is on the roof. - event.blockList().removeIf(block -> - block.getY() == blockY && block.getType().equals(Material.BLACK_STAINED_GLASS)); - } - - - /** - * This method checks if in given world bedrock roof is enabled. - * @param world World that must be checked. - * @return true - bedrock roof is enabled, otherwise false - */ - private boolean isRoofEnabled(World world) - { - return world.getEnvironment().equals(World.Environment.NORMAL) && this.settings.isNormalRoof() || - world.getEnvironment().equals(World.Environment.NETHER) && this.settings.isNetherRoof() || - world.getEnvironment().equals(World.Environment.THE_END) && this.settings.isEndRoof(); - } - - -// --------------------------------------------------------------------- -// Section: Variables -// --------------------------------------------------------------------- - - /** - * CaveBlock addon. - */ - private CaveBlock addon; - - /** - * Addon settings. - */ - private Settings settings; -} From 7753565a8cc7a436050299f07e23732232e06746 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 23 Mar 2019 15:58:37 -0700 Subject: [PATCH 08/11] Updated to BentoBox 1.4.0 API --- pom.xml | 4 ++-- .../world/bentobox/caveblock/CaveBlock.java | 14 +++++++---- .../world/bentobox/caveblock/Settings.java | 23 ++++++++++--------- src/main/resources/config.yml | 6 ++--- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index c01cbfb..c78dc2a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ world.bentobox caveblock - 0.1.0 + 0.1.1 CaveBlock CaveBlock is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland. @@ -86,7 +86,7 @@ world.bentobox bentobox - 1.2.0 + 1.4.0-SNAPSHOT provided diff --git a/src/main/java/world/bentobox/caveblock/CaveBlock.java b/src/main/java/world/bentobox/caveblock/CaveBlock.java index c170de6..8535b78 100644 --- a/src/main/java/world/bentobox/caveblock/CaveBlock.java +++ b/src/main/java/world/bentobox/caveblock/CaveBlock.java @@ -30,6 +30,7 @@ public class CaveBlock extends GameModeAddon this.saveDefaultConfig(); this.loadSettings(); + this.saveWorldSettings(); } @@ -62,10 +63,7 @@ public class CaveBlock extends GameModeAddon @Override public void onDisable() { - if (this.settings != null) - { - new Config<>(this, Settings.class).saveConfigObject(this.settings); - } + // Do nothing } @@ -206,6 +204,13 @@ public class CaveBlock extends GameModeAddon return this.settings; } + @Override + public void saveWorldSettings() { + if (settings != null) { + new Config<>(this, Settings.class).saveConfigObject(settings); + } + + } // --------------------------------------------------------------------- // Section: Variables @@ -237,4 +242,5 @@ public class CaveBlock extends GameModeAddon * String for the end world. */ private static final String THE_END = "_the_end"; + } diff --git a/src/main/java/world/bentobox/caveblock/Settings.java b/src/main/java/world/bentobox/caveblock/Settings.java index 9e74479..4908fc4 100644 --- a/src/main/java/world/bentobox/caveblock/Settings.java +++ b/src/main/java/world/bentobox/caveblock/Settings.java @@ -358,13 +358,13 @@ public class Settings implements DataObject, WorldSettings /** - * This method returns the visibleSettings object. - * @return the visibleSettings object. + * This method returns the hiddenFlags object. + * @return the hiddenFlags object. */ @Override - public List getVisibleSettings() + public List getHiddenFlags() { - return visibleSettings; + return hiddenFlags; } @@ -1111,13 +1111,13 @@ public class Settings implements DataObject, WorldSettings /** - * This method sets the visibleSettings object value. - * @param visibleSettings the visibleSettings object new value. + * This method sets the hiddenFlags object value. + * @param hiddenFlags the hiddenFlags object new value. * */ - public void setVisibleSettings(List visibleSettings) + public void setHiddenFlags(List hiddenFlags) { - this.visibleSettings = visibleSettings; + this.hiddenFlags = hiddenFlags; } @@ -1803,9 +1803,10 @@ public class Settings implements DataObject, WorldSettings @Adapter(FlagSerializer2.class) private Map defaultIslandSettings = new HashMap<>(); - @ConfigComment("These are the settings visible to users. (Not implemented yet)") - @ConfigEntry(path = "world.visible-settings", experimental = true) - private List visibleSettings = new ArrayList<>(); + @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 islands cannot use these commands in this world") @ConfigEntry(path = "world.visitor-banned-commands") diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 29691c8..20f48e7 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -258,9 +258,9 @@ world: MONSTER_SPAWN: true FIRE_SPREAD: true PVP_OVERWORLD: false - # These are the settings visible to users. (Not implemented yet) - # /!\ This feature is experimental and might not work as expected or might not work at all. - visible-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 islands cannot use these commands in this world visitor-banned-commands: - spawner From f026891bda593ca540e84495fa0c242836d51c2d Mon Sep 17 00:00:00 2001 From: BONNe Date: Thu, 28 Mar 2019 23:29:46 +0200 Subject: [PATCH 09/11] Update to BentoBox 1.4; Init next version. Add build.number to pom and addon.yml. Replace develop profile with ci profile. It will be activated by BUILD_NUMBER variable, but will change only build.number property. Add '-SNAPSHOT' at the end of revision. It will now be added by default. --- pom.xml | 16 +++++++++++----- src/main/resources/addon.yml | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index f43dcfd..8831cb1 100644 --- a/pom.xml +++ b/pom.xml @@ -46,16 +46,19 @@ 1.8 1.13.2-R0.1-SNAPSHOT - 1.4.0-SNAPSHOT + 1.4.0 - ${build.version} + ${build.version}-SNAPSHOT - 1.4.0-SNAPSHOT + 1.4.0 + 0 + + - develop + ci env.BUILD_NUMBER @@ -63,10 +66,13 @@ - ${build.version}-SNAPSHOT #${env.BUILD_NUMBER} + ${env.BUILD_NUMBER} + + + master diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml index a006fc4..aebe7ff 100644 --- a/src/main/resources/addon.yml +++ b/src/main/resources/addon.yml @@ -1,6 +1,6 @@ name: CaveBlock main: world.bentobox.caveblock.CaveBlock -version: ${version} +version: ${version}-#${build.number} authors: BONNe From 989b3fc65c7e070ccff767037573554a1a26f761 Mon Sep 17 00:00:00 2001 From: BONNe Date: Thu, 28 Mar 2019 23:37:16 +0200 Subject: [PATCH 10/11] Add IslandExpelCommand. --- .../java/world/bentobox/caveblock/commands/IslandCommand.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/world/bentobox/caveblock/commands/IslandCommand.java b/src/main/java/world/bentobox/caveblock/commands/IslandCommand.java index df73586..91e95e4 100644 --- a/src/main/java/world/bentobox/caveblock/commands/IslandCommand.java +++ b/src/main/java/world/bentobox/caveblock/commands/IslandCommand.java @@ -44,6 +44,10 @@ public class IslandCommand extends CompositeCommand { new IslandBanCommand(this); new IslandUnbanCommand(this); new IslandBanlistCommand(this); + + // Expel command + new IslandExpelCommand(this); + // Team commands new IslandTeamCommand(this); } From ef8343546fb66db08d99f566fdae6c1c28ae348f Mon Sep 17 00:00:00 2001 From: BONNe Date: Thu, 28 Mar 2019 23:38:42 +0200 Subject: [PATCH 11/11] Improve performance for a bit... Like... some nanoseconds :) --- .../generators/populators/MaterialPopulator.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java b/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java index 5c3d0ff..88e988a 100644 --- a/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java +++ b/src/main/java/world/bentobox/caveblock/generators/populators/MaterialPopulator.java @@ -62,7 +62,9 @@ public class MaterialPopulator extends BlockPopulator @Override public void populate(World world, Random random, Chunk chunk) { - for (Map.Entry> entry : chances.get(world.getEnvironment()).materialChanceMap.entrySet()) + Chances chances = this.chances.get(world.getEnvironment()); + + for (Map.Entry> entry : chances.materialChanceMap.entrySet()) { for (int subY = 1; subY < worldHeight; subY += 16) { @@ -81,7 +83,7 @@ public class MaterialPopulator extends BlockPopulator */ Block block = chunk.getBlock(x, y, z); - if (block.getType().equals(chances.get(world.getEnvironment()).mainMaterial)) + if (block.getType().equals(chances.mainMaterial)) { int packSize = random.nextInt(entry.getValue().z); @@ -120,9 +122,8 @@ public class MaterialPopulator extends BlockPopulator block = chunk.getBlock(x, y, z); - continuePlacing = packSize > 0 && - (block.getType().equals(chances.get(world.getEnvironment()).mainMaterial) || - block.getType().equals(entry.getKey())); + continuePlacing = packSize > 0 && (block.getType().equals(chances.mainMaterial) || + block.getType().equals(entry.getKey())); } } }