geforkt von Mirrors/FastAsyncWorldEdit
Use right config value for butcher radius. Add max radius for butcher.
Dieser Commit ist enthalten in:
Ursprung
aadfc30fbb
Commit
56d534bf0d
@ -19,13 +19,14 @@
|
||||
|
||||
package com.sk89q.worldedit;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.ItemID;
|
||||
import com.sk89q.worldedit.snapshots.SnapshotRepository;
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
import com.sk89q.worldedit.blocks.ItemID;
|
||||
import com.sk89q.worldedit.snapshots.SnapshotRepository;
|
||||
|
||||
/**
|
||||
* Represents WorldEdit's configuration.
|
||||
*
|
||||
@ -104,6 +105,7 @@ public abstract class LocalConfiguration {
|
||||
public String scriptsDir = "craftscripts";
|
||||
public boolean showFirstUseVersion = true;
|
||||
public int butcherDefaultRadius = -1;
|
||||
public int butcherMaxRadius = -1;
|
||||
|
||||
/**
|
||||
* Loads the configuration.
|
||||
|
@ -378,13 +378,18 @@ public class UtilityCommands {
|
||||
|
||||
LocalConfiguration config = we.getConfiguration();
|
||||
|
||||
// technically the default can be larger than the max, but that's not my problem
|
||||
int radius = config.butcherDefaultRadius;
|
||||
|
||||
if (args.argsLength() > 0) {
|
||||
if (args.getString(0).equals("all")) {
|
||||
radius = -1;
|
||||
} else {
|
||||
radius = Math.max(1, args.getInteger(0));
|
||||
// there might be a better way to do this but my brain is fried right now
|
||||
if (args.argsLength() > 0) { // user inputted radius, override the default
|
||||
radius = args.getInteger(0);
|
||||
if (config.butcherMaxRadius != -1) { // clamp if there is a max
|
||||
if (radius == -1) {
|
||||
radius = config.butcherMaxRadius;
|
||||
} else { // Math.min does not work if radius is -1 (actually highest possible value)
|
||||
radius = Math.min(radius, config.butcherMaxRadius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,12 +19,6 @@
|
||||
|
||||
package com.sk89q.worldedit.util;
|
||||
|
||||
import com.sk89q.util.yaml.YAMLProcessor;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.LogFormat;
|
||||
import com.sk89q.worldedit.snapshots.SnapshotRepository;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
@ -33,6 +27,12 @@ import java.util.logging.Handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sk89q.util.yaml.YAMLProcessor;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.LogFormat;
|
||||
import com.sk89q.worldedit.snapshots.SnapshotRepository;
|
||||
|
||||
/**
|
||||
* A less simple implementation of {@link LocalConfiguration} using YAML configuration files.
|
||||
*
|
||||
@ -71,6 +71,8 @@ public class YAMLConfiguration extends LocalConfiguration {
|
||||
maxRadius = Math.max(-1, config.getInt("limits.max-radius", maxRadius));
|
||||
maxSuperPickaxeSize = Math.max(1, config.getInt(
|
||||
"limits.max-super-pickaxe-size", maxSuperPickaxeSize));
|
||||
butcherDefaultRadius = Math.max(-1, config.getInt("limits.butcher-radius.default", butcherDefaultRadius));
|
||||
butcherMaxRadius = Math.max(-1, config.getInt("limits.butcher-radius.maximum", butcherMaxRadius));
|
||||
registerHelp = true;
|
||||
logCommands = config.getBoolean("logging.log-commands", logCommands);
|
||||
superPickaxeDrop = config.getBoolean("super-pickaxe.drop-items",
|
||||
@ -88,7 +90,6 @@ public class YAMLConfiguration extends LocalConfiguration {
|
||||
|
||||
scriptTimeout = config.getInt("scripting.timeout", scriptTimeout);
|
||||
scriptsDir = config.getString("scripting.dir", scriptsDir);
|
||||
butcherDefaultRadius = config.getInt("butcher-default-radius", butcherDefaultRadius);
|
||||
|
||||
saveDir = config.getString("saving.dir", saveDir);
|
||||
|
||||
|
@ -25,6 +25,9 @@ limits:
|
||||
max-radius: -1
|
||||
max-super-pickaxe-size: 5
|
||||
max-brush-radius: 5
|
||||
butcher-radius:
|
||||
default: -1
|
||||
maximum: -1
|
||||
disallowed-blocks: [6, 7, 14, 15, 16, 26, 27, 28, 29, 39, 31, 32, 33, 34, 36, 37, 38, 39, 40, 46, 50, 51, 56, 59, 69, 73, 74, 75, 76, 77, 81, 83]
|
||||
|
||||
use-inventory:
|
||||
@ -56,10 +59,7 @@ saving:
|
||||
history:
|
||||
size: 15
|
||||
expiration: 10
|
||||
|
||||
butcher:
|
||||
butcher-default-radius: -1
|
||||
|
||||
|
||||
wand-item: 271
|
||||
shell-save-type:
|
||||
no-double-slash: false
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren