Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ public boolean execute(User user, String label, List<String> args) {
if (!map.containsKey(name)) {
user.sendMessage("commands.island.go.unknown-home");
user.sendMessage("commands.island.sethome.homes-are");
map.keySet().stream().filter(s -> !s.isEmpty()).forEach(s -> user.sendMessage("commands.island.sethome.home-list-syntax", TextVariables.NAME, s));
map.keySet().stream().filter(s -> !s.isEmpty()).forEach(s -> user.sendRawMessage(
user.getTranslation("commands.island.sethome.home-list-syntax", TextVariables.NAME, s)
+ "[run_command: /" + getTopLabel() + " go " + s + "]"
+ "[hover: " + user.getTranslation("commands.island.sethome.click-to-teleport") + "]"));
return false;
}
this.askConfirmation(user, () -> delete(map.get(name), user, name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ public boolean execute(User user, String label, List<String> args) {
// Failed home name check
user.sendMessage("commands.island.go.unknown-home");
user.sendMessage("commands.island.sethome.homes-are");
names.keySet().forEach(n -> user.sendMessage("commands.island.sethome.home-list-syntax", TextVariables.NAME, n));
names.keySet().forEach(n -> user.sendRawMessage(
user.getTranslation("commands.island.sethome.home-list-syntax", TextVariables.NAME, n)
+ "[run_command: /" + getTopLabel() + " go " + n + "]"
+ "[hover: " + user.getTranslation("commands.island.sethome.click-to-teleport") + "]"));
return false;
} else {
// We know where this location is. Now work out if it's an island name or a home name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ public boolean canExecute(User user, String label, List<String> args) {
if (!getIslands().isHomeLocation(island, String.join(" ", args))) {
user.sendMessage("commands.island.go.unknown-home");
user.sendMessage("commands.island.sethome.homes-are");
island.getHomes().keySet().stream().filter(s -> !s.isEmpty()).forEach(s -> user.sendMessage("commands.island.sethome.home-list-syntax", TextVariables.NAME, s));
island.getHomes().keySet().stream().filter(s -> !s.isEmpty()).forEach(s -> user.sendRawMessage(
user.getTranslation("commands.island.sethome.home-list-syntax", TextVariables.NAME, s)
+ "[run_command: /" + getTopLabel() + " go " + s + "]"
+ "[hover: " + user.getTranslation("commands.island.sethome.click-to-teleport") + "]"));
this.showHelp(this, user);
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ public boolean canExecute(User user, String label, List<String> args) {
user.sendMessage("commands.island.sethome.too-many-homes", TextVariables.NUMBER, String.valueOf(maxHomes));
user.sendMessage("commands.island.sethome.homes-are");
getIslands().getIslands(getWorld(), user).forEach(is ->
is.getHomes().keySet().stream().filter(s -> !s.isEmpty()).forEach(s -> user.sendMessage("commands.island.sethome.home-list-syntax", TextVariables.NAME, s)));
is.getHomes().keySet().stream().filter(s -> !s.isEmpty()).forEach(s -> user.sendRawMessage(
user.getTranslation("commands.island.sethome.home-list-syntax", TextVariables.NAME, s)
+ "[run_command: /" + getTopLabel() + " go " + s + "]"
+ "[hover: " + user.getTranslation("commands.island.sethome.click-to-teleport") + "]")));
return false;
}
return true;
Expand Down Expand Up @@ -162,7 +165,10 @@ private void doSetHome(User user, String name) {
island
.getHomes()
.keySet()
.stream().filter(s -> !s.isEmpty()).forEach(s -> user.sendMessage("commands.island.sethome.home-list-syntax", TextVariables.NAME, s));
.stream().filter(s -> !s.isEmpty()).forEach(s -> user.sendRawMessage(
user.getTranslation("commands.island.sethome.home-list-syntax", TextVariables.NAME, s)
+ "[run_command: /" + getTopLabel() + " go " + s + "]"
+ "[hover: " + user.getTranslation("commands.island.sethome.click-to-teleport") + "]"));
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ commands:
home-set: '&6 Your [prefix_island] home has been set to your current location.'
homes-are: '&6 [prefix_Island] homes are:'
home-list-syntax: '&6 [name]'
click-to-teleport: '&oClick to teleport'
nether:
not-allowed: '&c You are not allowed to set your home in the Nether.'
confirmation: '&c Are you sure you want to set your home in the Nether?'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public void setUp() throws Exception {
when(ic.getUsage()).thenReturn("");
when(ic.getSubCommand(Mockito.anyString())).thenReturn(Optional.empty());
when(ic.getAddon()).thenReturn(addon);
when(ic.getTopLabel()).thenReturn("island");
when(ic.getWorld()).thenReturn(world);
// Player
when(user.isOp()).thenReturn(false);
Expand All @@ -85,6 +86,7 @@ public void setUp() throws Exception {
when(user.getName()).thenReturn("tastybento");
when(user.getWorld()).thenReturn(world);
when(user.getTranslation(anyString())).thenAnswer(i -> i.getArgument(0, String.class));
when(user.getTranslation(anyString(), anyString(), anyString())).thenAnswer(i -> i.getArgument(0, String.class));
// Island
when(island.getOwner()).thenReturn(uuid);
when(island.onIsland(any())).thenReturn(true);
Expand Down Expand Up @@ -180,7 +182,9 @@ void testExecuteUnknownHome() {
assertFalse(idh.execute(user, "label", List.of("something")));
verify(user).sendMessage("commands.island.go.unknown-home");
verify(user).sendMessage("commands.island.sethome.homes-are");
verify(user).sendMessage("commands.island.sethome.home-list-syntax", TextVariables.NAME, "home");
verify(user).sendRawMessage("commands.island.sethome.home-list-syntax"
+ "[run_command: /island go home]"
+ "[hover: commands.island.sethome.click-to-teleport]");

}

Expand Down
Loading