mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
fixes and addition of '*' to match all unmatched users.
This commit is contained in:
parent
32099a4109
commit
0c82c61574
16 changed files with 84 additions and 23 deletions
|
@ -461,7 +461,9 @@ public class Settings implements ISettings
|
|||
{
|
||||
return config.getConfigurationSection("list").getValues(false);
|
||||
}
|
||||
return new HashMap<String, Object>();
|
||||
Map<String, Object> defaultMap = new HashMap<String, Object>();
|
||||
defaultMap.put("User", "*");
|
||||
return defaultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -71,8 +71,10 @@ public class Commandlist extends EssentialsCommand
|
|||
}
|
||||
final StringBuilder groupString = new StringBuilder();
|
||||
Set<String> keys = ess.getSettings().getListGroupConfig().keySet();
|
||||
|
||||
if (args.length > 0)
|
||||
{
|
||||
|
||||
final List<User> users = new ArrayList<User>();
|
||||
String group = args[0].toLowerCase();
|
||||
for (String key : keys)
|
||||
|
@ -113,12 +115,21 @@ public class Commandlist extends EssentialsCommand
|
|||
}
|
||||
else
|
||||
{
|
||||
Map<String, String> usedGroups = new HashMap();
|
||||
List<String> usedGroups = new ArrayList<String>();
|
||||
List<String> usedGroupsAsterisk = new ArrayList<String>();
|
||||
Map<String, Boolean> asterisk = new HashMap<String, Boolean>();
|
||||
boolean hasAsterisk = false;
|
||||
for (String group : keys)
|
||||
{
|
||||
boolean userLimit = false;
|
||||
String groupValue = ess.getSettings().getListGroupConfig().get(group).toString().trim();
|
||||
usedGroups.put(group.toLowerCase(), groupValue);
|
||||
if (groupValue.equals("*"))
|
||||
{
|
||||
asterisk.put(group, true);
|
||||
hasAsterisk = true;
|
||||
continue;
|
||||
}
|
||||
usedGroups.add(group.toLowerCase());
|
||||
if (groupValue.equals("hidden"))
|
||||
{
|
||||
continue;
|
||||
|
@ -132,9 +143,10 @@ public class Commandlist extends EssentialsCommand
|
|||
List<User> u = sort.get(group);
|
||||
if (u != null && !u.isEmpty())
|
||||
{
|
||||
users.addAll(u);
|
||||
|
||||
if (userLimit)
|
||||
{
|
||||
users.addAll(u);
|
||||
int limit = Integer.parseInt(groupValue);
|
||||
if (u.size() > limit)
|
||||
{
|
||||
|
@ -158,22 +170,25 @@ public class Commandlist extends EssentialsCommand
|
|||
continue;
|
||||
}
|
||||
users.addAll(u);
|
||||
usedGroupsAsterisk.add(groupValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
String[] groups = groupValue.split(",");
|
||||
for (String g : groups)
|
||||
{
|
||||
g = g.trim().toLowerCase();
|
||||
if (g == null || g.equals(""))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
u = sort.get(g.trim());
|
||||
u = sort.get(g);
|
||||
if (u == null || u.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
users.addAll(u);
|
||||
usedGroupsAsterisk.add(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -181,6 +196,10 @@ public class Commandlist extends EssentialsCommand
|
|||
{
|
||||
continue;
|
||||
}
|
||||
if (ess.getPermissionsHandler().getName().equals("ConfigPermissions"))
|
||||
{
|
||||
group = _("connectedPlayers");
|
||||
}
|
||||
groupString.append(_("listGroupTag", Util.replaceFormat(group)));
|
||||
groupString.append(listUsers(users));
|
||||
groupString.setCharAt(0, Character.toTitleCase(groupString.charAt(0)));
|
||||
|
@ -189,19 +208,59 @@ public class Commandlist extends EssentialsCommand
|
|||
}
|
||||
final String[] groups = sort.keySet().toArray(new String[0]);
|
||||
Arrays.sort(groups, String.CASE_INSENSITIVE_ORDER);
|
||||
List<User> asteriskUsers = new ArrayList<User>();
|
||||
String asteriskGroup = "";
|
||||
if (hasAsterisk)
|
||||
{
|
||||
for(String key : asterisk.keySet())
|
||||
{
|
||||
if (asterisk.get(key) == true)
|
||||
{
|
||||
asteriskGroup = key.toLowerCase();
|
||||
for (String group : groups)
|
||||
{
|
||||
group = group.toLowerCase();
|
||||
if (usedGroups.containsKey(group))
|
||||
group = group.toLowerCase().trim();
|
||||
if (usedGroups.contains(group) || usedGroupsAsterisk.contains(group))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
asteriskUsers.addAll(sort.get(group));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String group : groups)
|
||||
{
|
||||
group = group.toLowerCase().trim();
|
||||
if (usedGroups.contains(group))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
List<User> users = sort.get(group);
|
||||
|
||||
if (ess.getPermissionsHandler().getName().equals("ConfigPermissions"))
|
||||
{
|
||||
group = _("connectedPlayers");
|
||||
}
|
||||
if (hasAsterisk)
|
||||
{
|
||||
if (asteriskUsers == null || asteriskUsers.isEmpty())
|
||||
{
|
||||
break;
|
||||
}
|
||||
users = asteriskUsers;
|
||||
group = asteriskGroup;
|
||||
}
|
||||
groupString.append(_("listGroupTag", Util.replaceFormat(group)));
|
||||
final List<User> users = sort.get(group);
|
||||
|
||||
groupString.append(listUsers(users));
|
||||
groupString.setCharAt(0, Character.toTitleCase(groupString.charAt(0)));
|
||||
sender.sendMessage(groupString.toString());
|
||||
groupString.setLength(0);
|
||||
if (hasAsterisk)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ backup:
|
|||
# Set this true to enable permission per warp.
|
||||
per-warp-permission: false
|
||||
|
||||
# Sort output of /list command by groups.]
|
||||
# Sort output of /list command by groups.
|
||||
# You are not allowed to have duplicate keys.
|
||||
list:
|
||||
# this will merge the two groups owner and co-owner together in the list group "admin",
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a74Command {0} is improperly loaded.
|
|||
compassBearing=\u00a76Bearing: {0} ({1} degrees).
|
||||
configFileMoveError=Failed to move config.yml to backup location.
|
||||
configFileRenameError=Failed to rename temp file to config.yml.
|
||||
connectedPlayers=\u00a76Connected players:\u00a7r
|
||||
connectedPlayers=\u00a76Connected players\u00a7r
|
||||
connectionFailed=Failed to open connection.
|
||||
cooldownWithMessage=\u00a74Cooldown: {0}
|
||||
corruptNodeInConfig=\u00a74Notice: Your configuration file has a corrupt {0} node.
|
||||
|
|
|
@ -58,7 +58,7 @@ commandNotLoaded=\u00a7cPrikaz {0} je nespravne nacteny.
|
|||
compassBearing=\u00a77Zmena orientace: {0} ({1} stupnu).
|
||||
configFileMoveError=Chyba pri presouvani config.yml do slozky se zalohou.
|
||||
configFileRenameError=Chyba pri pokusu o prejmenovani docasneho souboru na config.yml
|
||||
connectedPlayers=Pripojeni hraci:
|
||||
connectedPlayers=\u00a77Pripojeni hraci\u00a7r
|
||||
connectionFailed=Pokus o otevreni spojeni selhal.
|
||||
cooldownWithMessage=\u00a7cOdpocet: {0}
|
||||
corruptNodeInConfig=\u00a74Pozor: Vas konfiguracni soubor ma chybnou {0} poznamku.
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a7cKommando {0} er ikke indl\u00e6st korrekt.
|
|||
compassBearing=\u00a77B\u00e6rer: {0} ({1} grader). (Oversat korrekt?)
|
||||
configFileMoveError=Kunne ikke flytte config.yml til backup placering.
|
||||
configFileRenameError=Kunne ikke omd\u00f8be temp fil til config.yml
|
||||
connectedPlayers=Tilsluttede spillere:
|
||||
connectedPlayers=\u00a77Tilsluttede spillere\u00a7r
|
||||
connectionFailed=Kunne ikke \u00e5bne forbindelse.
|
||||
cooldownWithMessage=\u00a7cCooldown: {0}
|
||||
corruptNodeInConfig=\u00a74Notits: Din konfigurationsfil har en korrupt {0} linje.
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a7cBefehl {0} ist nicht richtig geladen.
|
|||
compassBearing=\u00a77Peilung: {0} ({1} Grad).
|
||||
configFileMoveError=Verschieben von config.yml in den Sicherheitskopien-Ordner gescheitert.
|
||||
configFileRenameError=Verschieben einer tempor\u00e4ren Datei nach config.yml gescheitert.
|
||||
connectedPlayers=Verbundene Spieler:
|
||||
connectedPlayers=\u00a77Verbundene Spieler\u00a77
|
||||
connectionFailed=Fehler beim Verbindungsaufbau.
|
||||
cooldownWithMessage=\u00a7cBeschr\u00e4nkung: {0}
|
||||
corruptNodeInConfig=\u00a74Hinweis: Deine Konfigurationsdatei hat einen ung\u00fcltigen Knoten {0}.
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a74Command {0} is improperly loaded.
|
|||
compassBearing=\u00a76Bearing: {0} ({1} degrees).
|
||||
configFileMoveError=Failed to move config.yml to backup location.
|
||||
configFileRenameError=Failed to rename temp file to config.yml.
|
||||
connectedPlayers=\u00a76Connected players:\u00a7r
|
||||
connectedPlayers=\u00a76Connected players\u00a7r
|
||||
connectionFailed=Failed to open connection.
|
||||
cooldownWithMessage=\u00a74Cooldown: {0}
|
||||
corruptNodeInConfig=\u00a74Notice: Your configuration file has a corrupt {0} node.
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a7cComando {0} esta cargado incorrectamente.
|
|||
compassBearing=\u00a77Bearing: {0} ({1} grados).
|
||||
configFileMoveError=Error al mover config.yml para hacer una copia de seguridad de la localizacion.
|
||||
configFileRenameError=Error al renombrar archivo temp a config.yml.
|
||||
connectedPlayers=Jugadores conectados:
|
||||
connectedPlayers=\u00a77Jugadores conectados\u00a7r
|
||||
connectionFailed=Error al abrir conexion.
|
||||
cooldownWithMessage=\u00a7cTiempo restante: {0}
|
||||
corruptNodeInConfig=\u00a74Notice: Tu archivo de configuracion tiene un nodo {0} incorrecto.
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a7cKomento {0} on v\u00e4\u00e4rin ladattu.
|
|||
compassBearing=\u00a77Osoittaa: {0} ({1} astetta).
|
||||
configFileMoveError=Virhe siirrett\u00e4ess\u00e4 tiedostoa config.yml varmuuskopio sijaintiin.
|
||||
configFileRenameError=Virhe nimett\u00e4ess\u00e4 tiedostoa temp tiedostoon config.yml
|
||||
connectedPlayers=Liittyneet pelaajat:
|
||||
connectedPlayers=\u00a77Liittyneet pelaajat\u00a77r
|
||||
connectionFailed=Virhe avattaessa yhteytt\u00e4.
|
||||
cooldownWithMessage=\u00a7cJ\u00e4\u00e4htyminen: {0}
|
||||
corruptNodeInConfig=\u00a74Huom: Sinun konfigurointi tiedostossa on virhe {0}.
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a7cLa commande {0} a \u00e9t\u00e9 mal charg\u00e9e.
|
|||
compassBearing=\u00a77Orientation : {0} ({1} degr\u00e9s).
|
||||
configFileMoveError=\u00c9chec du d\u00e9placement de config.yml vers l'emplacement de sauvegarde.
|
||||
configFileRenameError=\u00c9chec du changement de nom du fichier temporaire de config.yml
|
||||
connectedPlayers=Joueurs connect\u00e9s :
|
||||
connectedPlayers=\u00a77Joueurs connect\u00e9s\u00a7r
|
||||
connectionFailed=\u00c9chec de la connexion.
|
||||
cooldownWithMessage=\u00a7cR\u00e9utilisation : {0}
|
||||
corruptNodeInConfig=\u00a74Annonce : Votre fichier de configuration a un {0} n\u0153ud corrompu.
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a7cIl comando {0} non e'' stato caricato correttamente.
|
|||
compassBearing=\u00a77Bussola: {0} ({1} gradi).
|
||||
configFileMoveError=Impossibile spostare config.yml nel backup.
|
||||
configFileRenameError=Impossibile rinominare il file temporale in config.yml
|
||||
connectedPlayers=Players connessi:
|
||||
connectedPlayers=\u00a77Players connessi\u00a7r
|
||||
connectionFailed=Connessione fallita.
|
||||
cooldownWithMessage=\u00a7cIn esaurimento: {0}
|
||||
corruptNodeInConfig=\u00a74Avviso: errore nel tuo file di configurazione, nodo {0}.
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a7cOpdracht {0} is fout geladen.
|
|||
compassBearing=\u00a77Ligging: {0} ({1} graden).
|
||||
configFileMoveError=Het verplaatsen van config.yml naar de backup locatie is mislukt.
|
||||
configFileRenameError=Fout bij het hernoemen van de tijdelijke map naar config.yml
|
||||
connectedPlayers=Spelers online:
|
||||
connectedPlayers=\u00a77Spelers online\u00a7r
|
||||
connectionFailed=Fout bij het verbinden.
|
||||
cooldownWithMessage=\u00a7cAfkoeltijd: {0}
|
||||
corruptNodeInConfig=\u00a74Waarschuwing: Het configuratiebestand bevat een fout {0}.
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a74Komenda {0} nie jest zaladowana!
|
|||
compassBearing=\u00a77Lozko: {0} ({1} stopni).
|
||||
configFileMoveError=Nie udalo sie przeniesc config.yml do lokalizacji backupa.
|
||||
configFileRenameError=Nie udalo sie zmienic nazwy tymczasowego pliku na config.yml
|
||||
connectedPlayers=\u00a77Obecni gracze:\u00a7r
|
||||
connectedPlayers=\u00a77Obecni gracze\u00a7r
|
||||
connectionFailed=Blad podczas otwierania polaczenia.
|
||||
cooldownWithMessage=\u00a74Cooldown: {0}
|
||||
corruptNodeInConfig=\u00a74Uwaga: Twoj plik konfiguracyjny ma uszkodzony wpis: {0}
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a7cCommando {0} provavelmente esta carregado.
|
|||
compassBearing=\u00a77Inclina\u00e7ao: {0} ({1} graus).
|
||||
configFileMoveError=Falha ao mover arquivo config.yml ao local de backup.
|
||||
configFileRenameError=Falha em renomear arquivo temporario em config.yml
|
||||
connectedPlayers=Jogadores conectados:
|
||||
connectedPlayers=\u00a77Jogadores conectados\u00a7r
|
||||
connectionFailed=Falha ao abrir conexao.
|
||||
cooldownWithMessage=\u00a7cTempo de espera: {0}
|
||||
corruptNodeInConfig=\u00a74Aviso: Seu arquivo de configura\u00e7ao tem uma parte {0} corrompida.
|
||||
|
|
|
@ -55,7 +55,7 @@ commandNotLoaded=\u00a7cKommando {0} \u00e4r felaktigt laddat.
|
|||
compassBearing=\u00a77B\u00e4ring: {0} ({1} grader).
|
||||
configFileMoveError=Kunde inte flytta config.yml till backup-platsen.
|
||||
configFileRenameError=Kunde inte byta namn p\u00e5 temp-filen till config.yml
|
||||
connectedPlayers=Anslutna spelare:
|
||||
connectedPlayers=\u00a77Anslutna spelare\u00a7r
|
||||
connectionFailed=Kunde inte \u00f6ppna anslutning.
|
||||
cooldownWithMessage=\u00a7cNedkylning: {0}
|
||||
corruptNodeInConfig=\u00a74Observera: Din konfigurationsfil har en korrupt {0} nod.
|
||||
|
|
Loading…
Reference in a new issue