mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-03 03:46:42 +00:00
Added default radius setting for butcher and added permissions for killing pets, npcs, and non hostile animals.
This commit is contained in:
committed by
SpectralEdge
parent
8aabfb0c67
commit
94619e3fe4
@ -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;
|
||||
|
Reference in New Issue
Block a user