3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 02:50:05 +01:00

Added default radius setting for butcher and added permissions for killing pets, npcs, and non hostile animals.

Dieser Commit ist enthalten in:
SpectralEdge 2012-03-02 22:19:30 -08:00 committet von SpectralEdge
Ursprung 8aabfb0c67
Commit 94619e3fe4
5 geänderte Dateien mit 30 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -101,6 +101,7 @@ public abstract class LocalConfiguration {
public String saveDir = "schematics";
public String scriptsDir = "craftscripts";
public boolean showFirstUseVersion = true;
public int butcherDefaultRadius = -1;
/**
* Loads the configuration.

Datei anzeigen

@ -349,7 +349,7 @@ public class UtilityCommands {
flags = "plan",
desc = "Kill all or nearby mobs",
help =
"Kills nearby mobs, or all mobs if you don't specify a radius.\n" +
"Kills nearby mobs, based on radius, if none is given uses default in configuration.\n" +
"Flags:" +
" -p also kills pets.\n" +
" -n also kills NPCs.\n" +
@ -364,12 +364,30 @@ public class UtilityCommands {
public void butcher(CommandContext args, LocalSession session, LocalPlayer player,
EditSession editSession) throws WorldEditException {
int radius = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : -1;
LocalConfiguration config = we.getConfiguration();
final int radius;
if(args.argsLength() > 0){
radius = Math.max(1, args.getInteger(0));
}
else{
radius = config.butcherDefaultRadius;
}
int flags = 0;
if (args.hasFlag('p')) flags |= KillFlags.PETS;
if (args.hasFlag('n')) flags |= KillFlags.NPCS;
if (args.hasFlag('a')) flags |= KillFlags.ANIMALS;
if (player.hasPermission("worldedit.butcher.pets") && (args.hasFlag('p'))) {
flags |= KillFlags.PETS;
}
if (player.hasPermission("worldedit.butcher.npcs") && (args.hasFlag('n'))) {
flags |= KillFlags.NPCS;
}
if (player.hasPermission("worldedit.butcher.animals") && (args.hasFlag('a'))) {
flags |= KillFlags.ANIMALS;
}
if (args.hasFlag('l') && player.hasPermission("worldedit.butcher.lightning")) flags |= KillFlags.WITH_LIGHTNING;
int killed;

Datei anzeigen

@ -95,6 +95,7 @@ public class PropertiesConfiguration extends LocalConfiguration {
navigationWand = getInt("nav-wand-item", navigationWand);
navigationWandMaxDistance = getInt("nav-wand-distance", navigationWandMaxDistance);
scriptTimeout = getInt("scripting-timeout", scriptTimeout);
butcherDefaultRadius = getInt("butcher-default-radius", butcherDefaultRadius);
LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15));

Datei anzeigen

@ -83,6 +83,7 @@ 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);

Datei anzeigen

@ -54,6 +54,9 @@ history:
size: 15
expiration: 10
butcher:
butcher-default-radius: -1
wand-item: 271
shell-save-type:
no-double-slash: false