From c70a7914da5fc0867d0f7ea7dc3aed36e1d424fe Mon Sep 17 00:00:00 2001 From: sk89q Date: Sat, 2 Oct 2010 16:13:52 -0700 Subject: [PATCH] Added /clearhistory and /clearclipboard. --- src/WorldEdit.java | 13 +++++++++++++ src/WorldEditSession.java | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/src/WorldEdit.java b/src/WorldEdit.java index 851bb16c3..7e25e2527 100644 --- a/src/WorldEdit.java +++ b/src/WorldEdit.java @@ -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", " - Set all blocks inside region"); commands.put("/editreplace", " - 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")) { diff --git a/src/WorldEditSession.java b/src/WorldEditSession.java index 0da7538a3..ad65fbcbf 100644 --- a/src/WorldEditSession.java +++ b/src/WorldEditSession.java @@ -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. *