From d08f56e6b11354b610793b7ffadcc2256475853f Mon Sep 17 00:00:00 2001 From: fullwall Date: Tue, 23 Apr 2019 22:39:51 +0800 Subject: [PATCH] Implement events --- .../main/java/net/citizensnpcs/commands/NPCCommands.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java b/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java index 0ee703584..58cf5a183 100644 --- a/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java +++ b/main/src/main/java/net/citizensnpcs/commands/NPCCommands.java @@ -50,8 +50,10 @@ import net.citizensnpcs.api.command.exception.CommandException; import net.citizensnpcs.api.command.exception.NoPermissionsException; import net.citizensnpcs.api.command.exception.RequirementMissingException; import net.citizensnpcs.api.command.exception.ServerCommandException; +import net.citizensnpcs.api.event.CommandSenderCloneNPCEvent; import net.citizensnpcs.api.event.CommandSenderCreateNPCEvent; import net.citizensnpcs.api.event.DespawnReason; +import net.citizensnpcs.api.event.PlayerCloneNPCEvent; import net.citizensnpcs.api.event.PlayerCreateNPCEvent; import net.citizensnpcs.api.event.SpawnReason; import net.citizensnpcs.api.npc.NPC; @@ -323,8 +325,9 @@ public class NPCCommands { copy.getTrait(CurrentLocation.class).setLocation(location); } - CommandSenderCreateNPCEvent event = sender instanceof Player ? new PlayerCreateNPCEvent((Player) sender, copy) - : new CommandSenderCreateNPCEvent(sender, copy); + CommandSenderCreateNPCEvent event = sender instanceof Player + ? new PlayerCloneNPCEvent((Player) sender, npc, copy) + : new CommandSenderCloneNPCEvent(sender, npc, copy); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { event.getNPC().destroy();