From d982cf08625634d69588514420dbe7b53fd55340 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Mar 2026 21:55:16 +0000 Subject: [PATCH 1/2] Initial plan From 092c533b33fb92f3984cae55dd38efd781349f47 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Mar 2026 22:10:59 +0000 Subject: [PATCH 2/2] Make home list clickable in chat - clicking a home name runs the go command Modifies home list display in IslandGoCommand, IslandSethomeCommand, IslandDeletehomeCommand, and IslandRenamehomeCommand to use clickable text components. Each home name now has a run_command click action (/ go ) and a hover tooltip ("Click to teleport"). Adds new locale key commands.island.sethome.click-to-teleport for the translatable hover text. Fixes #2458 Co-authored-by: tastybento <4407265+tastybento@users.noreply.github.com> Agent-Logs-Url: https://github.com/BentoBoxWorld/BentoBox/sessions/58eb3b51-0d65-487c-8499-14dc4e4714a6 --- .../api/commands/island/IslandDeletehomeCommand.java | 5 ++++- .../bentobox/api/commands/island/IslandGoCommand.java | 5 ++++- .../api/commands/island/IslandRenamehomeCommand.java | 5 ++++- .../api/commands/island/IslandSethomeCommand.java | 10 ++++++++-- src/main/resources/locales/en-US.yml | 1 + .../commands/island/IslandDeletehomeCommandTest.java | 6 +++++- 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandDeletehomeCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandDeletehomeCommand.java index 9a6054ded..3be95313b 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandDeletehomeCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandDeletehomeCommand.java @@ -106,7 +106,10 @@ public boolean execute(User user, String label, List 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)); diff --git a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandGoCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandGoCommand.java index b3dab9883..e7afab19e 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandGoCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandGoCommand.java @@ -112,7 +112,10 @@ public boolean execute(User user, String label, List 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 diff --git a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandRenamehomeCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandRenamehomeCommand.java index bd5c882f1..f75d299a2 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandRenamehomeCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandRenamehomeCommand.java @@ -89,7 +89,10 @@ public boolean canExecute(User user, String label, List 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; } diff --git a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandSethomeCommand.java b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandSethomeCommand.java index 8e9a4634d..5473fda3a 100644 --- a/src/main/java/world/bentobox/bentobox/api/commands/island/IslandSethomeCommand.java +++ b/src/main/java/world/bentobox/bentobox/api/commands/island/IslandSethomeCommand.java @@ -93,7 +93,10 @@ public boolean canExecute(User user, String label, List 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; @@ -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") + "]")); } } } diff --git a/src/main/resources/locales/en-US.yml b/src/main/resources/locales/en-US.yml index c1ff640bd..4b1353024 100644 --- a/src/main/resources/locales/en-US.yml +++ b/src/main/resources/locales/en-US.yml @@ -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?' diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandDeletehomeCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandDeletehomeCommandTest.java index 46af37bb8..e24447e14 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandDeletehomeCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandDeletehomeCommandTest.java @@ -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); @@ -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); @@ -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]"); }