Move mute, reload, and version to the subcommand of /jail

This commit is contained in:
graywolf336
2014-01-29 13:46:26 -06:00
parent 2bea10259c
commit edb563a9ec
9 changed files with 63 additions and 19 deletions

View File

@ -0,0 +1,38 @@
package com.graywolf336.jail.command.subcommands;
import org.bukkit.command.CommandSender;
import com.graywolf336.jail.JailManager;
import com.graywolf336.jail.command.Command;
import com.graywolf336.jail.command.CommandInfo;
import com.graywolf336.jail.enums.LangString;
@CommandInfo(
maxArgs = 1,
minimumArgs = 1,
needsPlayer = false,
pattern = "mute|m",
permission = "jail.command.jailmute",
usage = "/jail mute <player>"
)
public class JailMuteCommand implements Command {
public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception {
//Let's check if the player they're sending us is jailed
if(jm.isPlayerJailed(args[0])) {
//They are, so let's toggle whether they are muted or not
boolean muted = !jm.getPrisoner(args[0]).isMuted();
jm.getPrisoner(args[0]).setMuted(muted);
//Send the message to the sender based upon whether they are muted or unmuted
if(muted)
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOWMUTED, args[0]));
else
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOWUNMUTED, args[0]));
}else {
//The player provided is not jailed, so let's tell the sender that
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.NOTJAILED, args[0]));
}
return true;
}
}