26 lines
1.1 KiB
Java
26 lines
1.1 KiB
Java
package server.command.commands;
|
|
|
|
import java.util.Collection;
|
|
import common.color.TextColor;
|
|
import server.command.Command;
|
|
import server.command.CommandEnvironment;
|
|
import server.command.Executor;
|
|
import server.network.User;
|
|
|
|
public class CommandUsers extends Command {
|
|
public CommandUsers() {
|
|
super("users");
|
|
}
|
|
|
|
public void exec(CommandEnvironment env, Executor exec) {
|
|
Collection<User> users = env.getServer().getUsers();
|
|
if(users.isEmpty()) {
|
|
exec.logConsole(TextColor.DGRAY + "Es sind keine Spieler registriert");
|
|
return;
|
|
}
|
|
exec.logConsole(TextColor.GREEN + "Es " + (users.size() == 1 ? "ist" : "sind") + " " + TextColor.YELLOW + "%d" + TextColor.GREEN + " Spieler registriert", users.size());
|
|
for(User user : users) {
|
|
exec.logConsole("%s%s" + TextColor.GRAY + ": %s" + TextColor.GRAY + ", %s", user.isAdmin() ? TextColor.RED : TextColor.NEON, user.getUser(), user.isOnline() ? TextColor.DGREEN + "Online" : TextColor.DGRAY + "Offline", user.getPubkey() != null ? TextColor.YELLOW + "Pubkey" : (user.getPasswordHash() != null ? TextColor.MAGENTA + "Passwort" : TextColor.BLACK + "Kein Login"));
|
|
}
|
|
}
|
|
}
|