1
0
Fork 0
forked from mc/VTools

Compare commits

..

No commits in common. "d647b9946580dcd00ba370d62d14c3021c53cbb5" and "5a975a1195859972891dae4292b1656450e41d52" have entirely different histories.

3 changed files with 8 additions and 18 deletions

View file

@ -5,8 +5,6 @@ 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;
@ -31,12 +29,7 @@ public class CommandFind implements SimpleCommand {
if (strings.length == 1) {
Optional<Player> player = server.getPlayer(strings[0]);
if (player.isPresent() && player.get().getCurrentServer().isPresent()) {
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))
);
commandSource.sendMessage(Component.text("Player " + strings[0] + " is on " + player.get().getCurrentServer().get().getServerInfo().getName() + "!").color(COLOR_YELLOW));
} else {
commandSource.sendMessage(Component.text("The player is not online!").color(COLOR_YELLOW));
}

View file

@ -104,19 +104,16 @@ public class CommandSend implements SimpleCommand {
String[] currentArgs = invocation.arguments();
switch (currentArgs.length) {
case 0, 1 -> {
List<String> args = new ArrayList<>(server.getPlayerCount() + 2);
args.add("all");
args.add("current");
List<String> arg = new ArrayList<>(server.getPlayerCount() + 2);
arg.add("all");
arg.add("current");
for (Player player : server.getAllPlayers()) {
args.add(player.getUsername());
arg.add(player.getUsername());
}
return currentArgs.length==0?args:
args.stream().filter(arg->arg.regionMatches(true,0,currentArgs[0],0,currentArgs[0].length())).toList();
return arg;
}
case 2 -> {
return server.getAllServers().stream().map(s -> s.getServerInfo().getName())
.filter(name -> name.regionMatches(true, 0, currentArgs[1], 0, currentArgs[1].length()))
.toList();
return server.getAllServers().stream().map(s -> s.getServerInfo().getName()).toList();
}
default -> {
return new ArrayList<>(0);

View file

@ -56,6 +56,6 @@ public class CommandTp implements SimpleCommand {
@Override
public boolean hasPermission(Invocation commandInvocation) {
return commandInvocation.source().hasPermission("VTools.tps") || commandInvocation.source().hasPermission("vtools.server.auto");
return commandInvocation.source().hasPermission("VTools.tps");
}
}