mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Use right config value for butcher radius. Add max radius for butcher.
This commit is contained in:
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user