mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 17:57:38 +00:00
Added an optional on/off argument to the toggle pickaxe command.
This commit is contained in:
parent
cc917b424c
commit
e320d34b32
@ -35,21 +35,35 @@ import com.sk89q.worldedit.patterns.Pattern;
|
||||
public class ToolUtilCommands {
|
||||
@Command(
|
||||
aliases = {"/", ","},
|
||||
usage = "",
|
||||
usage = "[on|off]",
|
||||
desc = "Toggle the super pickaxe pickaxe function",
|
||||
min = 0,
|
||||
max = 0
|
||||
max = 1
|
||||
)
|
||||
@CommandPermissions({"worldedit.superpickaxe"})
|
||||
public static void togglePickaxe(CommandContext args, WorldEdit we,
|
||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||
throws WorldEditException {
|
||||
|
||||
if (session.toggleSuperPickAxe()) {
|
||||
player.print("Super pick axe enabled.");
|
||||
} else {
|
||||
String newState = args.getString(0, null);
|
||||
if (session.hasSuperPickAxe()) {
|
||||
if ("on".equals(newState)) {
|
||||
player.printError("Super pick axe already enabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
session.disableSuperPickAxe();
|
||||
player.print("Super pick axe disabled.");
|
||||
}
|
||||
else {
|
||||
if ("off".equals(newState)) {
|
||||
player.printError("Super pick axe already disabled.");
|
||||
return;
|
||||
}
|
||||
session.enableSuperPickAxe();
|
||||
player.print("Super pick axe enabled.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
Loading…
Reference in New Issue
Block a user