forked from Upstream/CitizensCMD
Move NPC remove event into the correct class
This commit is contained in:
parent
2cfd0beb6f
commit
0011f2282e
@ -48,7 +48,6 @@ import me.mattstudios.citizenscmd.utility.EnumTypes;
|
||||
import me.mattstudios.citizenscmd.utility.Messages;
|
||||
import me.mattstudios.citizenscmd.utility.Util;
|
||||
import net.citizensnpcs.api.event.NPCLeftClickEvent;
|
||||
import net.citizensnpcs.api.event.NPCRemoveEvent;
|
||||
import net.citizensnpcs.api.event.NPCRightClickEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
@ -228,15 +227,6 @@ public class NPCClickListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onRemoveNPC(NPCRemoveEvent event) {
|
||||
if (!plugin.getDataHandler().hasNPCData(event.getNPC().getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getDataHandler().removeNPCData(event.getNPC().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the main commands for both left and right clicks.
|
||||
*
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.event.Listener;
|
||||
|
||||
import me.mattstudios.citizenscmd.CitizensCMD;
|
||||
import net.citizensnpcs.api.event.NPCCloneEvent;
|
||||
import net.citizensnpcs.api.event.NPCRemoveEvent;
|
||||
|
||||
public class NPCListener implements Listener {
|
||||
|
||||
@ -16,11 +17,20 @@ public class NPCListener implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void on(NPCCloneEvent event) {
|
||||
public void onCloneNPC(NPCCloneEvent event) {
|
||||
if (!plugin.getDataHandler().hasNPCData(event.getNPC().getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getDataHandler().cloneData(event.getNPC().getId(), event.getClone().getId());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onRemoveNPC(NPCRemoveEvent event) {
|
||||
if (!plugin.getDataHandler().hasNPCData(event.getNPC().getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
plugin.getDataHandler().removeNPCData(event.getNPC().getId());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user