3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00

Added /s to repeat last script.

Dieser Commit ist enthalten in:
sk89q 2011-01-23 02:09:51 -08:00
Ursprung af1acd42b8
Commit 56d69f9e77
3 geänderte Dateien mit 40 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -250,6 +250,9 @@ commands:
cs:
description: Execute a CraftScript
usage: /<command> <filename> [arg1 [args2 [arg3 [...]]]]
s:
description: Re-execute last CraftScript
usage: /<command> [arg1 [args2 [arg3 [...]]]]
reloadwe:
description: Reload WorldEdit's configuration

Datei anzeigen

@ -48,6 +48,7 @@ public class LocalSession {
private int maxBlocksChanged = -1;
private boolean useInventory;
private Snapshot snapshot;
private String lastScript;
/**
* Clear history.
@ -412,4 +413,18 @@ public class LocalSession {
public void setUseInventory(boolean useInventory) {
this.useInventory = useInventory;
}
/**
* @return the lastScript
*/
public String getLastScript() {
return lastScript;
}
/**
* @param lastScript the lastScript to set
*/
public void setLastScript(String lastScript) {
this.lastScript = lastScript;
}
}

Datei anzeigen

@ -178,6 +178,7 @@ public class WorldEditController {
commands.put("/rbrush", "[ID] <Radius> - Switch to the replacing sphere brush tool");
commands.put("/cs", "[Filename] <args...> - Execute a CraftScript");
commands.put("/s", "<args...> - Re-execute last CraftScript");
}
/**
@ -1714,8 +1715,29 @@ public class WorldEditController {
String[] args = new String[split.length - 1];
System.arraycopy(split, 1, args, 0, split.length - 1);
session.setLastScript(split[1]);
runScript(player, split[1], args);
return true;
// CraftScript
} else if (split[0].equalsIgnoreCase("/s")) {
checkArgs(split, 1, -1, split[0]);
String lastScript = session.getLastScript();
if (lastScript == null) {
player.printError("Use /cs with a script name first.");
return true;
}
String[] args = new String[split.length];
System.arraycopy(split, 0, args, 0, split.length);
args[0] = lastScript;
runScript(player, lastScript, args);
return true;
}