mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-24 10:17:39 +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 {
|
public class ToolUtilCommands {
|
||||||
@Command(
|
@Command(
|
||||||
aliases = {"/", ","},
|
aliases = {"/", ","},
|
||||||
usage = "",
|
usage = "[on|off]",
|
||||||
desc = "Toggle the super pickaxe pickaxe function",
|
desc = "Toggle the super pickaxe pickaxe function",
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 0
|
max = 1
|
||||||
)
|
)
|
||||||
@CommandPermissions({"worldedit.superpickaxe"})
|
@CommandPermissions({"worldedit.superpickaxe"})
|
||||||
public static void togglePickaxe(CommandContext args, WorldEdit we,
|
public static void togglePickaxe(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
|
||||||
if (session.toggleSuperPickAxe()) {
|
String newState = args.getString(0, null);
|
||||||
player.print("Super pick axe enabled.");
|
if (session.hasSuperPickAxe()) {
|
||||||
} else {
|
if ("on".equals(newState)) {
|
||||||
|
player.printError("Super pick axe already enabled.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
session.disableSuperPickAxe();
|
||||||
player.print("Super pick axe disabled.");
|
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(
|
@Command(
|
||||||
|
Loading…
Reference in New Issue
Block a user