mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-06-22 20:44:56 +02:00
Cancel right click event if NPC has talked to someone
This commit is contained in:
parent
0531fe859e
commit
06d8e92ff2
|
@ -458,6 +458,9 @@ public class EventListen implements Listener {
|
|||
Player player = event.getPlayer();
|
||||
NPCRightClickEvent rightClickEvent = new NPCRightClickEvent(npc, player);
|
||||
Bukkit.getPluginManager().callEvent(rightClickEvent);
|
||||
if (rightClickEvent.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
if (npc.hasTrait(CommandTrait.class)) {
|
||||
npc.getTrait(CommandTrait.class).dispatch(player, CommandTrait.Hand.RIGHT);
|
||||
}
|
||||
|
|
|
@ -140,6 +140,7 @@ public class Text extends Trait implements Runnable, Toggleable, Listener, Conve
|
|||
String localPattern = itemInHandPattern.equals("default") ? Setting.TALK_ITEM.asString() : itemInHandPattern;
|
||||
if (Util.matchesItemInHand(event.getClicker(), localPattern) && !shouldTalkClose()) {
|
||||
sendText(event.getClicker());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user