Added /clearhistory and /clearclipboard.

This commit is contained in:
sk89q 2010-10-02 16:13:52 -07:00
parent 4c7e14a76b
commit c70a7914da
2 changed files with 21 additions and 0 deletions

View File

@ -41,6 +41,7 @@ public class WorldEdit extends Plugin {
commands.put("/editpos2", "Set editing position #2");
commands.put("/editundo", "Undo");
commands.put("/editredo", "Redo");
commands.put("/clearhistory", "Clear history");
commands.put("/editsize", "Get size of selected region");
commands.put("/editset", "<Type> - Set all blocks inside region");
commands.put("/editreplace", "<ID> - Replace all existing blocks inside region");
@ -230,6 +231,18 @@ public class WorldEdit extends Plugin {
}
return true;
// Clear undo history
} else if (split[0].equalsIgnoreCase("/clearhistory")) {
session.clearHistory();
player.sendMessage(Colors.LightPurple + "History cleared.");;
return true;
// Clear clipboard
} else if (split[0].equalsIgnoreCase("/clearclipboard")) {
session.setClipboard(null);
player.sendMessage(Colors.LightPurple + "Clipboard cleared.");;
return true;
// Paste
} else if (split[0].equalsIgnoreCase("/editpasteair") ||
split[0].equalsIgnoreCase("/editpaste")) {

View File

@ -34,6 +34,14 @@ public class WorldEditSession {
private int historyPointer = 0;
private RegionClipboard clipboard;
/**
* Clear history.
*/
public void clearHistory() {
history.clear();
historyPointer = 0;
}
/**
* Get the edit session.
*