CreatureTask.getCreature(event.getEntity()).onRightClick((Player) event.getTarget());
}
if (NPCManager.isNPC(event.getTarget())) {
NPCManager.get(event.getTarget()).callTargetEvent(event);
}
NPCTargetEvent e = event;
HumanNPC npc = NPCManager.get(e.getEntity());
if (npc != null && event.getTarget() instanceof Player) {
Player player = (Player) event.getTarget();
if (npc.getNPCData().isLookClose()) {
NPCManager.faceEntity(npc, player);
}
if (UtilityProperties.isHoldingTool("SelectItems", player)) {
if (!NPCManager.hasSelected(player, npc.getUID())) {
NPCDataManager.selectNPC(player, npc);
if (PermissionManager.hasPermission(player, "citizens.basic.modify.select"))
Messaging.send(player, npc, Settings.getString("SelectionMessage"));
if (!Settings.getBoolean("QuickSelect")) {
return;
}
}
}
// Call NPC talk event
if (npc.getNPCData().isTalk() && UtilityProperties.isHoldingTool("TalkItems", player)) {
Player target = (Player) e.getTarget();
NPCTalkEvent talkEvent = new NPCTalkEvent(npc, target, MessageUtils.getText(npc, target));
Bukkit.getServer().getPluginManager().callEvent(talkEvent);
if (!talkEvent.isCancelled()) {
if (!talkEvent.getText().isEmpty()) {
Messaging.send(target, npc, talkEvent.getText());