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. */
|
/** Sets whether the plugin is in debugging or not. */
|
||||||
public void setDebugging(boolean debug) {
|
public boolean setDebugging(boolean debug) {
|
||||||
this.debug = 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. */
|
/** 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.JailMain;
|
||||||
import com.graywolf336.jail.JailManager;
|
import com.graywolf336.jail.JailManager;
|
||||||
import com.graywolf336.jail.command.commands.HandCuffCommand;
|
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.UnHandCuffCommand;
|
||||||
import com.graywolf336.jail.command.commands.UnJailForceCommand;
|
import com.graywolf336.jail.command.commands.UnJailForceCommand;
|
||||||
import com.graywolf336.jail.command.commands.UnJailCommand;
|
import com.graywolf336.jail.command.commands.UnJailCommand;
|
||||||
@ -140,6 +141,7 @@ public class CommandHandler {
|
|||||||
/** Loads all the commands into the hashmap. */
|
/** Loads all the commands into the hashmap. */
|
||||||
private void loadCommands() {
|
private void loadCommands() {
|
||||||
load(HandCuffCommand.class);
|
load(HandCuffCommand.class);
|
||||||
|
load(ToggleJailDebugCommand.class);
|
||||||
load(UnHandCuffCommand.class);
|
load(UnHandCuffCommand.class);
|
||||||
load(UnJailCommand.class);
|
load(UnJailCommand.class);
|
||||||
load(UnJailForceCommand.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
|
description: Allows the player to handcuff another player
|
||||||
unhandcuff:
|
unhandcuff:
|
||||||
description: Allows the player to unhandcuff someone
|
description: Allows the player to unhandcuff someone
|
||||||
|
togglejaildebug:
|
||||||
|
description: Toggles whether the plugin is in debugging state or not.
|
||||||
permissions:
|
permissions:
|
||||||
jail.*:
|
jail.*:
|
||||||
children:
|
children:
|
||||||
@ -108,6 +110,7 @@ permissions:
|
|||||||
jail.command.jailreload: true
|
jail.command.jailreload: true
|
||||||
jail.command.jailrecord: true
|
jail.command.jailrecord: true
|
||||||
jail.command.handcuff: true
|
jail.command.handcuff: true
|
||||||
|
jail.command.toggledebug: true
|
||||||
jail.usercmd.*:
|
jail.usercmd.*:
|
||||||
description: access to all user commands
|
description: access to all user commands
|
||||||
children:
|
children:
|
||||||
@ -192,3 +195,5 @@ permissions:
|
|||||||
default: op
|
default: op
|
||||||
jail.cantbejailed:
|
jail.cantbejailed:
|
||||||
default: op
|
default: op
|
||||||
|
jail.command.toggledebug:
|
||||||
|
default: op
|
Loading…
Reference in New Issue
Block a user