From d647b9946580dcd00ba370d62d14c3021c53cbb5 Mon Sep 17 00:00:00 2001 From: Sodium-Aluminate Date: Sun, 24 Dec 2023 23:35:45 +0800 Subject: [PATCH] =?UTF-8?q?tp=E4=BF=AE=E6=94=B9=E6=9D=83=E9=99=90=EF=BC=8C?= =?UTF-8?q?find=E8=BE=93=E5=87=BA=E5=8F=AF=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/de/strifel/VTools/commands/CommandFind.java | 9 ++++++++- src/main/java/de/strifel/VTools/commands/CommandTp.java | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/strifel/VTools/commands/CommandFind.java b/src/main/java/de/strifel/VTools/commands/CommandFind.java index b360a91..938309a 100644 --- a/src/main/java/de/strifel/VTools/commands/CommandFind.java +++ b/src/main/java/de/strifel/VTools/commands/CommandFind.java @@ -5,6 +5,8 @@ import com.velocitypowered.api.command.SimpleCommand; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.ProxyServer; import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.event.ClickEvent; +import net.kyori.adventure.text.format.NamedTextColor; import java.util.ArrayList; import java.util.List; @@ -29,7 +31,12 @@ public class CommandFind implements SimpleCommand { if (strings.length == 1) { Optional player = server.getPlayer(strings[0]); if (player.isPresent() && player.get().getCurrentServer().isPresent()) { - commandSource.sendMessage(Component.text("Player " + strings[0] + " is on " + player.get().getCurrentServer().get().getServerInfo().getName() + "!").color(COLOR_YELLOW)); + String serverName = player.get().getCurrentServer().get().getServerInfo().getName(); + commandSource.sendMessage(Component.empty() + .append(Component.text("Player " + strings[0] + " is on ").color(COLOR_YELLOW)) + .append(Component.text(serverName).clickEvent(ClickEvent.runCommand("/server " + serverName)).color(NamedTextColor.GRAY)) + .append(Component.text("!").color(COLOR_YELLOW)) + ); } else { commandSource.sendMessage(Component.text("The player is not online!").color(COLOR_YELLOW)); } diff --git a/src/main/java/de/strifel/VTools/commands/CommandTp.java b/src/main/java/de/strifel/VTools/commands/CommandTp.java index 69d5c8f..cba25a9 100644 --- a/src/main/java/de/strifel/VTools/commands/CommandTp.java +++ b/src/main/java/de/strifel/VTools/commands/CommandTp.java @@ -56,6 +56,6 @@ public class CommandTp implements SimpleCommand { @Override public boolean hasPermission(Invocation commandInvocation) { - return commandInvocation.source().hasPermission("VTools.tps"); + return commandInvocation.source().hasPermission("VTools.tps") || commandInvocation.source().hasPermission("vtools.server.auto"); } }