From 0f46fb957fe49c0b3839baa5b368ff6409b41f36 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 18 Feb 2011 21:57:43 -0800 Subject: [PATCH] Added history size configuration option. --- config.yml | 3 +++ src/com/sk89q/worldedit/LocalSession.java | 2 +- src/com/sk89q/worldedit/bukkit/BukkitConfiguration.java | 3 +++ src/com/sk89q/worldedit/util/PropertiesConfiguration.java | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config.yml b/config.yml index 275ee6158..9efa6fc03 100644 --- a/config.yml +++ b/config.yml @@ -50,6 +50,9 @@ scripting: saving: dir: schematics +history: + size: 15 + wand-item: 271 shell-save-type: no-double-slash: false diff --git a/src/com/sk89q/worldedit/LocalSession.java b/src/com/sk89q/worldedit/LocalSession.java index bd9d7eaf0..0cf1140fd 100644 --- a/src/com/sk89q/worldedit/LocalSession.java +++ b/src/com/sk89q/worldedit/LocalSession.java @@ -47,7 +47,7 @@ public class LocalSession { THRU } - public static final int MAX_HISTORY_SIZE = 15; + public static int MAX_HISTORY_SIZE = 15; private LocalConfiguration config; diff --git a/src/com/sk89q/worldedit/bukkit/BukkitConfiguration.java b/src/com/sk89q/worldedit/bukkit/BukkitConfiguration.java index 896b4bff8..09d666641 100644 --- a/src/com/sk89q/worldedit/bukkit/BukkitConfiguration.java +++ b/src/com/sk89q/worldedit/bukkit/BukkitConfiguration.java @@ -27,6 +27,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.util.config.Configuration; import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LogFormat; import com.sk89q.worldedit.snapshots.SnapshotRepository; @@ -76,6 +77,8 @@ public class BukkitConfiguration extends LocalConfiguration { allowedDataCycleBlocks = new HashSet(config.getIntList("limits.allowed-data-cycle-blocks", null)); + LocalSession.MAX_HISTORY_SIZE = Math.max(15, config.getInt("history.size", 15)); + String snapshotsDir = config.getString("snapshots.directory", ""); if (!snapshotsDir.trim().equals("")) { snapshotRepo = new SnapshotRepository(snapshotsDir); diff --git a/src/com/sk89q/worldedit/util/PropertiesConfiguration.java b/src/com/sk89q/worldedit/util/PropertiesConfiguration.java index 17c73e311..dc52eb82b 100644 --- a/src/com/sk89q/worldedit/util/PropertiesConfiguration.java +++ b/src/com/sk89q/worldedit/util/PropertiesConfiguration.java @@ -25,6 +25,7 @@ import java.util.Properties; import java.util.Set; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.LocalConfiguration; +import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.snapshots.SnapshotRepository; /** @@ -89,6 +90,8 @@ public class PropertiesConfiguration extends LocalConfiguration { navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance); scriptTimeout = getInt("scripting-timeout", scriptTimeout); + LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15)); + String snapshotsDir = getString("snapshots-dir", ""); if (!snapshotsDir.trim().equals("")) { snapshotRepo = new SnapshotRepository(snapshotsDir);