3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-09 13:00:05 +01:00

Fixed commands.

Dieser Commit ist enthalten in:
sk89q 2011-01-29 09:31:48 -08:00
Ursprung f683959420
Commit 712274d372
7 geänderte Dateien mit 16 neuen und 16 gelöschten Zeilen

Datei anzeigen

@ -66,7 +66,7 @@ public class CommandContext {
public String[] getPaddedSlice(int index, int padding) { public String[] getPaddedSlice(int index, int padding) {
String[] slice = new String[args.length - index + padding]; String[] slice = new String[args.length - index + padding];
System.arraycopy(args, index, slice, padding, args.length - index + padding); System.arraycopy(args, index, slice, padding, args.length - index);
return slice; return slice;
} }

Datei anzeigen

@ -431,7 +431,7 @@ public class WorldEdit {
} else if (dirStr.charAt(0) == 'd') { } else if (dirStr.charAt(0) == 'd') {
return CuboidClipboard.FlipDirection.UP_DOWN; return CuboidClipboard.FlipDirection.UP_DOWN;
} else { } else {
throw new UnknownDirectionException(dirStr); throw new UnknownDirectionException(dir.name());
} }
} }

Datei anzeigen

@ -148,7 +148,7 @@ public class WorldEditPlugin extends JavaPlugin {
public boolean onCommand(Player player, Command cmd, String commandLabel, String[] args) { public boolean onCommand(Player player, Command cmd, String commandLabel, String[] args) {
if (cmd.getName().equalsIgnoreCase("reloadwe") if (cmd.getName().equalsIgnoreCase("reloadwe")
&& hasPermission(player, "reloadwe")) { && hasPermission(player, "worldedit.reload")) {
try { try {
loadConfiguration(); loadConfiguration();
player.sendMessage("WorldEdit configuration reloaded."); player.sendMessage("WorldEdit configuration reloaded.");

Datei anzeigen

@ -106,7 +106,7 @@ public class ClipboardCommands {
throws WorldEditException { throws WorldEditException {
boolean atOrigin = args.argsLength() > 0 boolean atOrigin = args.argsLength() > 0
? (args.getString(1).equalsIgnoreCase("true") ? (args.getString(0).equalsIgnoreCase("true")
|| args.getString(0).equalsIgnoreCase("yes")) || args.getString(0).equalsIgnoreCase("yes"))
: false; : false;

Datei anzeigen

@ -19,7 +19,6 @@
package com.sk89q.worldedit.commands; package com.sk89q.worldedit.commands;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.HashMap; import java.util.HashMap;
@ -108,7 +107,7 @@ public class CommandsManager {
*/ */
public boolean execute(CommandContext args, WorldEdit we, public boolean execute(CommandContext args, WorldEdit we,
LocalSession session, LocalPlayer player, EditSession editSession) LocalSession session, LocalPlayer player, EditSession editSession)
throws WorldEditException { throws WorldEditException, Throwable {
Method method = commands.get(args.getCommand().toLowerCase()); Method method = commands.get(args.getCommand().toLowerCase());
if (method == null) { if (method == null) {
@ -140,8 +139,10 @@ public class CommandsManager {
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
if (e.getCause() instanceof WorldEditException) { if (e.getCause() instanceof WorldEditException) {
throw (WorldEditException)e.getCause(); throw (WorldEditException)e.getCause();
} else if (e.getCause() instanceof NumberFormatException) {
throw (NumberFormatException)e.getCause();
} else { } else {
e.printStackTrace(); throw e.getCause();
} }
} }

Datei anzeigen

@ -69,8 +69,7 @@ public class ScriptingCommands {
return; return;
} }
String[] scriptArgs = args.getPaddedSlice(0, 1); String[] scriptArgs = args.getSlice(0);
scriptArgs[0] = lastScript;
we.runScript(player, lastScript, scriptArgs); we.runScript(player, lastScript, scriptArgs);

Datei anzeigen

@ -195,7 +195,7 @@ public class SelectionCommands {
@Command( @Command(
aliases = {"//expand"}, aliases = {"//expand"},
usage = "<amount> [[reverse-amount] <direction>]", usage = "<amount> [reverse-amount] <direction>",
desc = "Expand the selection area", desc = "Expand the selection area",
min = 1, min = 1,
max = 3 max = 3
@ -207,13 +207,10 @@ public class SelectionCommands {
Vector dir; Vector dir;
int change = args.getInteger(0);
int reverseChange = 0;
// Special syntax (//expand vert) to expand the selection between // Special syntax (//expand vert) to expand the selection between
// sky and bedrock. // sky and bedrock.
if (args.getString(0).equals("vert") if (args.getString(0).equalsIgnoreCase("vert")
|| args.getString(0).equals("vertical")) { || args.getString(0).equalsIgnoreCase("vertical")) {
Region region = session.getRegion(); Region region = session.getRegion();
int oldSize = region.getSize(); int oldSize = region.getSize();
region.expand(new Vector(0, 128, 0)); region.expand(new Vector(0, 128, 0));
@ -226,6 +223,9 @@ public class SelectionCommands {
return; return;
} }
int change = args.getInteger(0);
int reverseChange = 0;
// Specifying a direction // Specifying a direction
if (args.argsLength() == 2) { if (args.argsLength() == 2) {
try { try {
@ -369,7 +369,7 @@ public class SelectionCommands {
throws WorldEditException { throws WorldEditException {
Set<Integer> searchIDs = we.getBlockIDs(player, Set<Integer> searchIDs = we.getBlockIDs(player,
args.getString(1), true); args.getString(0), true);
player.print("Counted: " + player.print("Counted: " +
editSession.countBlocks(session.getRegion(), searchIDs)); editSession.countBlocks(session.getRegion(), searchIDs));
} }