Add some debug for navigation, add --at arg for /npc playsound

This commit is contained in:
fullwall 2023-10-03 23:06:25 +08:00
parent d3426bc10a
commit 9bb88a6db1
5 changed files with 15 additions and 8 deletions

View File

@ -2272,7 +2272,7 @@ public class NPCCommands {
@Command(
aliases = { "npc" },
usage = "playsound [sound] (volume) (pitch)",
usage = "playsound [sound] (volume) (pitch) (--at x:y:z:world)",
desc = "Plays a sound at the NPC's location",
modifiers = { "playsound" },
min = 2,
@ -2280,9 +2280,10 @@ public class NPCCommands {
permission = "citizens.npc.playsound")
@Requirements(selected = true, ownership = true)
public void playsound(CommandContext args, CommandSender sender, NPC npc, @Arg(1) String sound,
@Arg(value = 2, defValue = "1") Float volume, @Arg(value = 3, defValue = "1") Float pitch)
throws CommandException {
npc.getEntity().getWorld().playSound(npc.getEntity(), sound, volume, pitch);
@Arg(value = 2, defValue = "1") Float volume, @Arg(value = 3, defValue = "1") Float pitch,
@Flag("at") Location at) throws CommandException {
Location loc = at == null ? npc.getStoredLocation() : at;
loc.getWorld().playSound(loc, sound, volume, pitch);
}
@Command(

View File

@ -74,9 +74,11 @@ public class CitizensNPCRegistry implements NPCRegistry {
if (type == EntityType.ARMOR_STAND && !npc.hasTrait(ArmorStandTrait.class)) {
npc.addTrait(ArmorStandTrait.class);
}
if (Setting.DEFAULT_LOOK_CLOSE.asBoolean()) {
npc.addTrait(LookClose.class);
}
npc.addTrait(MountTrait.class);
return npc;
}

View File

@ -35,6 +35,7 @@ import net.citizensnpcs.api.astar.pathfinder.MinecraftBlockExaminer;
import net.citizensnpcs.api.astar.pathfinder.SwimmingExaminer;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.DataKey;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.api.util.SpigotUtil;
import net.citizensnpcs.npc.ai.AStarNavigationStrategy.AStarPlanner;
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
@ -390,6 +391,9 @@ public class CitizensNavigator implements Navigator, Runnable {
private void stopNavigating(CancelReason reason) {
if (!isNavigating())
return;
if (reason == CancelReason.STUCK && Messaging.isDebugging()) {
Messaging.debug(npc, "navigation ended, stuck", executing);
}
if (session != null) {
session.end();
session = null;

View File

@ -25,7 +25,7 @@ public class ExperienceAction extends NPCShopAction {
@Override
public String describe() {
return exp + " XP";
return exp == 1 ? exp + " level" : exp + " levels";
}
@Override
@ -90,7 +90,7 @@ public class ExperienceAction extends NPCShopAction {
ExperienceAction old = (ExperienceAction) previous;
description = old.describe();
}
return Util.createItem(Material.EXPERIENCE_BOTTLE, "Experience", description);
return Util.createItem(Material.EXPERIENCE_BOTTLE, "XP Level", description);
}
@Override

View File

@ -63,8 +63,8 @@ citizens.commands.npc.command.cost-missing=Missing cost to set.
citizens.commands.npc.command.invalid-error-message=Invalid error message. Valid messages are [[{0}]].
citizens.commands.npc.command.hide-error-messages-set=Now hiding error messages.
citizens.commands.npc.command.hide-error-messages-unset=No longer hiding error messages.
citizens.commands.npc.command.experience-cost-set=Set experience cost per click to [[{0}]].
citizens.commands.npc.command.individual-experience-cost-set=Set experience cost per click to [[{0}]] for command id [[{1}]].
citizens.commands.npc.command.experience-cost-set=Set xp level cost per click to [[{0}]].
citizens.commands.npc.command.individual-experience-cost-set=Set xp level cost per click to [[{0}]] for command id [[{1}]].
citizens.commands.npc.command.left-hand-header=Commands to run on [[left click]]:
citizens.commands.npc.command.right-hand-header=Commands to run on [[right click]]:
citizens.commands.npc.command.command-removed=Command [[{0}]] removed.