diff --git a/pom.xml b/pom.xml index f0c28a5..2bc9381 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,7 @@ -LOCAL - 1.21.1 + 1.21.2 BentoBoxWorld_AOneBlock bentobox-world diff --git a/src/main/java/world/bentobox/aoneblock/AOneBlock.java b/src/main/java/world/bentobox/aoneblock/AOneBlock.java index 3ea3ba7..0e165bc 100644 --- a/src/main/java/world/bentobox/aoneblock/AOneBlock.java +++ b/src/main/java/world/bentobox/aoneblock/AOneBlock.java @@ -130,7 +130,13 @@ public void onLoad() { // Register protection flag with BentoBox getPlugin().getFlagsManager().registerFlag(this, START_SAFETY); // Bossbar - getPlugin().getFlagsManager().registerFlag(this, this.ONEBLOCK_BOSSBAR); + if (getSettings().isBossBar()) { + getPlugin().getFlagsManager().registerFlag(this, this.ONEBLOCK_BOSSBAR); + } + // Actionbar + if (getSettings().isActionBar()) { + getPlugin().getFlagsManager().registerFlag(this, this.ONEBLOCK_ACTIONBAR); + } // Magic Block protection getPlugin().getFlagsManager().registerFlag(this, this.MAGIC_BLOCK); } @@ -171,7 +177,9 @@ public void onEnable() { registerListener(new BlockProtect(this)); registerListener(new JoinLeaveListener(this)); registerListener(new InfoListener(this)); - registerListener(bossBar); + if (getSettings().isBossBar() && getSettings().isActionBar()) { + registerListener(bossBar); + } // Register placeholders phManager = new AOneBlockPlaceholders(this, getPlugin().getPlaceholdersManager()); diff --git a/src/main/java/world/bentobox/aoneblock/Settings.java b/src/main/java/world/bentobox/aoneblock/Settings.java index d17cb51..cc14c3f 100644 --- a/src/main/java/world/bentobox/aoneblock/Settings.java +++ b/src/main/java/world/bentobox/aoneblock/Settings.java @@ -37,59 +37,72 @@ public class Settings implements WorldSettings { /* Commands */ @ConfigComment("Player command. What command users will run to access their island.") @ConfigComment("To define alias, just separate commands with white space.") - @ConfigEntry(path = "aoneblock.command.island", since = "1.3.0") + @ConfigEntry(path = "aoneblock.command.island") //, since = "1.3.0") private String playerCommandAliases = "ob oneblock"; @ConfigComment("The admin command.") @ConfigComment("To define alias, just separate commands with white space.") - @ConfigEntry(path = "aoneblock.command.admin", since = "1.3.0") + @ConfigEntry(path = "aoneblock.command.admin") // , since = "1.3.0") private String adminCommandAliases = "oba obadmin"; @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 = "aoneblock.command.new-player-action", since = "1.2.0") + @ConfigEntry(path = "aoneblock.command.new-player-action") // , since = "1.2.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 = "aoneblock.command.default-action", since = "1.2.0") + @ConfigEntry(path = "aoneblock.command.default-action") // , since = "1.2.0") private String defaultPlayerAction = "go"; @ConfigComment("The command label that shows current phase progress.") @ConfigComment("By default it is 'count'.") - @ConfigEntry(path = "aoneblock.command.count-command", since = "1.10.0") + @ConfigEntry(path = "aoneblock.command.count-command") // , since = "1.10.0") private String countCommand = "count"; @ConfigComment("The command label that opens phases GUI.") @ConfigComment("By default it is 'phases'.") - @ConfigEntry(path = "aoneblock.command.phases-command", since = "1.10.0") + @ConfigEntry(path = "aoneblock.command.phases-command") // , since = "1.10.0") private String phasesCommand = "phases"; @ConfigComment("The command label that allows to change island phase.") @ConfigComment("By default it is 'setCount'.") - @ConfigEntry(path = "aoneblock.command.set-count-command", since = "1.10.0") + @ConfigEntry(path = "aoneblock.command.set-count-command") // , since = "1.10.0") private String setCountCommand = "setCount"; - @ConfigComment("The command label that toggers the progress bar.") + @ConfigComment("Enables the bossbar and its command to show progress.") + @ConfigEntry(path = "aoneblock.command.bossbar", since = "1.21.2") + private boolean bossBar = true; + + @ConfigComment("The command label that toggles the progress bar.") @ConfigComment("By default it is 'bossbar'.") - @ConfigEntry(path = "aoneblock.command.bossbar-command", since = "1.19.0") + @ConfigEntry(path = "aoneblock.command.bossbar-command") // , since = "1.19.0") private String bossBarCommand = "bossbar"; + + @ConfigComment("Enables the action bar and its command to show progress.") + @ConfigEntry(path = "aoneblock.command.actionbar", since = "1.21.2") + private boolean actionBar = true; + + @ConfigComment("The command label that toggles the action bar progress.") + @ConfigComment("By default it is 'actionbar'.") + @ConfigEntry(path = "aoneblock.command.actionbar-command", since = "1.21.2") + private String actionBarCommand = "actionbar"; @ConfigComment("How long a player must wait until they can use the setCount command again. In minutes.") @ConfigComment("This is the command that is run from the phases panel.") - @ConfigEntry(path = "aoneblock.command.set-count-cooldown", since = "1.13.0") + @ConfigEntry(path = "aoneblock.command.set-count-cooldown") // , since = "1.13.0") private int setCountCooldown = 5; @ConfigComment("The command label that allows to check if magic block is present and respawns it if not.") @ConfigComment("By default it is 'respawnBlock check'.") - @ConfigEntry(path = "aoneblock.command.respawn-block-command", since = "1.10.0") + @ConfigEntry(path = "aoneblock.command.respawn-block-command") // , since = "1.10.0") private String respawnBlockCommand = "respawnBlock check"; @ConfigComment("Placeholder customization") @ConfigComment("Symbol for the percentage completed scale bar") - @ConfigEntry(path = "aoneblock.placeholders.scale-symbol", since = "1.9.0") + @ConfigEntry(path = "aoneblock.placeholders.scale-symbol") // , since = "1.9.0") private String percentCompleteSymbol = "■"; /* WORLD */ @@ -150,21 +163,21 @@ public class Settings implements WorldSettings { @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.11.2") + @ConfigEntry(path = "world.spawn-limits.monsters") // , since = "1.11.2") private int spawnLimitMonsters = -1; - @ConfigEntry(path = "world.spawn-limits.animals", since = "1.11.2") + @ConfigEntry(path = "world.spawn-limits.animals") // , since = "1.11.2") private int spawnLimitAnimals = -1; - @ConfigEntry(path = "world.spawn-limits.water-animals", since = "1.11.2") + @ConfigEntry(path = "world.spawn-limits.water-animals") // , since = "1.11.2") private int spawnLimitWaterAnimals = -1; - @ConfigEntry(path = "world.spawn-limits.ambient", since = "1.11.2") + @ConfigEntry(path = "world.spawn-limits.ambient") // , since = "1.11.2") 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.11.2") + @ConfigEntry(path = "world.spawn-limits.ticks-per-animal-spawns") // , since = "1.11.2") 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.11.2") + @ConfigEntry(path = "world.spawn-limits.ticks-per-monster-spawns") // , since = "1.11.2") private int ticksPerMonsterSpawns = -1; @ConfigComment("Radius of island in blocks. (So distance between islands is twice this)") @@ -280,7 +293,7 @@ public class Settings implements WorldSettings { @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.") @ConfigComment("This option requires `allow-nether=true` in server.properties.") - @ConfigEntry(path = "world.nether.create-and-link-portals", since = "1.16") + @ConfigEntry(path = "world.nether.create-and-link-portals") // , since = "1.16") private boolean makeNetherPortals = false; // End @@ -297,7 +310,7 @@ public class Settings implements WorldSettings { @ConfigComment("This option indicates if obsidian platform in the end should be generated") @ConfigComment("when player enters the end world.") @ConfigComment("This option requires `allow-end=true` in bukkit.yml.") - @ConfigEntry(path = "world.end.create-obsidian-platform", since = "1.16") + @ConfigEntry(path = "world.end.create-obsidian-platform") // , since = "1.16") private boolean makeEndPortals = false; @ConfigComment("Mob white list - these mobs will NOT be removed when logging in or doing /island") @@ -327,7 +340,7 @@ public class Settings implements WorldSettings { @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", since = "1.4.1") + @ConfigEntry(path = "world.hidden-flags") // , since = "1.4.1") private List hiddenFlags = new ArrayList<>(); @ConfigComment("Visitor banned commands - Visitors to islands cannot use these commands in this world") @@ -336,7 +349,7 @@ public class Settings implements WorldSettings { @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", since = "1.8.0") + @ConfigEntry(path = "world.falling-banned-commands") // , since = "1.8.0") private List fallingBannedCommands = new ArrayList<>(); // --------------------------------------------- @@ -344,7 +357,7 @@ public class Settings implements WorldSettings { /* ISLAND */ @ConfigComment("Drop broken blocks on top of magic block") @ConfigComment("If you want Jobs or other plugins to recognize magic block breaking this must be false") - @ConfigEntry(path = "island.drop-on-top", since = "1.3.0") + @ConfigEntry(path = "island.drop-on-top") // , since = "1.3.0") private boolean dropOnTop = true; @ConfigComment("Magic block mob warning") @@ -365,13 +378,13 @@ public class Settings implements WorldSettings { @ConfigComment("Default maximum number of coop rank members per island") @ConfigComment("Players can have the aoneblock.coop.maxsize. permission to be bigger but") @ConfigComment("permission size cannot be less than the default below. ") - @ConfigEntry(path = "island.max-coop-size", since = "1.13.0") + @ConfigEntry(path = "island.max-coop-size") // , since = "1.13.0") private int maxCoopSize = 4; @ConfigComment("Default maximum number of trusted rank members per island") @ConfigComment("Players can have the aoneblock.trust.maxsize. permission to be bigger but") @ConfigComment("permission size cannot be less than the default below. ") - @ConfigEntry(path = "island.max-trusted-size", since = "1.13.0") + @ConfigEntry(path = "island.max-trusted-size") // , since = "1.13.0") private int maxTrustSize = 4; @ConfigComment("Default maximum number of homes a player can have. Min = 1") @@ -413,15 +426,15 @@ public class Settings implements WorldSettings { private boolean onJoinResetInventory = true; @ConfigComment("Reset health - if true, the player's health will be reset.") - @ConfigEntry(path = "island.reset.on-join.health", since = "1.8.0") + @ConfigEntry(path = "island.reset.on-join.health") // , since = "1.8.0") private boolean onJoinResetHealth = true; @ConfigComment("Reset hunger - if true, the player's hunger will be reset.") - @ConfigEntry(path = "island.reset.on-join.hunger", since = "1.8.0") + @ConfigEntry(path = "island.reset.on-join.hunger") // , since = "1.8.0") private boolean onJoinResetHunger = true; @ConfigComment("Reset experience points - if true, the player's experience will be reset.") - @ConfigEntry(path = "island.reset.on-join.exp", since = "1.8.0") + @ConfigEntry(path = "island.reset.on-join.exp") // , since = "1.8.0") private boolean onJoinResetXP = true; @@ -443,15 +456,15 @@ public class Settings implements WorldSettings { private boolean onLeaveResetInventory = false; @ConfigComment("Reset health - if true, the player's health will be reset.") - @ConfigEntry(path = "island.reset.on-leave.health", since = "1.8.0") + @ConfigEntry(path = "island.reset.on-leave.health") // , since = "1.8.0") private boolean onLeaveResetHealth = false; @ConfigComment("Reset hunger - if true, the player's hunger will be reset.") - @ConfigEntry(path = "island.reset.on-leave.hunger", since = "1.8.0") + @ConfigEntry(path = "island.reset.on-leave.hunger") // , since = "1.8.0") private boolean onLeaveResetHunger = false; @ConfigComment("Reset experience - if true, the player's experience will be reset.") - @ConfigEntry(path = "island.reset.on-leave.exp", since = "1.8.0") + @ConfigEntry(path = "island.reset.on-leave.exp") // , since = "1.8.0") private boolean onLeaveResetXP = false; @ConfigComment("Reset Ender Chest - if true, the player's Ender Chest will be cleared.") @@ -473,13 +486,13 @@ public class Settings implements WorldSettings { @ConfigComment(" * Island 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 = "island.create-island-on-first-login.enable", since = "1.9.0") + @ConfigEntry(path = "island.create-island-on-first-login.enable") // , since = "1.9.0") private boolean createIslandOnFirstLoginEnabled; @ConfigComment("Time in seconds after the player logged in, before his island gets created.") @ConfigComment("If set to 0 or less, the island will be created directly upon the player's login.") @ConfigComment("It is recommended to keep this value under a minute's time.") - @ConfigEntry(path = "island.create-island-on-first-login.delay", since = "1.9.0") + @ConfigEntry(path = "island.create-island-on-first-login.delay") // , since = "1.9.0") private int createIslandOnFirstLoginDelay = 5; @ConfigComment("Toggles whether the island creation should be aborted if the player logged off while the") @@ -492,19 +505,19 @@ public class Settings implements WorldSettings { @ConfigComment(" * If the island creation started before the player logged off, it will continue.") @ConfigComment("If set to false, the player's island 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 = "island.create-island-on-first-login.abort-on-logout", since = "1.9.0") + @ConfigEntry(path = "island.create-island-on-first-login.abort-on-logout") // , since = "1.9.0") private boolean createIslandOnFirstLoginAbortOnLogout = true; @ConfigComment("Toggles whether the player should be teleported automatically to his island when it is created.") @ConfigComment("If set to false, the player will be told his island is ready but will have to teleport to his island using the command.") - @ConfigEntry(path = "island.teleport-player-to-island-when-created", since = "1.10.0") + @ConfigEntry(path = "island.teleport-player-to-island-when-created") // , since = "1.10.0") private boolean teleportPlayerToIslandUponIslandCreation = true; @ConfigComment("Create Nether or End islands if they are missing when a player goes through a portal.") @ConfigComment("Nether and End islands are usually pasted when a player makes their island, 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 = "island.create-missing-nether-end-islands", since = "1.10.0") + @ConfigEntry(path = "island.create-missing-nether-end-islands") // , since = "1.10.0") private boolean pasteMissingIslands = false; // Commands @@ -518,7 +531,7 @@ public class Settings implements WorldSettings { @ConfigComment("Here are some examples of valid commands to execute:") @ConfigComment(" * \"[SUDO] bbox version\"") @ConfigComment(" * \"obadmin deaths set [player] 0\"") - @ConfigEntry(path = "island.commands.on-join", since = "1.8.0") + @ConfigEntry(path = "island.commands.on-join") // , since = "1.8.0") private List onJoinCommands = new ArrayList<>(); @ConfigComment("List of commands to run when a player leaves an island, resets his island or gets kicked from it.") @@ -533,7 +546,7 @@ public class Settings implements WorldSettings { @ConfigComment(" * 'obadmin 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 = "island.commands.on-leave", since = "1.8.0") + @ConfigEntry(path = "island.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.") @@ -548,7 +561,7 @@ public class Settings implements WorldSettings { @ConfigComment(" * 'obadmin 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 = "island.commands.on-respawn", since = "1.14.0") + @ConfigEntry(path = "island.commands.on-respawn") // , since = "1.14.0") private List onRespawnCommands = new ArrayList<>(); // Sethome @@ -578,7 +591,7 @@ public class Settings implements WorldSettings { private boolean teamJoinDeathReset = true; @ConfigComment("Reset player death count when they start a new island or reset an island") - @ConfigEntry(path = "island.deaths.reset-on-new-island", since = "1.6.0") + @ConfigEntry(path = "island.deaths.reset-on-new-island") // , since = "1.6.0") private boolean deathsResetOnNewIsland = true; // --------------------------------------------- @@ -591,7 +604,7 @@ public class Settings implements WorldSettings { @ConfigComment("AOneBlock blocked mobs.") @ConfigComment("List of mobs that should not spawn in AOneBlock.") - @ConfigEntry(path = "protection.block-mobs", since = "1.2.0") + @ConfigEntry(path = "protection.block-mobs") // , since = "1.2.0") private List mobLimitSettings = new ArrayList<>(); @@ -2252,4 +2265,46 @@ public void setBossBarCommand(String bossBarCommand) { this.bossBarCommand = bossBarCommand; } + /** + * @return the bossBar + */ + public boolean isBossBar() { + return bossBar; + } + + /** + * @param bossBar the bossBar to set + */ + public void setBossBar(boolean bossBar) { + this.bossBar = bossBar; + } + + /** + * @return the actionBar + */ + public boolean isActionBar() { + return actionBar; + } + + /** + * @param actionBar the actionBar to set + */ + public void setActionBar(boolean actionBar) { + this.actionBar = actionBar; + } + + /** + * @return the actionBarCommand + */ + public String getActionBarCommand() { + return actionBarCommand; + } + + /** + * @param actionBarCommand the actionBarCommand to set + */ + public void setActionBarCommand(String actionBarCommand) { + this.actionBarCommand = actionBarCommand; + } + } \ No newline at end of file diff --git a/src/main/java/world/bentobox/aoneblock/commands/island/IslandActionBarCommand.java b/src/main/java/world/bentobox/aoneblock/commands/island/IslandActionBarCommand.java index 4ac71d6..30422de 100644 --- a/src/main/java/world/bentobox/aoneblock/commands/island/IslandActionBarCommand.java +++ b/src/main/java/world/bentobox/aoneblock/commands/island/IslandActionBarCommand.java @@ -3,7 +3,9 @@ import java.util.List; import world.bentobox.aoneblock.AOneBlock; +import world.bentobox.aoneblock.listeners.BossBarListener; import world.bentobox.bentobox.api.commands.CompositeCommand; +import world.bentobox.bentobox.api.metadata.MetaDataValue; import world.bentobox.bentobox.api.user.User; public class IslandActionBarCommand extends CompositeCommand { @@ -26,12 +28,19 @@ public void setup() { @Override public boolean execute(User user, String label, List args) { - addon.getBossBar().toggleUser(user); getIslands().getIslandAt(user.getLocation()).ifPresent(i -> { if (!i.isAllowed(addon.ONEBLOCK_ACTIONBAR)) { user.sendMessage("aoneblock.actionbar.not-active"); } }); + // Toggle state + boolean newState = !user.getMetaData(BossBarListener.AONEBLOCK_ACTIONBAR).map(MetaDataValue::asBoolean).orElse(true); + user.putMetaData(BossBarListener.AONEBLOCK_ACTIONBAR, new MetaDataValue(newState)); + if (newState) { + user.sendMessage("aoneblock.commands.island.actionbar.status_on"); + } else { + user.sendMessage("aoneblock.commands.island.actionbar.status_off"); + } return true; } } diff --git a/src/main/java/world/bentobox/aoneblock/commands/island/PlayerCommand.java b/src/main/java/world/bentobox/aoneblock/commands/island/PlayerCommand.java index f268edc..a3e5be8 100644 --- a/src/main/java/world/bentobox/aoneblock/commands/island/PlayerCommand.java +++ b/src/main/java/world/bentobox/aoneblock/commands/island/PlayerCommand.java @@ -21,22 +21,31 @@ public void setup() { // Count new IslandCountCommand(this, - settings.getCountCommand().split(" ")[0], - settings.getCountCommand().split(" ")); + settings.getCountCommand().split(" ")[0], + settings.getCountCommand().split(" ")); // Phase list new IslandPhasesCommand(this, - settings.getPhasesCommand().split(" ")[0], - settings.getPhasesCommand().split(" ")); + settings.getPhasesCommand().split(" ")[0], + settings.getPhasesCommand().split(" ")); // Set Count new IslandSetCountCommand(this, - settings.getSetCountCommand().split(" ")[0], - settings.getSetCountCommand().split(" ")); + settings.getSetCountCommand().split(" ")[0], + settings.getSetCountCommand().split(" ")); // Force block respawn new IslandRespawnBlockCommand(this, - settings.getRespawnBlockCommand().split(" ")[0], - settings.getRespawnBlockCommand().split(" ")); + settings.getRespawnBlockCommand().split(" ")[0], + settings.getRespawnBlockCommand().split(" ")); + + // Action bar + if (settings.isActionBar()) { + new IslandActionBarCommand(this, settings.getActionBarCommand().split(" ")[0], + settings.getActionBarCommand().split(" ")); + } + // Boss bar - new IslandBossBarCommand(this, settings.getBossBarCommand().split(" ")[0], - settings.getBossBarCommand().split(" ")); + if (settings.isBossBar()) { + new IslandBossBarCommand(this, settings.getBossBarCommand().split(" ")[0], + settings.getBossBarCommand().split(" ")); + } } } diff --git a/src/main/java/world/bentobox/aoneblock/listeners/BossBarListener.java b/src/main/java/world/bentobox/aoneblock/listeners/BossBarListener.java index 822f377..db8f082 100644 --- a/src/main/java/world/bentobox/aoneblock/listeners/BossBarListener.java +++ b/src/main/java/world/bentobox/aoneblock/listeners/BossBarListener.java @@ -18,7 +18,6 @@ import org.eclipse.jdt.annotation.NonNull; import net.kyori.adventure.text.Component; -import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import world.bentobox.aoneblock.AOneBlock; import world.bentobox.aoneblock.dataobjects.OneBlockIslands; @@ -33,7 +32,7 @@ public class BossBarListener implements Listener { private static final String AONEBLOCK_BOSSBAR = "aoneblock.bossbar"; - private static final String AONEBLOCK_ACTIONBAR = "aoneblock.actionbar"; + public static final String AONEBLOCK_ACTIONBAR = "aoneblock.actionbar"; private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer.builder() .character('&') @@ -98,11 +97,9 @@ private void tryToShowActionBar(UUID uuid, Island island) { if (!island.isAllowed(addon.ONEBLOCK_ACTIONBAR)) { return; } - // Default to showing boss bar unless it is explicitly turned off + // Default to showing action bar unless it is explicitly turned off if (!user.getMetaData(AONEBLOCK_ACTIONBAR).map(MetaDataValue::asBoolean).orElse(true)) { - // Remove any boss bar from user if they are in the world - removeBar(user, island); - // Do not show a boss bar + // Do not show a action bar return; } // Get the progress diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml index fc1623a..7eeb0e7 100755 --- a/src/main/resources/addon.yml +++ b/src/main/resources/addon.yml @@ -50,9 +50,12 @@ permissions: aoneblock.island: description: Allow use of '/ob' command - the main island command default: TRUE + aoneblock.island.actionbar: + description: Allow use of '/ob actionbar' command - toggle the actionbar + default: TRUE aoneblock.island.bossbar: - description: Allow use of '/ob bossbar' command - toggle the bossbar - default: FALSE + description: Allow use of '/ob bossbar' command - toggle the bossbar + default: TRUE aoneblock.island.home: description: Allow use of '/ob go' command - teleport you to your island default: TRUE diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index a5f60bb..6f86e16 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -3,46 +3,49 @@ aoneblock: command: # Player command. What command users will run to access their island. # To define alias, just separate commands with white space. - # Added since 1.3.0. island: ob oneblock # The admin command. # To define alias, just separate commands with white space. - # Added since 1.3.0. admin: obadmin oneblockadmin oba # The default action for new player command call. # Sub-command of main player command that will be run on first player command call. # By default it is sub-command 'create'. - # Added since 1.2.0. new-player-action: create # The default action for player command. # Sub-command of main player command that will be run on each player command call. # By default it is sub-command 'go'. - # Added since 1.2.0. default-action: go # The command label that shows current phase progress. # By default it is 'count'. - # Added since 1.10.0. count-command: count # The command label that opens phases GUI. # By default it is 'phases'. - # Added since 1.10.0. phases-command: phases # The command label that allows to change island phase. # By default it is 'setCount'. - # Added since 1.10.0. set-count-command: setCount + # Enables the bossbar and its command to show progress. + # Added since 1.21.2. + bossbar: true + # The command label that toggles the progress bar. + # By default it is 'bossbar'. + bossbar-command: bossbar + # Enables the action bar and its command to show progress. + # Added since 1.21.2. + actionbar: true + # The command label that toggles the action bar progress. + # By default it is 'actionbar'. + # Added since 1.21.2. + actionbar-command: actionbar # How long a player must wait until they can use the setCount command again. In minutes. # This is the command that is run from the phases panel. - # Added since 1.13.0. set-count-cooldown: 5 # The command label that allows to check if magic block is present and respawns it if not. # By default it is 'respawnBlock check'. - # Added since 1.10.0. respawn-block-command: respawnBlock check placeholders: # Placeholder customization # Symbol for the percentage completed scale bar - # Added since 1.9.0. scale-symbol: ■ world: # Friendly name for this world. Used in admin commands. Must be a single word @@ -86,21 +89,15 @@ world: spawn-limits: # Spawn limits. These override the limits set in bukkit.yml # If set to a negative number, the server defaults will be used - # Added since 1.11.2. monsters: -1 - # Added since 1.11.2. animals: -1 - # Added since 1.11.2. water-animals: -1 - # Added since 1.11.2. ambient: -1 # Setting to 0 will disable animal spawns, but this is not recommended. Minecraft default is 400. # A negative value uses the server default - # Added since 1.11.2. ticks-per-animal-spawns: -1 # Setting to 0 will disable monster spawns, but this is not recommended. Minecraft default is 400. # A negative value uses the server default - # Added since 1.11.2. ticks-per-monster-spawns: -1 # Radius of island in blocks. (So distance between islands is twice this) # It is the same for every dimension : Overworld, Nether and End. @@ -125,6 +122,9 @@ world: # Island height - Lowest is 5. # It is the y coordinate of the bedrock block in the schem. island-height: 80 + # The number of concurrent islands a player can have in the world + # A value of 0 will use the BentoBox config.yml default + concurrent-islands: 1 # Disallow team members from having their own islands. disallow-team-member-islands: true # Use your own world generator for this world. @@ -145,11 +145,11 @@ world: # a new island for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR default-game-mode: SURVIVAL # The default biome for the overworld - default-biome: PLAINS + default-biome: plains # The default biome for the nether world (this may affect what mobs can spawn) - default-nether-biome: NETHER_WASTES + default-nether-biome: nether_wastes # The default biome for the end world (this may affect what mobs can spawn) - default-end-biome: THE_END + default-end-biome: the_end # The maximum number of players a player can ban at any one time in this game mode. # The permission acidisland.ban.maxlimit.X where X is a number can also be used per player # -1 = unlimited @@ -178,7 +178,6 @@ world: # Option will simulate vanilla portal mechanics that links portals together # or creates a new portal, if there is not a portal in that dimension. # This option requires `allow-nether=true` in server.properties. - # Added since 1.16. create-and-link-portals: false end: # End Nether - if this is false, the end world will not be made and access to @@ -191,13 +190,12 @@ world: # This option indicates if obsidian platform in the end should be generated # when player enters the end world. # This option requires `allow-end=true` in bukkit.yml. - # Added since 1.16. create-obsidian-platform: false # Mob white list - these mobs will NOT be removed when logging in or doing /island remove-mobs-whitelist: - - ENDERMAN - - ZOMBIE_VILLAGER - - WITHER + - enderman + - wither + - zombie_villager # World flags. These are boolean settings for various flags for this world flags: CREEPER_DAMAGE: true @@ -244,9 +242,11 @@ world: BUCKET: 500 LOCK: 0 ENDER_PEARL: 500 + BELL_RINGING: 500 DOOR: 500 BREAK_HOPPERS: 500 FURNACE: 500 + HURT_TAMED_ANIMALS: 500 ANVIL: 500 MINECART: 500 FISH_SCOOPING: 500 @@ -296,6 +296,7 @@ world: COMMAND_RANKS: 500 BEACON: 500 ALLAY: 500 + CRAFTER: 500 TRAPDOOR: 500 PRESSURE_PLATE: 0 EXPERIENCE_BOTTLE_THROWING: 500 @@ -318,11 +319,13 @@ world: SMITHING: 500 EXPERIENCE_PICKUP: 500 HOPPER: 500 + CANDLES: 500 LEASH: 500 MOUNT_INVENTORY: 500 BREAK_BLOCKS: 500 CHORUS_FRUIT: 500 CONTAINER: 500 + MAGIC_BLOCK: 200 JUKEBOX: 500 POTION_THROWING: 500 BARREL: 500 @@ -339,15 +342,16 @@ world: SHULKER_TELEPORT: true FIRE_SPREAD: true FIRE_BURNING: true + COMMAND_RANKS: true PVP_OVERWORLD: false TNT_DAMAGE: true MONSTER_SPAWNERS_SPAWN: true FIRE_IGNITE: true + ONEBLOCK_BOSSBAR: true BLOCK_EXPLODE_DAMAGE: true ANIMAL_SPAWNERS_SPAWN: true # These settings/flags are hidden from users # Ops can toggle hiding in-game using SHIFT-LEFT-CLICK on flags in settings - # Added since 1.4.1. hidden-flags: [] # Visitor banned commands - Visitors to islands cannot use these commands in this world visitor-banned-commands: @@ -355,14 +359,12 @@ world: - spawnmob # Falling banned commands - players cannot use these commands when falling # if the PREVENT_TELEPORT_WHEN_FALLING world setting flag is active - # Added since 1.8.0. falling-banned-commands: - warp - spawn island: # Drop broken blocks on top of magic block # If you want Jobs or other plugins to recognize magic block breaking this must be false - # Added since 1.3.0. drop-on-top: true # Magic block mob warning # Players might be able to hear hostile mobs up to this many blocks away @@ -376,12 +378,10 @@ island: # Default maximum number of coop rank members per island # Players can have the aoneblock.coop.maxsize. permission to be bigger but # 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 island # Players can have the aoneblock.trust.maxsize. permission to be bigger but # 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 # Accessed via /is sethome or /is go @@ -411,13 +411,10 @@ island: # plugin may still reset the inventory when the world changes. inventory: false # Reset health - if true, the player's health will be reset. - # Added since 1.8.0. health: false # Reset hunger - if true, the player's hunger will be reset. - # Added since 1.8.0. hunger: false # Reset experience points - if true, the player's experience will be reset. - # Added since 1.8.0. exp: false # Reset Ender Chest - if true, the player's Ender Chest will be cleared. ender-chest: false @@ -432,13 +429,10 @@ island: # plugin may still reset the inventory when the world changes. inventory: true # Reset health - if true, the player's health will be reset. - # Added since 1.8.0. health: false # Reset hunger - if true, the player's hunger will be reset. - # Added since 1.8.0. hunger: false # Reset experience - if true, the player's experience will be reset. - # Added since 1.8.0. exp: false # Reset Ender Chest - if true, the player's Ender Chest will be cleared. ender-chest: false @@ -458,12 +452,10 @@ island: # * Island creation can be resource-intensive, please consider the options below to help mitigate # the potential issues, especially if you expect a lot of players to connect to your server # in a limited period of time. - # Added since 1.9.0. enable: false # Time in seconds after the player logged in, before his island gets created. # If set to 0 or less, the island will be created directly upon the player's login. # It is recommended to keep this value under a minute's time. - # Added since 1.9.0. delay: 5 # Toggles whether the island creation should be aborted if the player logged off while the # delay (see the option above) has not worn off yet. @@ -475,17 +467,14 @@ island: # * If the island creation started before the player logged off, it will continue. # If set to false, the player's island will be created even if he went offline in the meantime. # Note this option has no effect if the delay (see the option above) is set to 0 or less. - # Added since 1.9.0. abort-on-logout: true # Toggles whether the player should be teleported automatically to his island when it is created. # If set to false, the player will be told his island is ready but will have to teleport to his island using the command. - # Added since 1.10.0. teleport-player-to-island-when-created: true # Create Nether or End islands if they are missing when a player goes through a portal. # Nether and End islands are usually pasted when a player makes their island, but if they are # missing for some reason, you can switch this on. # Note that bedrock removal glitches can exploit this option. - # Added since 1.10.0. create-missing-nether-end-islands: false commands: # List of commands to run when a player joins an island or creates one. @@ -498,7 +487,6 @@ island: # Here are some examples of valid commands to execute: # * "[SUDO] bbox version" # * "obadmin deaths set [player] 0" - # Added since 1.8.0. on-join: [] # List of commands to run when a player leaves an island, resets his island or gets kicked from it. # These commands are run by the console, unless otherwise stated using the [SUDO] prefix, @@ -512,7 +500,6 @@ island: # * 'obadmin 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, @@ -526,7 +513,6 @@ island: # * 'obadmin 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: [] sethome: nether: @@ -543,7 +529,6 @@ island: # When a player joins a team, reset their death count team-join-reset: true # Reset player death count when they start a new island or reset an island - # Added since 1.6.0. reset-on-new-island: true protection: # Geo restrict mobs. @@ -554,7 +539,6 @@ protection: - BLAZE # AOneBlock blocked mobs. # List of mobs that should not spawn in AOneBlock. - # Added since 1.2.0. block-mobs: [] # Invincible visitors. List of damages that will not affect visitors. # Make list blank if visitors should receive all damages diff --git a/src/test/java/world/bentobox/aoneblock/AOneBlockTest.java b/src/test/java/world/bentobox/aoneblock/AOneBlockTest.java index 1b0d21c..25241de 100644 --- a/src/test/java/world/bentobox/aoneblock/AOneBlockTest.java +++ b/src/test/java/world/bentobox/aoneblock/AOneBlockTest.java @@ -267,6 +267,7 @@ public void testOnLoad() { */ @Test public void testOnReload() { + addon.onLoad(); addon.onEnable(); addon.onReload(); // Check that config.yml file has been saved @@ -313,6 +314,7 @@ public void testGetWorldSettings() { */ @Test public void testGetOneBlocksIsland() { + addon.onLoad(); addon.onEnable(); @NonNull OneBlockIslands i = addon.getOneBlocksIsland(island);