Implement not being able to jail people who can't be jailed.

This commit is contained in:
graywolf336 2013-12-24 22:47:17 -06:00
parent 63032ad6cc
commit 38a4a859e4
3 changed files with 11 additions and 1 deletions

View File

@ -93,6 +93,13 @@ public class JailCommand implements Command {
Prisoner pris = new Prisoner(params.player(), params.muted(), time);
Player p = jm.getPlugin().getServer().getPlayer(params.player());
//If the player instance is not null and the player has the permission
//'jail.cantbejailed' then don't allow this to happen
if(p != null && p.hasPermission("jail.cantbejailed")) {
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.CANTBEJAILED));
return true;
}
//call the event
PrisonerJailedEvent event = new PrisonerJailedEvent(j, pris, p, p == null, sender.getName());
jm.getPlugin().getServer().getPluginManager().callEvent(event);

View File

@ -5,6 +5,8 @@ public enum LangString {
BROADCASTMESSAGEFOREVER,
/** The message sent when we broadcast/log the message for any time above -1. */
BROADCASTMESSAGEFORMINUTES,
/** The message sent when trying to jail someone who can't be jailed by permission. */
CANTBEJAILED,
/** The message sent when players are jailed without a reason. */
JAILED,
/** The message sent when players are jailed with a reason. */

View File

@ -3,4 +3,5 @@ language:
jailedwithreason: "&cYou have been jailed for: %0%"
unjailed: "&2You have been released! Please respect the server rules."
broadcastmessageforever: "&9%0% has been jailed forever."
broadcastmessageforminutes: "&9%0% has been jailed for %1% minutes."
broadcastmessageforminutes: "&9%0% has been jailed for %1% minutes."
cantbejailed: "&cThat player can't be jailed, due to permissions."