mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-27 13:15:33 +01:00
Add a new command to set avoiding water while pathfinding
This commit is contained in:
parent
4bbac37918
commit
2e56b1f5e8
@ -190,8 +190,8 @@ public class NPCCommands {
|
||||
paginator.addLine(line);
|
||||
} else {
|
||||
String[] parts = trait.getAnchors().get(i).getUnloadedValue();
|
||||
String line = "<a>" + i + "<b> " + trait.getAnchors().get(i).getName() + "<c> "
|
||||
+ parts[0] + "<d> " + parts[1] + ", " + parts[2] + ", " + parts[3] + " <f>(unloaded)";
|
||||
String line = "<a>" + i + "<b> " + trait.getAnchors().get(i).getName() + "<c> " + parts[0]
|
||||
+ "<d> " + parts[1] + ", " + parts[2] + ", " + parts[3] + " <f>(unloaded)";
|
||||
paginator.addLine(line);
|
||||
}
|
||||
}
|
||||
@ -779,6 +779,24 @@ public class NPCCommands {
|
||||
Messaging.sendTr(sender, serverOwner ? Messages.OWNER_SET_SERVER : Messages.OWNER_SET, npc.getName(), name);
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "pathopt --avoid-water|aw [true|false]",
|
||||
desc = "Sets an NPC's pathfinding options",
|
||||
modifiers = { "pathopt", "po", "patho" },
|
||||
min = 1,
|
||||
max = 1,
|
||||
permission = "citizens.npc.pathfindingoptions")
|
||||
public void pathfindingOptions(CommandContext args, CommandSender sender, NPC npc) {
|
||||
if (args.hasValueFlag("avoid-water") || args.hasValueFlag("aw")) {
|
||||
String raw = args.getFlag("avoid-water", args.getFlag("aw"));
|
||||
boolean avoid = Boolean.parseBoolean(raw);
|
||||
npc.getNavigator().getDefaultParameters().avoidWater(avoid);
|
||||
Messaging.sendTr(sender, avoid ? Messages.PATHFINDING_OPTIONS_AVOID_WATER_SET
|
||||
: Messages.PATHFINDING_OPTIONS_AVOID_WATER_UNSET, npc.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Command(aliases = { "npc" }, usage = "pathrange [range]", desc = "Sets an NPC's pathfinding range", modifiers = {
|
||||
"pathrange", "pathfindingrange", "prange" }, min = 2, max = 2, permission = "citizens.npc.pathfindingrange")
|
||||
public void pathfindingRange(CommandContext args, CommandSender sender, NPC npc) {
|
||||
|
@ -147,6 +147,8 @@ public class Messages {
|
||||
public static final String OVER_NPC_LIMIT = "citizens.limits.over-npc-limit";
|
||||
public static final String OWNER_SET = "citizens.commands.npc.owner.set";
|
||||
public static final String OWNER_SET_SERVER = "citizens.commands.npc.owner.set-server";
|
||||
public static final String PATHFINDING_OPTIONS_AVOID_WATER_SET = "citizens.commands.npc.pathopt.avoid-water-set";
|
||||
public static final String PATHFINDING_OPTIONS_AVOID_WATER_UNSET = "citizens.commands.npc.pathopt.avoid-water-unset";
|
||||
public static final String PATHFINDING_RANGE_SET = "citizens.commands.npc.pathfindingrange.set";
|
||||
public static final String PLAYER_NOT_FOUND_FOR_SPAWN = "citizens.commands.npc.create.no-player-for-spawn";
|
||||
public static final String POSE_ADDED = "citizens.commands.npc.pose.added";
|
||||
|
Loading…
Reference in New Issue
Block a user