Skip to content

Commit d302ecd

Browse files
authored
Merge pull request #366 from BentoBoxWorld/365_add_detail_command
Added detail command to access directly #365
2 parents ecfce43 + 4b25f09 commit d302ecd

File tree

6 files changed

+45
-4
lines changed

6 files changed

+45
-4
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<!-- Do not change unless you want different name for local builds. -->
6868
<build.number>-LOCAL</build.number>
6969
<!-- This allows to change between versions. -->
70-
<build.version>2.20.0</build.version>
70+
<build.version>2.21.0</build.version>
7171
<sonar.projectKey>BentoBoxWorld_Level</sonar.projectKey>
7272
<sonar.organization>bentobox-world</sonar.organization>
7373
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

src/main/java/world/bentobox/level/Level.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import world.bentobox.level.commands.AdminSetInitialLevelCommand;
2727
import world.bentobox.level.commands.AdminStatsCommand;
2828
import world.bentobox.level.commands.AdminTopCommand;
29+
import world.bentobox.level.commands.IslandDetailCommand;
2930
import world.bentobox.level.commands.IslandLevelCommand;
3031
import world.bentobox.level.commands.IslandTopCommand;
3132
import world.bentobox.level.commands.IslandValueCommand;
@@ -34,7 +35,6 @@
3435
import world.bentobox.level.listeners.IslandActivitiesListeners;
3536
import world.bentobox.level.listeners.JoinLeaveListener;
3637
import world.bentobox.level.listeners.MigrationListener;
37-
import world.bentobox.level.objects.LevelsData;
3838
import world.bentobox.level.requests.LevelRequestHandler;
3939
import world.bentobox.level.requests.TopTenRequestHandler;
4040
import world.bentobox.visit.VisitAddon;
@@ -249,6 +249,7 @@ private void registerCommands(GameModeAddon gm) {
249249
new IslandLevelCommand(this, playerCmd);
250250
new IslandTopCommand(this, playerCmd);
251251
new IslandValueCommand(this, playerCmd);
252+
new IslandDetailCommand(this, playerCmd);
252253
});
253254
}
254255

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package world.bentobox.level.commands;
2+
3+
import java.util.List;
4+
5+
import world.bentobox.bentobox.api.commands.CompositeCommand;
6+
import world.bentobox.bentobox.api.user.User;
7+
import world.bentobox.level.Level;
8+
import world.bentobox.level.panels.DetailsPanel;
9+
10+
11+
public class IslandDetailCommand extends CompositeCommand {
12+
13+
private final Level addon;
14+
15+
public IslandDetailCommand(Level addon, CompositeCommand parent) {
16+
super(parent, "detail");
17+
this.addon = addon;
18+
}
19+
20+
@Override
21+
public void setup() {
22+
setPermission("island.detail");
23+
setDescription("island.detail.description");
24+
setOnlyPlayer(true);
25+
}
26+
27+
@Override
28+
public boolean execute(User user, String label, List<String> list) {
29+
if (getIslands().hasIsland(getWorld(), user)) {
30+
DetailsPanel.openPanel(this.addon, getWorld(), user);
31+
} else {
32+
user.sendMessage("general.errors.no-island");
33+
}
34+
return true;
35+
}
36+
}

src/main/resources/addon.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ permissions:
1313
'[gamemode].island.level':
1414
description: Player can use level command
1515
default: true
16+
'[gamemode].island.detail':
17+
description: Player can use island detail command
18+
default: true
1619
'[gamemode].island.top':
1720
description: Player can use top ten command
1821
default: true

src/main/resources/locales/en-US.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ island:
5151
cooldown: "&c You must wait &b[time] &c seconds until you can do that again"
5252
in-progress: "&6 Island level calculation is in progress..."
5353
time-out: "&c The level calculation took too long. Please try again later."
54-
54+
detail:
55+
description: "shows detail of your island blocks"
5556
top:
5657
description: "show the Top Ten"
5758
gui-title: "&a Top Ten"

src/test/java/world/bentobox/level/LevelTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ private static void deleteAll(File file) throws IOException {
287287
public void testAllLoaded() {
288288
addon.allLoaded();
289289
verify(plugin).log("[Level] Level hooking into BSkyBlock");
290-
verify(cmd, times(3)).getAddon(); // 3 commands
290+
verify(cmd, times(4)).getAddon(); // 4 commands
291291
verify(adminCmd, times(5)).getAddon(); // Five commands
292292
// Placeholders
293293
verify(phm).registerPlaceholder(eq(addon), eq("bskyblock_island_level"), any());

0 commit comments

Comments
 (0)