Added history size configuration option.

This commit is contained in:
sk89q 2011-02-18 21:57:43 -08:00
parent 5254986da2
commit 0f46fb957f
4 changed files with 10 additions and 1 deletions

View File

@ -50,6 +50,9 @@ scripting:
saving: saving:
dir: schematics dir: schematics
history:
size: 15
wand-item: 271 wand-item: 271
shell-save-type: shell-save-type:
no-double-slash: false no-double-slash: false

View File

@ -47,7 +47,7 @@ public class LocalSession {
THRU THRU
} }
public static final int MAX_HISTORY_SIZE = 15; public static int MAX_HISTORY_SIZE = 15;
private LocalConfiguration config; private LocalConfiguration config;

View File

@ -27,6 +27,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.util.config.Configuration; import org.bukkit.util.config.Configuration;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.LogFormat; import com.sk89q.worldedit.LogFormat;
import com.sk89q.worldedit.snapshots.SnapshotRepository; import com.sk89q.worldedit.snapshots.SnapshotRepository;
@ -76,6 +77,8 @@ public class BukkitConfiguration extends LocalConfiguration {
allowedDataCycleBlocks = new HashSet<Integer>(config.getIntList("limits.allowed-data-cycle-blocks", null)); allowedDataCycleBlocks = new HashSet<Integer>(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", ""); String snapshotsDir = config.getString("snapshots.directory", "");
if (!snapshotsDir.trim().equals("")) { if (!snapshotsDir.trim().equals("")) {
snapshotRepo = new SnapshotRepository(snapshotsDir); snapshotRepo = new SnapshotRepository(snapshotsDir);

View File

@ -25,6 +25,7 @@ import java.util.Properties;
import java.util.Set; import java.util.Set;
import com.sk89q.util.StringUtil; import com.sk89q.util.StringUtil;
import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalConfiguration;
import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.snapshots.SnapshotRepository; import com.sk89q.worldedit.snapshots.SnapshotRepository;
/** /**
@ -89,6 +90,8 @@ public class PropertiesConfiguration extends LocalConfiguration {
navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance); navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance);
scriptTimeout = getInt("scripting-timeout", scriptTimeout); scriptTimeout = getInt("scripting-timeout", scriptTimeout);
LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15));
String snapshotsDir = getString("snapshots-dir", ""); String snapshotsDir = getString("snapshots-dir", "");
if (!snapshotsDir.trim().equals("")) { if (!snapshotsDir.trim().equals("")) {
snapshotRepo = new SnapshotRepository(snapshotsDir); snapshotRepo = new SnapshotRepository(snapshotsDir);