3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-08 04:20:06 +01:00

Added an optional on/off argument to the toggle pickaxe command.

Dieser Commit ist enthalten in:
TomyLobo 2011-08-09 00:17:55 +02:00
Ursprung cc917b424c
Commit e320d34b32

Datei anzeigen

@ -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(