Minor changes

This commit is contained in:
fullwall 2022-10-02 23:10:23 +08:00
parent bfc7a540cf
commit 838aa3019b
3 changed files with 6 additions and 3 deletions

View File

@ -108,6 +108,7 @@ import net.citizensnpcs.trait.ScoreboardTrait;
import net.citizensnpcs.util.ChunkCoord;
import net.citizensnpcs.util.Messages;
import net.citizensnpcs.util.NMS;
import net.citizensnpcs.util.PlayerAnimation;
import net.citizensnpcs.util.Util;
public class EventListen implements Listener {
@ -523,7 +524,9 @@ public class EventListen implements Listener {
Bukkit.getPluginManager().callEvent(rightClickEvent);
if (rightClickEvent.isCancelled()) {
event.setCancelled(true);
return;
}
PlayerAnimation.STOP_USE_ITEM.play(player);
if (npc.hasTrait(CommandTrait.class)) {
npc.getTraitNullable(CommandTrait.class).dispatch(player, CommandTrait.Hand.RIGHT);
}

View File

@ -541,7 +541,7 @@ public class NPCCommands {
copy.setName(name);
}
if (copy.isSpawned() && args.getSenderLocation() != null) {
if (copy.getOrAddTrait(Spawned.class).shouldSpawn() && args.getSenderLocation() != null) {
Location location = args.getSenderLocation();
location.getChunk().load();
copy.teleport(location, TeleportCause.COMMAND);
@ -1317,7 +1317,7 @@ public class NPCCommands {
desc = "Manages NPC metadata",
modifiers = { "metadata" },
flags = "t",
min = 2,
min = 3,
max = 4,
permission = "citizens.npc.metadata")
@Requirements(selected = true, ownership = true)

View File

@ -45,7 +45,7 @@ public class SitTrait extends Trait {
}
holder = registry.createNPC(EntityType.ARMOR_STAND, "");
holder.getOrAddTrait(ArmorStandTrait.class).setAsPointEntity();
holder.spawn(npc.getEntity().getLocation());
holder.spawn(npc.getStoredLocation());
}
if (holder.getEntity() != null && !NMS.getPassengers(holder.getEntity()).contains(npc.getEntity())) {
NMS.mount(holder.getEntity(), npc.getEntity());