1
0
Fork 0
forked from mc/VTools

tp修改权限,find输出可点击

This commit is contained in:
Sodium-Aluminate 2023-12-24 23:35:45 +08:00
parent 115364f202
commit d647b99465
2 changed files with 9 additions and 2 deletions

View file

@ -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> 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));
}

View file

@ -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");
}
}