Merge commit '142f5c8e5c889ee5098c05ba2fde20b52467c1df' into feature/platform-caps

This commit is contained in:
sk89q
2014-06-27 16:03:29 -07:00
69 changed files with 5209 additions and 359 deletions

View File

@ -260,13 +260,6 @@ public class ClipboardCommands {
player.printError("This command is no longer used. See //schematic save.");
}
@Command(
aliases = { "/schematic", "/schem"},
desc = "Schematic-related commands"
)
@NestedCommand(SchematicCommands.class)
public void schematic() {}
@Command(
aliases = { "clearclipboard" },
usage = "",

View File

@ -23,13 +23,7 @@ import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.Console;
import com.sk89q.minecraft.util.commands.NestedCommand;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalPlayer;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.blocks.ItemType;
import com.sk89q.worldedit.masks.Mask;
@ -226,13 +220,4 @@ public class GeneralCommands {
}
}
@Command(
aliases = { "we", "worldedit" },
desc = "WorldEdit commands"
)
@NestedCommand(WorldEditCommands.class)
@Console
public void we(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException {
}
}

View File

@ -54,15 +54,6 @@ public class SnapshotUtilCommands {
this.we = we;
}
@Command(
aliases = { "snapshot", "snap" },
desc = "Snapshot commands"
)
@NestedCommand(SnapshotCommands.class)
public void snapshot(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException {
}
@Command(
aliases = { "restore", "/restore" },
usage = "[snapshot]",

View File

@ -151,15 +151,6 @@ public class ToolCommands {
+ ItemType.toHeldName(player.getItemInHand()) + ".");
}
@Command(
aliases = { "brush", "br" },
desc = "Brush tool"
)
@NestedCommand(BrushCommands.class)
public void brush(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException {
}
@Command(
aliases = { "deltree" },
usage = "",

View File

@ -22,7 +22,6 @@ package com.sk89q.worldedit.command;
import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandPermissions;
import com.sk89q.minecraft.util.commands.NestedCommand;
import com.sk89q.worldedit.*;
import com.sk89q.worldedit.masks.Mask;
import com.sk89q.worldedit.patterns.Pattern;
@ -70,24 +69,6 @@ public class ToolUtilCommands {
}
@Command(
aliases = { "superpickaxe", "pickaxe", "sp" },
desc = "Select super pickaxe mode"
)
@NestedCommand(SuperPickaxeCommands.class)
public void pickaxe(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException {
}
@Command(
aliases = {"tool"},
desc = "Select a tool to bind"
)
@NestedCommand(ToolCommands.class)
public void tool(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException {
}
@Command(
aliases = { "mask" },
usage = "[mask]",

View File

@ -27,6 +27,9 @@ import com.sk89q.worldedit.patterns.Pattern;
import com.sk89q.worldedit.patterns.SingleBlockPattern;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.command.CommandMapping;
import com.sk89q.worldedit.util.command.Description;
import com.sk89q.worldedit.util.command.Dispatcher;
import com.sk89q.worldedit.world.World;
import java.util.Comparator;
@ -512,7 +515,7 @@ public class UtilityCommands {
}
public static void help(CommandContext args, WorldEdit we, LocalSession session, LocalPlayer player, EditSession editSession) {
final CommandsManager<LocalPlayer> commandsManager = we.getCommandsManager();
final Dispatcher dispatcher = we.getPlatformManager().getCommandManager().getDispatcher();
if (args.argsLength() == 0) {
SortedSet<String> commands = new TreeSet<String>(new Comparator<String>() {
@ -525,7 +528,7 @@ public class UtilityCommands {
return ret;
}
});
commands.addAll(commandsManager.getCommands().keySet());
commands.addAll(dispatcher.getPrimaryAliases());
StringBuilder sb = new StringBuilder();
boolean first = true;
@ -544,14 +547,26 @@ public class UtilityCommands {
return;
}
String command = args.getJoinedStrings(0).toLowerCase().replaceAll("/", "");
String command = args.getJoinedStrings(0).toLowerCase().replaceAll("^/", "");
CommandMapping mapping = dispatcher.get(command);
String helpMessage = commandsManager.getHelpMessages().get(command);
if (helpMessage == null) {
if (mapping == null) {
player.printError("Unknown command '" + command + "'.");
return;
}
player.print(helpMessage);
Description description = mapping.getDescription();
if (description.getUsage() != null) {
player.printDebug("Usage: " + description.getUsage());
}
if (description.getHelp() != null) {
player.print(description.getHelp());
} else if (description.getDescription() != null) {
player.print(description.getDescription());
} else {
player.print("No further help is available.");
}
}
}