Search in sources :

Example 1 with NPCCombustByBlockEvent

use of net.citizensnpcs.api.event.NPCCombustByBlockEvent in project Citizens2 by CitizensDev.

the class EventListen method onEntityCombust.

/*
     * Entity events
     */
@EventHandler
public void onEntityCombust(EntityCombustEvent event) {
    NPC npc = CitizensAPI.getNPCRegistry().getNPC(event.getEntity());
    if (npc == null)
        return;
    event.setCancelled(npc.data().get(NPC.DEFAULT_PROTECTED_METADATA, true));
    if (event instanceof EntityCombustByEntityEvent) {
        Bukkit.getPluginManager().callEvent(new NPCCombustByEntityEvent((EntityCombustByEntityEvent) event, npc));
    } else if (event instanceof EntityCombustByBlockEvent) {
        Bukkit.getPluginManager().callEvent(new NPCCombustByBlockEvent((EntityCombustByBlockEvent) event, npc));
    } else {
        Bukkit.getPluginManager().callEvent(new NPCCombustEvent(event, npc));
    }
}
Also used : NPC(net.citizensnpcs.api.npc.NPC) EntityCombustByBlockEvent(org.bukkit.event.entity.EntityCombustByBlockEvent) NPCCombustByBlockEvent(net.citizensnpcs.api.event.NPCCombustByBlockEvent) NPCCombustByEntityEvent(net.citizensnpcs.api.event.NPCCombustByEntityEvent) NPCCombustEvent(net.citizensnpcs.api.event.NPCCombustEvent) EntityCombustByEntityEvent(org.bukkit.event.entity.EntityCombustByEntityEvent) EventHandler(org.bukkit.event.EventHandler)

Aggregations

NPCCombustByBlockEvent (net.citizensnpcs.api.event.NPCCombustByBlockEvent)1 NPCCombustByEntityEvent (net.citizensnpcs.api.event.NPCCombustByEntityEvent)1 NPCCombustEvent (net.citizensnpcs.api.event.NPCCombustEvent)1 NPC (net.citizensnpcs.api.npc.NPC)1 EventHandler (org.bukkit.event.EventHandler)1 EntityCombustByBlockEvent (org.bukkit.event.entity.EntityCombustByBlockEvent)1 EntityCombustByEntityEvent (org.bukkit.event.entity.EntityCombustByEntityEvent)1