diff --git a/pom.xml b/pom.xml index cebdfea..bb6098c 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ -LOCAL - 2.20.0 + 2.21.0 BentoBoxWorld_Level bentobox-world https://sonarcloud.io diff --git a/src/main/java/world/bentobox/level/Level.java b/src/main/java/world/bentobox/level/Level.java index 0ba0c1b..98f4a08 100644 --- a/src/main/java/world/bentobox/level/Level.java +++ b/src/main/java/world/bentobox/level/Level.java @@ -26,6 +26,7 @@ import world.bentobox.level.commands.AdminSetInitialLevelCommand; import world.bentobox.level.commands.AdminStatsCommand; import world.bentobox.level.commands.AdminTopCommand; +import world.bentobox.level.commands.IslandDetailCommand; import world.bentobox.level.commands.IslandLevelCommand; import world.bentobox.level.commands.IslandTopCommand; import world.bentobox.level.commands.IslandValueCommand; @@ -34,7 +35,6 @@ import world.bentobox.level.listeners.IslandActivitiesListeners; import world.bentobox.level.listeners.JoinLeaveListener; import world.bentobox.level.listeners.MigrationListener; -import world.bentobox.level.objects.LevelsData; import world.bentobox.level.requests.LevelRequestHandler; import world.bentobox.level.requests.TopTenRequestHandler; import world.bentobox.visit.VisitAddon; @@ -249,6 +249,7 @@ private void registerCommands(GameModeAddon gm) { new IslandLevelCommand(this, playerCmd); new IslandTopCommand(this, playerCmd); new IslandValueCommand(this, playerCmd); + new IslandDetailCommand(this, playerCmd); }); } diff --git a/src/main/java/world/bentobox/level/commands/IslandDetailCommand.java b/src/main/java/world/bentobox/level/commands/IslandDetailCommand.java new file mode 100644 index 0000000..24d08ec --- /dev/null +++ b/src/main/java/world/bentobox/level/commands/IslandDetailCommand.java @@ -0,0 +1,36 @@ +package world.bentobox.level.commands; + +import java.util.List; + +import world.bentobox.bentobox.api.commands.CompositeCommand; +import world.bentobox.bentobox.api.user.User; +import world.bentobox.level.Level; +import world.bentobox.level.panels.DetailsPanel; + + +public class IslandDetailCommand extends CompositeCommand { + + private final Level addon; + + public IslandDetailCommand(Level addon, CompositeCommand parent) { + super(parent, "detail"); + this.addon = addon; + } + + @Override + public void setup() { + setPermission("island.detail"); + setDescription("island.detail.description"); + setOnlyPlayer(true); + } + + @Override + public boolean execute(User user, String label, List list) { + if (getIslands().hasIsland(getWorld(), user)) { + DetailsPanel.openPanel(this.addon, getWorld(), user); + } else { + user.sendMessage("general.errors.no-island"); + } + return true; + } +} diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml index c8b35ec..56dcc8a 100755 --- a/src/main/resources/addon.yml +++ b/src/main/resources/addon.yml @@ -13,6 +13,9 @@ permissions: '[gamemode].island.level': description: Player can use level command default: true + '[gamemode].island.detail': + description: Player can use island detail command + default: true '[gamemode].island.top': description: Player can use top ten command default: true diff --git a/src/main/resources/locales/en-US.yml b/src/main/resources/locales/en-US.yml index d11e474..b1bc380 100755 --- a/src/main/resources/locales/en-US.yml +++ b/src/main/resources/locales/en-US.yml @@ -51,7 +51,8 @@ island: cooldown: "&c You must wait &b[time] &c seconds until you can do that again" in-progress: "&6 Island level calculation is in progress..." time-out: "&c The level calculation took too long. Please try again later." - + detail: + description: "shows detail of your island blocks" top: description: "show the Top Ten" gui-title: "&a Top Ten" diff --git a/src/test/java/world/bentobox/level/LevelTest.java b/src/test/java/world/bentobox/level/LevelTest.java index 7fd0f9a..2dd0e87 100644 --- a/src/test/java/world/bentobox/level/LevelTest.java +++ b/src/test/java/world/bentobox/level/LevelTest.java @@ -287,7 +287,7 @@ private static void deleteAll(File file) throws IOException { public void testAllLoaded() { addon.allLoaded(); verify(plugin).log("[Level] Level hooking into BSkyBlock"); - verify(cmd, times(3)).getAddon(); // 3 commands + verify(cmd, times(4)).getAddon(); // 4 commands verify(adminCmd, times(5)).getAddon(); // Five commands // Placeholders verify(phm).registerPlaceholder(eq(addon), eq("bskyblock_island_level"), any());