mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-18 00:20:44 +00:00
add player suggestion for nlcpn
This commit is contained in:
@@ -5,6 +5,7 @@ import com.velocitypowered.api.command.SimpleCommand;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import net.civmc.nameApi.NameAPI;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ChangePlayerNameCommand implements SimpleCommand {
|
||||
@@ -43,4 +44,16 @@ public class ChangePlayerNameCommand implements SimpleCommand {
|
||||
public boolean hasPermission(Invocation invocation) {
|
||||
return invocation.source().hasPermission("civproxy.changeplayername");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> suggest(final Invocation invocation) {
|
||||
List<String> suggestions = new java.util.ArrayList<>();
|
||||
if (invocation.arguments().length > 1) {
|
||||
return suggestions; // No suggestions for the second argument
|
||||
}
|
||||
|
||||
// Suggest online player names for the first argument
|
||||
server.getAllPlayers().forEach(player -> suggestions.add(player.getUsername()));
|
||||
return suggestions;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user