diff options
author | snowleo <schneeleo@gmail.com> | 2011-07-19 01:27:16 +0200 |
---|---|---|
committer | snowleo <schneeleo@gmail.com> | 2011-07-19 01:27:16 +0200 |
commit | c8ba06f0ee55abf09a0ab0968945cb9ab1f52a21 (patch) | |
tree | 8e715e4eabe25e3bc2b5aac081e316445e2bcbd6 | |
parent | a65390ed98986028feeb44a566a76086736e35cb (diff) | |
download | Essentials-c8ba06f0ee55abf09a0ab0968945cb9ab1f52a21.tar Essentials-c8ba06f0ee55abf09a0ab0968945cb9ab1f52a21.tar.gz Essentials-c8ba06f0ee55abf09a0ab0968945cb9ab1f52a21.tar.lz Essentials-c8ba06f0ee55abf09a0ab0968945cb9ab1f52a21.tar.xz Essentials-c8ba06f0ee55abf09a0ab0968945cb9ab1f52a21.zip |
We can't test for essentials.jail.exempt, if the player is offline, so added a new permission essentials.togglejail.offline
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java index 8e5480e74..3312dafc0 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtogglejail.java @@ -5,6 +5,7 @@ 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 Commandtogglejail extends EssentialsCommand @@ -26,10 +27,22 @@ public class Commandtogglejail extends EssentialsCommand if (args.length >= 2 && !p.isJailed()) { - if (p.isAuthorized("essentials.jail.exempt")) + if (p.getBase() instanceof OfflinePlayer) { - sender.sendMessage(Util.i18n("mayNotJail")); - return; + if (sender instanceof Player + && !ess.getUser(sender).isAuthorized("essentials.togglejail.offline")) + { + sender.sendMessage(Util.i18n("mayNotJail")); + return; + } + } + else + { + if (p.isAuthorized("essentials.jail.exempt")) + { + sender.sendMessage(Util.i18n("mayNotJail")); + return; + } } charge(sender); p.setJailed(true); |