Add /npc jump and /npc wander

This commit is contained in:
fullwall 2022-10-08 11:11:40 +08:00
parent eb5adf9667
commit 91feca62c7

View File

@ -135,6 +135,7 @@ import net.citizensnpcs.trait.SlimeSize;
import net.citizensnpcs.trait.VillagerProfession; import net.citizensnpcs.trait.VillagerProfession;
import net.citizensnpcs.trait.WitherTrait; import net.citizensnpcs.trait.WitherTrait;
import net.citizensnpcs.trait.WolfModifiers; import net.citizensnpcs.trait.WolfModifiers;
import net.citizensnpcs.trait.waypoint.Waypoints;
import net.citizensnpcs.util.Anchor; import net.citizensnpcs.util.Anchor;
import net.citizensnpcs.util.Messages; import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.NMS; import net.citizensnpcs.util.NMS;
@ -1158,6 +1159,18 @@ public class NPCCommands {
Messaging.sendTr(sender, Messages.ITEM_SET, Util.prettyEnum(mat)); Messaging.sendTr(sender, Messages.ITEM_SET, Util.prettyEnum(mat));
} }
@Command(
aliases = { "npc" },
usage = "jump",
desc = "Makes the NPC jump",
modifiers = { "jump" },
min = 1,
max = 1,
permission = "citizens.npc.jump")
public void jump(CommandContext args, CommandSender sender, NPC npc) {
NMS.setShouldJump(npc.getEntity());
}
@Command( @Command(
aliases = { "npc" }, aliases = { "npc" },
usage = "leashable", usage = "leashable",
@ -2812,6 +2825,20 @@ public class NPCCommands {
Messaging.sendTr(sender, key, npc.getName()); Messaging.sendTr(sender, key, npc.getName());
} }
@Command(
aliases = { "npc" },
usage = "wander",
desc = "Sets the NPC to wander around",
modifiers = { "wander" },
min = 1,
max = 1,
permission = "citizens.npc.wander")
public void wander(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
Waypoints trait = npc.getOrAddTrait(Waypoints.class);
trait.setWaypointProvider(trait.getCurrentProviderName().equals("wander") ? "wander" : "linear");
Messaging.sendTr(sender, Messages.WAYPOINT_PROVIDER_SET, trait.getCurrentProviderName());
}
@Command( @Command(
aliases = { "npc" }, aliases = { "npc" },
usage = "wither (--invulnerable [true|false]) (--arrow-shield [true|false])", usage = "wither (--invulnerable [true|false]) (--arrow-shield [true|false])",