summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorementalo <suror@gmx.co.uk>2011-07-15 22:48:42 +0100
committerementalo <suror@gmx.co.uk>2011-07-15 22:48:42 +0100
commit1a7b198353c4d3bb108f6156aa74c47b8284bd9a (patch)
treed792baa9dcaa6a771fb9aa16f22b7eabb2722380
parent963fd7cf012472b0517e21496799945c14d8d1fe (diff)
downloadEssentials-1a7b198353c4d3bb108f6156aa74c47b8284bd9a.tar
Essentials-1a7b198353c4d3bb108f6156aa74c47b8284bd9a.tar.gz
Essentials-1a7b198353c4d3bb108f6156aa74c47b8284bd9a.tar.lz
Essentials-1a7b198353c4d3bb108f6156aa74c47b8284bd9a.tar.xz
Essentials-1a7b198353c4d3bb108f6156aa74c47b8284bd9a.zip
fixing offline player permissions check-ups.
Ban for offline players. 2 new permissions nodes. essentials.ban.exempt and essentials.kick.exempt. People with this permission cannot be banned / kicked
-rw-r--r--Essentials/src/com/earth2me/essentials/OfflinePlayer.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandban.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkick.java16
-rw-r--r--Essentials/src/messages.properties4
-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_fr.properties2
-rw-r--r--Essentials/src/messages_nl.properties2
9 files changed, 25 insertions, 15 deletions
diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
index 8427e2996..98064ecd4 100644
--- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
+++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
@@ -31,7 +31,7 @@ public class OfflinePlayer implements Player
private final String name;
final IEssentials ess = Essentials.getStatic();
private Location location = new Location(null, 0, 0, 0, 0, 0);
- private World world = null;
+ private World world = ess.getServer().getWorlds().get(0);
private UUID uniqueId = UUID.randomUUID();
public OfflinePlayer(String name)
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
index 9c897aae0..2f6141150 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
@@ -21,7 +21,12 @@ public class Commandban extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
-
+ final User player = getPlayer(server, args, 0, true);
+ if (player.isAuthorized("essentials.ban.exempt"))
+ {
+ sender.sendMessage(Util.i18n("banExempt"));
+ return;
+ }
if (server.matchPlayer(args[0]).isEmpty())
{
((CraftServer)server).getHandle().a(args[0]);
@@ -29,7 +34,6 @@ public class Commandban extends EssentialsCommand
}
else
{
- final User player = ess.getUser(server.matchPlayer(args[0]).get(0));
String banReason;
if (args.length > 1)
{
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
index a20f654da..fa04a3168 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java
@@ -13,7 +13,7 @@ public class Commandkick extends EssentialsCommand
{
super("kick");
}
-
+
@Override
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
{
@@ -21,18 +21,12 @@ public class Commandkick extends EssentialsCommand
{
throw new NotEnoughArgumentsException();
}
-
- User u;
- try
+
+ User u = getPlayer(server, args, 0);
+ if (u.isAuthorized("essentials.kick.exempt"))
{
- u = ess.getUser(server.matchPlayer(args[0]).get(0));
+ sender.sendMessage(Util.i18n("kickExempt"));
}
- catch (Throwable ex)
- {
- sender.sendMessage(Util.i18n("playerNotFound"));
- return;
- }
-
charge(sender);
final String kickReason = args.length > 1 ? getFinalArg(args, 1) : Util.i18n("kickDefault");
u.kickPlayer(kickReason);
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index b619cf2ab..a968d4153 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -12,7 +12,8 @@ backUsageMsg = \u00a77Returning to previous location.
backupFinished = Backup finished
backupStarted = Backup started
balance = \u00a77Balance: {0}
-balanceTop = \u00a77 Top {0} balances
+balanceTop = \u00a77Top {0} balances
+banExempt = \u00a7cYou can not ban that player.
banIpAddress = \u00a77Banned IP address
bannedIpsFileError = Error reading banned-ips.txt
bannedIpsFileNotFound = banned-ips.txt not found
@@ -131,6 +132,7 @@ jailNotExist = That jail does not exist.
jailSet = \u00a77Jail {0} has been set
jumpError = That would hurt your computer''s brain.
kickDefault = Kicked from server
+kickExempt = \u00a7cYou can not kick that person.
kill = \u00a77Killed {0}.
kitError = \u00a7cThere are no valid kits.
kitError2 = \u00a7cThat kit does not exist or is improperly defined.
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index 4a1703d38..e471b7dd0 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -16,6 +16,7 @@ backupStarted = Backup startede
balance = \u00a77Balance: {0}
balanceTop = \u00a77 Top {0} saldi
banIpAddress = \u00a77Bannede IP addresse
+banExempt = \u00a7cDu kan ikke forbyde den p\u00e5g\u00e6ldende spiller.
bannedIpsFileError = Fejl i l\u00e6sning af banned-ips.txt
bannedIpsFileNotFound = banned-ips.txt ikke fundet
bannedPlayersFileError = Fejl i l\u00e6sning af banned-players.txt
@@ -133,6 +134,7 @@ jailNotExist = Det f\u00e6ngsel eksisterer ikke.
jailSet = \u00a77F\u00e6ngsel {0} er blevet sat
jumpError = Det ville skade din computer''s hjerne.
kickDefault = Kicket fra serveren
+kickExempt = \u00a77Du kan ikke sparke denne spiller.
kill = \u00a77Dr\u00e6bte {0}.
kitError = \u00a7cDer er ikke nogen gyldige pakker.
kitError2 = \u00a7cDen pakke eksisterer ikke eller er forkert defineret.
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index e3f5b181f..a01c0e211 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -14,6 +14,7 @@ backupStarted = Backup gestartet
balance = \u00a77Geldb\u00f6rse: {0}
balanceTop = \u00a77 Top {0} Guthaben
banIpAddress = \u00a77IP-Adresse gesperrt.
+banExempt = \u00a7cDu kan ikke forbyde den p\u00e5g\u00e6ldende spiller.
bannedIpsFileError = Fehler beim Lesen von banned-ips.txt
bannedIpsFileNotFound = banned-ips.txt nicht gefunden
bannedPlayersFileError = Fehler beim Lesen von banned-players.txt
@@ -131,6 +132,7 @@ jailNotExist = Dieses Gef\u00e4ngnis existiert nicht.
jailSet = \u00a77Gef\u00e4ngnis {0} wurde erstellt.
jumpError = Das w\u00fcrde deinen Computer \u00fcberlasten.
kickDefault = Vom Server geworfen
+kickExempt = \u00a7cSie k\u00f6nnen nicht kicken, dass Spieler.
kill = \u00a77{0} get\u00f6tet.
kitError = \u00a7cEs gibt keine g\u00fcltigen Ausr\u00fcstungen.
kitError2 = \u00a7cDiese Ausr\u00fcstung existiert nicht oder ist ung\u00fcltig.
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index b619cf2ab..7d838ed09 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -14,6 +14,7 @@ backupStarted = Backup started
balance = \u00a77Balance: {0}
balanceTop = \u00a77 Top {0} balances
banIpAddress = \u00a77Banned IP address
+banExempt = \u00a7cYou can not ban that player.
bannedIpsFileError = Error reading banned-ips.txt
bannedIpsFileNotFound = banned-ips.txt not found
bannedPlayersFileError = Error reading banned-players.txt
@@ -131,6 +132,7 @@ jailNotExist = That jail does not exist.
jailSet = \u00a77Jail {0} has been set
jumpError = That would hurt your computer''s brain.
kickDefault = Kicked from server
+kickExempt = \u00a7cYou can not kick that person.
kill = \u00a77Killed {0}.
kitError = \u00a7cThere are no valid kits.
kitError2 = \u00a7cThat kit does not exist or is improperly defined.
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index 0c00178a3..bbdd5888a 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -14,6 +14,7 @@ backupStarted = D\u00e9but du backup
balance = \u00a77Solde: {0}
balanceTop = \u00a77 Top {0} soldes
banIpAddress = \u00a77Adresse IP banni
+banExempt = \u00a77Vous ne pouvez pas interdire ce joueur.
bannedIpsFileError = Erreur de lecture de banned-ips.txt
bannedIpsFileNotFound = Fichier banned-ips.txt introuvable
bannedPlayersFileError = Erreur lors de la lecture de banned-players.txt
@@ -131,6 +132,7 @@ jailNotExist = Cette prison n''existe pas.
jailSet = \u00a77La prison {0} a \u00e9t\u00e9 cr\u00e9\u00e9.
jumpError = \u00c7a aurait pu faire mal au cerveau de votre ordinateur.
kickDefault = Kick\u00e9 du serveur
+kickExempt = \u00a77Vous ne pouvez pas lancer ce joueur.
kill = \u00a77Tu\u00e9 {0}.
kitError = \u00a7cIl n''y a pas de kits valides.
kitError2 = \u00a7cCe kit n''existe pas ou a \u00e9t\u00e9 mal d\u00e9fini.
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index 00a0ed1ef..5ce098bdf 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -15,6 +15,7 @@ backupStarted = Backup wordt nu gemaakt
balance = \u00a77Saldo: {0}
balanceTop = \u00a77 Top {0} saldi
banIpAddress = \u00a77Verboden IP-adres
+banExempt = \u00a77Je kunt niet verbieden die speler.
bannedIpsFileError = Fout bij het lezen van banned-ips.txt
bannedIpsFileNotFound = banned-ips.txt werd niet gevonden
bannedPlayersFileError = Fout bij het lezen van banned-players.txt
@@ -132,6 +133,7 @@ jailNotExist = Die gevangenis bestaat niet.
jailSet = \u00a77Gevangenis {0} is ingesteld
jumpError = Dat zou je computers hersenen beschadigen.
kickDefault = Gekicked van de server
+kickExempt = \u00a77Je kunt niet schoppen die speler.
kill = \u00a77Jij doodde {0}.
kitError = \u00a7cEr zijn geen geldige kits.
kitError2 = \u00a7cDie kit bestaat niet of is verkeerde beschreven.