Add a command to toggle whether jail is in debugging or not.
This commit is contained in:
parent
43feed4469
commit
0ae2956137
@ -233,8 +233,14 @@ public class JailMain extends JavaPlugin {
|
||||
}
|
||||
|
||||
/** Sets whether the plugin is in debugging or not. */
|
||||
public void setDebugging(boolean debug) {
|
||||
public boolean setDebugging(boolean debug) {
|
||||
this.debug = debug;
|
||||
|
||||
//Save whether we are debugging when we disable the plugin
|
||||
getConfig().set(Settings.DEBUG.getPath(), this.debug);
|
||||
saveConfig();
|
||||
|
||||
return this.debug;
|
||||
}
|
||||
|
||||
/** Returns if the plugin is in debug state or not. */
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
|
||||
import com.graywolf336.jail.JailMain;
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.command.commands.HandCuffCommand;
|
||||
import com.graywolf336.jail.command.commands.ToggleJailDebugCommand;
|
||||
import com.graywolf336.jail.command.commands.UnHandCuffCommand;
|
||||
import com.graywolf336.jail.command.commands.UnJailForceCommand;
|
||||
import com.graywolf336.jail.command.commands.UnJailCommand;
|
||||
@ -140,6 +141,7 @@ public class CommandHandler {
|
||||
/** Loads all the commands into the hashmap. */
|
||||
private void loadCommands() {
|
||||
load(HandCuffCommand.class);
|
||||
load(ToggleJailDebugCommand.class);
|
||||
load(UnHandCuffCommand.class);
|
||||
load(UnJailCommand.class);
|
||||
load(UnJailForceCommand.class);
|
||||
|
@ -0,0 +1,24 @@
|
||||
package com.graywolf336.jail.command.commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
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 = "togglejaildebug|tjd",
|
||||
permission = "jail.command.toggledebug",
|
||||
usage = "/togglejaildebug"
|
||||
)
|
||||
public class ToggleJailDebugCommand implements Command {
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
boolean debug = jm.getPlugin().setDebugging(!jm.getPlugin().inDebug());
|
||||
sender.sendMessage("Jail debugging is now: " + (debug ? ChatColor.GREEN + "enabled" : ChatColor.RED + "disabled"));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -70,6 +70,8 @@ commands:
|
||||
description: Allows the player to handcuff another player
|
||||
unhandcuff:
|
||||
description: Allows the player to unhandcuff someone
|
||||
togglejaildebug:
|
||||
description: Toggles whether the plugin is in debugging state or not.
|
||||
permissions:
|
||||
jail.*:
|
||||
children:
|
||||
@ -108,6 +110,7 @@ permissions:
|
||||
jail.command.jailreload: true
|
||||
jail.command.jailrecord: true
|
||||
jail.command.handcuff: true
|
||||
jail.command.toggledebug: true
|
||||
jail.usercmd.*:
|
||||
description: access to all user commands
|
||||
children:
|
||||
@ -192,3 +195,5 @@ permissions:
|
||||
default: op
|
||||
jail.cantbejailed:
|
||||
default: op
|
||||
jail.command.toggledebug:
|
||||
default: op
|
Loading…
Reference in New Issue
Block a user