Move mute, reload, and version to the subcommand of /jail
This commit is contained in:
@ -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;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
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 = 0,
|
||||
minimumArgs = 0,
|
||||
needsPlayer = false,
|
||||
pattern = "reload|r",
|
||||
permission = "jail.command.jailreload",
|
||||
usage = "/jail reload"
|
||||
)
|
||||
public class JailReloadCommand implements Command {
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
jm.getPlugin().reloadConfig();
|
||||
jm.getPlugin().getJailIO().loadLanguage();
|
||||
jm.getPlugin().getJailIO().loadJails();
|
||||
|
||||
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.PLUGINRELOADED));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
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;
|
||||
|
||||
@CommandInfo(
|
||||
maxArgs = 0,
|
||||
minimumArgs = 0,
|
||||
needsPlayer = false,
|
||||
pattern = "version|v",
|
||||
permission = "jail.command.jailversion",
|
||||
usage = "/jail version"
|
||||
)
|
||||
public class JailVersionCommand implements Command{
|
||||
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
// Sends the version number to the sender
|
||||
sender.sendMessage("Jail Version: " + jm.getPlugin().getDescription().getVersion());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user