Move clearforce into clear and use -f (-force) to forcefully do it.
It does still require the permission `jail.command.jailclearforce` and if it isn't provided then it will fall back to regular clearing.
This commit is contained in:
parent
1ea60ca106
commit
cac81f0420
@ -14,6 +14,7 @@ Beta 3 Changes
|
||||
* Lots of work on unit testing
|
||||
* Changed the encoding of the project in maven to utf8
|
||||
* Fixed the language system not copying over new values
|
||||
* Fixed confirmations not expiring, ever
|
||||
|
||||
Beta 2 Changes
|
||||
===
|
||||
|
@ -13,7 +13,6 @@ import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.command.subcommands.JailCreateCellCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailCheckCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailClearCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailClearForceCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailConfirmCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailCreateCommand;
|
||||
@ -177,7 +176,6 @@ public class JailHandler {
|
||||
load(JailCreateCellCommand.class);
|
||||
load(JailCheckCommand.class);
|
||||
load(JailClearCommand.class);
|
||||
load(JailClearForceCommand.class);
|
||||
load(JailCommand.class);
|
||||
load(JailConfirmCommand.class);
|
||||
load(JailCreateCommand.class);
|
||||
|
@ -13,16 +13,24 @@ import com.graywolf336.jail.enums.Lang;
|
||||
maxArgs = 1,
|
||||
minimumArgs = 0,
|
||||
needsPlayer = false,
|
||||
pattern = "clear",
|
||||
pattern = "clear|clearforce",
|
||||
permission = "jail.command.jailclear",
|
||||
usage = "/jail clear (Jail name)"
|
||||
usage = "/jail clear (-f) (jail)"
|
||||
)
|
||||
public class JailClearCommand implements Command {
|
||||
|
||||
// If Jail is specified unjails all the prisoners from that Jail (new feature) otherwise it unjails all the prisoners from all the jails
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
boolean force = false;
|
||||
|
||||
//Check if we need to forcefully clear something
|
||||
for(String s : args)
|
||||
if(s.equalsIgnoreCase("-f") || s.equalsIgnoreCase("-force"))
|
||||
force = true;
|
||||
|
||||
if(jm.isConfirming(sender.getName())) {
|
||||
sender.sendMessage(Lang.ALREADY.get());
|
||||
}else if(force && sender.hasPermission("jail.command.jailclearforce")) {
|
||||
jm.addConfirming(sender.getName(), new ConfirmPlayer(sender.getName(), args, Confirmation.CLEARFORCE));
|
||||
sender.sendMessage(Lang.START.get());
|
||||
}else {
|
||||
jm.addConfirming(sender.getName(), new ConfirmPlayer(sender.getName(), args, Confirmation.CLEAR));
|
||||
sender.sendMessage(Lang.START.get());
|
||||
|
@ -1,34 +0,0 @@
|
||||
package com.graywolf336.jail.command.subcommands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.beans.ConfirmPlayer;
|
||||
import com.graywolf336.jail.command.Command;
|
||||
import com.graywolf336.jail.command.CommandInfo;
|
||||
import com.graywolf336.jail.enums.Confirmation;
|
||||
import com.graywolf336.jail.enums.Lang;
|
||||
|
||||
@CommandInfo(
|
||||
maxArgs = 1,
|
||||
minimumArgs = 0,
|
||||
needsPlayer = false,
|
||||
pattern = "clearforce|cf",
|
||||
permission = "jail.command.jailclearforce",
|
||||
usage = "/jail clearforce (Jail name)"
|
||||
)
|
||||
public class JailClearForceCommand implements Command {
|
||||
|
||||
// If Jail is specified clear all prisoners from that Jail (new feature) else, clear all players from all jails
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
if(jm.isConfirming(sender.getName())) {
|
||||
sender.sendMessage(Lang.ALREADY.get());
|
||||
}else {
|
||||
jm.addConfirming(sender.getName(), new ConfirmPlayer(sender.getName(), args, Confirmation.CLEARFORCE));
|
||||
sender.sendMessage(Lang.START.get());
|
||||
}
|
||||
|
||||
return true; //If they made it this far, the command is intact and ready to be processed. :)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user