summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-07-19 01:32:48 +0200
committersnowleo <schneeleo@gmail.com>2011-07-19 01:32:48 +0200
commit150a0e0ddddc421e2a68dc7fa9d39b565beca439 (patch)
treea229366f91126974b1ff297b9ec43004578ec2a3
parentd388290427f8d16dd6418bdcea9badfff2461ec3 (diff)
downloadEssentials-150a0e0ddddc421e2a68dc7fa9d39b565beca439.tar
Essentials-150a0e0ddddc421e2a68dc7fa9d39b565beca439.tar.gz
Essentials-150a0e0ddddc421e2a68dc7fa9d39b565beca439.tar.lz
Essentials-150a0e0ddddc421e2a68dc7fa9d39b565beca439.tar.xz
Essentials-150a0e0ddddc421e2a68dc7fa9d39b565beca439.zip
/tempban and /ban have the same problem as /tjail
new permissions: essentials.ban.offline essentials.tempban.offline
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandban.java23
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtempban.java20
2 files changed, 35 insertions, 8 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
index 1499b10ac..2bd09831d 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java
@@ -1,9 +1,11 @@
package com.earth2me.essentials.commands;
+import com.earth2me.essentials.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
+import org.bukkit.entity.Player;
public class Commandban extends EssentialsCommand
@@ -21,12 +23,24 @@ public class Commandban extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final User player = getPlayer(server, args, 0, true);
- if (player.isAuthorized("essentials.ban.exempt"))
+ if (player.getBase() instanceof OfflinePlayer)
{
- sender.sendMessage(Util.i18n("banExempt"));
- return;
+ if (sender instanceof Player
+ && !ess.getUser(sender).isAuthorized("essentials.ban.offline"))
+ {
+ sender.sendMessage(Util.i18n("banExempt"));
+ return;
+ }
}
-
+ else
+ {
+ if (player.isAuthorized("essentials.ban.exempt"))
+ {
+ sender.sendMessage(Util.i18n("banExempt"));
+ return;
+ }
+ }
+
String banReason;
if (args.length > 1)
{
@@ -42,4 +56,3 @@ public class Commandban extends EssentialsCommand
server.broadcastMessage(Util.format("playerBanned", player.getName(), banReason));
}
}
-
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
index 639c2bda0..c9495401e 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java
@@ -1,9 +1,11 @@
package com.earth2me.essentials.commands;
+import com.earth2me.essentials.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
+import org.bukkit.entity.Player;
public class Commandtempban extends EssentialsCommand
@@ -21,10 +23,22 @@ public class Commandtempban extends EssentialsCommand
throw new NotEnoughArgumentsException();
}
final User player = getPlayer(server, args, 0, true);
- if (player.isAuthorized("essentials.tempban.exempt"))
+ if (player.getBase() instanceof OfflinePlayer)
{
- sender.sendMessage(Util.i18n("tempbanExempt"));
- return;
+ if (sender instanceof Player
+ && !ess.getUser(sender).isAuthorized("essentials.tempban.offline"))
+ {
+ sender.sendMessage(Util.i18n("tempbanExempt"));
+ return;
+ }
+ }
+ else
+ {
+ if (player.isAuthorized("essentials.tempban.exempt"))
+ {
+ sender.sendMessage(Util.i18n("tempbanExempt"));
+ return;
+ }
}
final String time = getFinalArg(args, 1);
final long banTimestamp = Util.parseDateDiff(time, true);