From 14bcf2fa068905c54c00a6c1e748b40df2a94830 Mon Sep 17 00:00:00 2001 From: sk89q Date: Wed, 26 Jan 2011 12:38:51 -0800 Subject: [PATCH] Now you can use /script.js directly as a command. --- src/com/sk89q/worldedit/WorldEdit.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/com/sk89q/worldedit/WorldEdit.java b/src/com/sk89q/worldedit/WorldEdit.java index 725e5b177..453964e1a 100644 --- a/src/com/sk89q/worldedit/WorldEdit.java +++ b/src/com/sk89q/worldedit/WorldEdit.java @@ -2119,10 +2119,16 @@ public class WorldEdit { // Legacy /, command if (split[0].equals("/,")) { split[0] = "//"; - } + // Quick script shortcut + } else if (split[0].matches("^.+\\.js$")) { + String[] newSplit = new String[split.length + 1]; + System.arraycopy(split, 0, newSplit, 1, split.length); + newSplit[0] = "/cs"; + split = newSplit; + } + String searchCmd = split[0].toLowerCase(); - if (commands.containsKey(searchCmd) || (config.noDoubleSlash && commands.containsKey("/" + searchCmd)) || ((searchCmd.length() < 3 || searchCmd.charAt(2) != '/')