summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkukelekuuk00 <kukelekuuk00@radthorne.info>2013-03-16 10:10:29 +0100
committerKHobbits <rob@khobbits.co.uk>2013-03-18 06:16:02 +0000
commit0c82c61574b57c0481e42a2a6017d98f4e9b6364 (patch)
tree160a553bf958b88ae3c5f32fe5673b2927f2153a
parent32099a41091cb87e7875b41371f66d0c15b5da9f (diff)
downloadEssentials-0c82c61574b57c0481e42a2a6017d98f4e9b6364.tar
Essentials-0c82c61574b57c0481e42a2a6017d98f4e9b6364.tar.gz
Essentials-0c82c61574b57c0481e42a2a6017d98f4e9b6364.tar.lz
Essentials-0c82c61574b57c0481e42a2a6017d98f4e9b6364.tar.xz
Essentials-0c82c61574b57c0481e42a2a6017d98f4e9b6364.zip
fixes and addition of '*' to match all unmatched users.
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandlist.java75
-rw-r--r--Essentials/src/config.yml2
-rw-r--r--Essentials/src/messages.properties2
-rw-r--r--Essentials/src/messages_cs.properties2
-rw-r--r--Essentials/src/messages_da.properties2
-rw-r--r--Essentials/src/messages_de.properties2
-rw-r--r--Essentials/src/messages_en.properties2
-rw-r--r--Essentials/src/messages_es.properties2
-rw-r--r--Essentials/src/messages_fi.properties2
-rw-r--r--Essentials/src/messages_fr.properties2
-rw-r--r--Essentials/src/messages_it.properties2
-rw-r--r--Essentials/src/messages_nl.properties2
-rw-r--r--Essentials/src/messages_pl.properties2
-rw-r--r--Essentials/src/messages_pt.properties2
-rw-r--r--Essentials/src/messages_se.properties2
16 files changed, 84 insertions, 23 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index 80b3e9a1c..059da4e65 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -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
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java
index c2fa954a5..aeaffe324 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandlist.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandlist.java
@@ -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
+ 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().trim();
+ if (usedGroups.contains(group) || usedGroupsAsterisk.contains(group))
+ {
+ continue;
+ }
+ asteriskUsers.addAll(sort.get(group));
+ }
+ }
+ }
+ }
for (String group : groups)
{
- group = group.toLowerCase();
- if (usedGroups.containsKey(group))
+ 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;
+ }
}
}
}
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 0edc1796e..6cd1ae689 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -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",
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index f91589c6f..6f9648966 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -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.
diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties
index 18e535930..64e24ef7c 100644
--- a/Essentials/src/messages_cs.properties
+++ b/Essentials/src/messages_cs.properties
@@ -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.
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index bb83a37c2..96a4bacd7 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -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.
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index 3e883c40b..51e0ed7d2 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -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}.
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index f91589c6f..6f9648966 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -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.
diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties
index 8b5846aa9..31bb0393a 100644
--- a/Essentials/src/messages_es.properties
+++ b/Essentials/src/messages_es.properties
@@ -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.
diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties
index f2a3b2be7..46a5b74f9 100644
--- a/Essentials/src/messages_fi.properties
+++ b/Essentials/src/messages_fi.properties
@@ -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}.
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index b6b034b62..437486f72 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -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.
diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties
index cd2af2066..5994a4ee1 100644
--- a/Essentials/src/messages_it.properties
+++ b/Essentials/src/messages_it.properties
@@ -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}.
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index 41396db51..3177ed485 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -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}.
diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties
index 2421853f5..194e21165 100644
--- a/Essentials/src/messages_pl.properties
+++ b/Essentials/src/messages_pl.properties
@@ -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}
diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties
index 16e6b5955..015d10d60 100644
--- a/Essentials/src/messages_pt.properties
+++ b/Essentials/src/messages_pt.properties
@@ -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.
diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties
index ca79368eb..14a1cf677 100644
--- a/Essentials/src/messages_se.properties
+++ b/Essentials/src/messages_se.properties
@@ -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.