Search in sources :

Example 1 with EntityFishingHook

use of net.minecraft.server.v1_16_R3.EntityFishingHook in project Citizens2 by CitizensDev.

the class NMSImpl method removeHookIfNecessary.

@Override
public void removeHookIfNecessary(NPCRegistry npcRegistry, FishHook entity) {
    EntityFishingHook hook = (EntityFishingHook) NMSImpl.getHandle(entity);
    if (hook.hooked == null)
        return;
    NPC npc = npcRegistry.getNPC(hook.hooked.getBukkitEntity());
    if (npc == null)
        return;
    if (npc.isProtected()) {
        hook.hooked = null;
        hook.die();
    }
}
Also used : EntityHumanNPC(net.citizensnpcs.nms.v1_10_R1.entity.EntityHumanNPC) NPC(net.citizensnpcs.api.npc.NPC) EntityFishingHook(net.minecraft.server.v1_10_R1.EntityFishingHook)

Example 2 with EntityFishingHook

use of net.minecraft.server.v1_16_R3.EntityFishingHook in project Citizens2 by CitizensDev.

the class NMSImpl method removeHookIfNecessary.

@Override
public void removeHookIfNecessary(NPCRegistry npcRegistry, FishHook entity) {
    EntityFishingHook hook = (EntityFishingHook) NMSImpl.getHandle(entity);
    if (hook.hooked == null)
        return;
    NPC npc = npcRegistry.getNPC(hook.hooked.getBukkitEntity());
    if (npc == null)
        return;
    if (npc.isProtected()) {
        hook.hooked = null;
        hook.die();
    }
}
Also used : NPC(net.citizensnpcs.api.npc.NPC) EntityHumanNPC(net.citizensnpcs.nms.v1_13_R2.entity.EntityHumanNPC) EntityFishingHook(net.minecraft.server.v1_13_R2.EntityFishingHook)

Example 3 with EntityFishingHook

use of net.minecraft.server.v1_16_R3.EntityFishingHook in project Citizens2 by CitizensDev.

the class NMSImpl method removeHookIfNecessary.

@Override
public void removeHookIfNecessary(NPCRegistry npcRegistry, FishHook entity) {
    if (FISHING_HOOK_HOOKED == null)
        return;
    EntityFishingHook hook = (EntityFishingHook) NMSImpl.getHandle(entity);
    Entity hooked = null;
    try {
        hooked = (Entity) FISHING_HOOK_HOOKED.invoke(hook);
    } catch (Throwable e) {
        e.printStackTrace();
    }
    if (hooked == null)
        return;
    NPC npc = npcRegistry.getNPC(hooked.getBukkitEntity());
    if (npc == null)
        return;
    if (npc.isProtected()) {
        try {
            FISHING_HOOK_HOOKED_SETTER.invoke(hook, null);
        } catch (Throwable e) {
            e.printStackTrace();
        }
        hook.die();
    }
}
Also used : NPC(net.citizensnpcs.api.npc.NPC) EntityHumanNPC(net.citizensnpcs.nms.v1_16_R3.entity.EntityHumanNPC) Entity(net.minecraft.server.v1_16_R3.Entity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_16_R3.entity.CraftEntity) PathEntity(net.minecraft.server.v1_16_R3.PathEntity) EntityFishingHook(net.minecraft.server.v1_16_R3.EntityFishingHook)

Example 4 with EntityFishingHook

use of net.minecraft.server.v1_16_R3.EntityFishingHook in project Citizens2 by CitizensDev.

the class NMSImpl method removeHookIfNecessary.

@Override
public void removeHookIfNecessary(NPCRegistry npcRegistry, FishHook entity) {
    EntityFishingHook hook = (EntityFishingHook) NMSImpl.getHandle(entity);
    if (hook.hooked == null)
        return;
    NPC npc = npcRegistry.getNPC(hook.hooked.getBukkitEntity());
    if (npc == null)
        return;
    if (npc.isProtected()) {
        hook.hooked = null;
        hook.die();
    }
}
Also used : EntityHumanNPC(net.citizensnpcs.nms.v1_14_R1.entity.EntityHumanNPC) NPC(net.citizensnpcs.api.npc.NPC) EntityFishingHook(net.minecraft.server.v1_14_R1.EntityFishingHook)

Example 5 with EntityFishingHook

use of net.minecraft.server.v1_16_R3.EntityFishingHook in project Citizens2 by CitizensDev.

the class NMSImpl method removeHookIfNecessary.

@Override
public void removeHookIfNecessary(NPCRegistry npcRegistry, FishHook entity) {
    EntityFishingHook hook = (EntityFishingHook) NMSImpl.getHandle(entity);
    if (hook.hooked == null)
        return;
    NPC npc = npcRegistry.getNPC(hook.hooked.getBukkitEntity());
    if (npc == null)
        return;
    if (npc.isProtected()) {
        hook.hooked = null;
        hook.die();
    }
}
Also used : EntityHumanNPC(net.citizensnpcs.nms.v1_8_R3.entity.EntityHumanNPC) NPC(net.citizensnpcs.api.npc.NPC) EntityFishingHook(net.minecraft.server.v1_8_R3.EntityFishingHook)

Aggregations

NPC (net.citizensnpcs.api.npc.NPC)8 EntityHumanNPC (net.citizensnpcs.nms.v1_10_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_11_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_12_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_13_R2.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_14_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_15_R1.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_16_R3.entity.EntityHumanNPC)1 EntityHumanNPC (net.citizensnpcs.nms.v1_8_R3.entity.EntityHumanNPC)1 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)1 EntityFishingHook (net.minecraft.server.v1_10_R1.EntityFishingHook)1 EntityFishingHook (net.minecraft.server.v1_11_R1.EntityFishingHook)1 EntityFishingHook (net.minecraft.server.v1_12_R1.EntityFishingHook)1 EntityFishingHook (net.minecraft.server.v1_13_R2.EntityFishingHook)1 EntityFishingHook (net.minecraft.server.v1_14_R1.EntityFishingHook)1 EntityFishingHook (net.minecraft.server.v1_15_R1.EntityFishingHook)1 Entity (net.minecraft.server.v1_16_R3.Entity)1 EntityFishingHook (net.minecraft.server.v1_16_R3.EntityFishingHook)1 PathEntity (net.minecraft.server.v1_16_R3.PathEntity)1 EntityFishingHook (net.minecraft.server.v1_8_R3.EntityFishingHook)1