Search in sources :

Example 6 with PacketPlayOutRemoveEntityEffect

use of net.minecraft.server.v1_12_R1.PacketPlayOutRemoveEntityEffect in project MechanicsMain by WeaponMechanics.

the class Scope_1_16_R3 method removeNightVision.

@Override
public void removeNightVision(Player player) {
    if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
        EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
        // Simply remove the entity effect
        PacketPlayOutRemoveEntityEffect removeEntityEffect = new PacketPlayOutRemoveEntityEffect(player.getEntityId(), MobEffectList.fromId(PotionEffectType.NIGHT_VISION.getId()));
        entityPlayer.playerConnection.sendPacket(removeEntityEffect);
        // resend the existing one
        MobEffect mobEffect = entityPlayer.getEffect(MobEffectList.fromId(PotionEffectType.NIGHT_VISION.getId()));
        PacketPlayOutEntityEffect entityEffect = new PacketPlayOutEntityEffect(player.getEntityId(), mobEffect);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(entityEffect);
        return;
    }
    // Simply remove the entity effect
    PacketPlayOutRemoveEntityEffect removeEntityEffect = new PacketPlayOutRemoveEntityEffect(player.getEntityId(), MobEffectList.fromId(PotionEffectType.NIGHT_VISION.getId()));
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(removeEntityEffect);
}
Also used : PacketPlayOutEntityEffect(net.minecraft.server.v1_16_R3.PacketPlayOutEntityEffect) MobEffect(net.minecraft.server.v1_16_R3.MobEffect) EntityPlayer(net.minecraft.server.v1_16_R3.EntityPlayer) PacketPlayOutRemoveEntityEffect(net.minecraft.server.v1_16_R3.PacketPlayOutRemoveEntityEffect) CraftPlayer(org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)

Example 7 with PacketPlayOutRemoveEntityEffect

use of net.minecraft.server.v1_12_R1.PacketPlayOutRemoveEntityEffect in project MechanicsMain by WeaponMechanics.

the class Scope_1_10_R1 method removeNightVision.

@Override
public void removeNightVision(Player player) {
    if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
        EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
        // Simply remove the entity effect
        PacketPlayOutRemoveEntityEffect removeEntityEffect = new PacketPlayOutRemoveEntityEffect(player.getEntityId(), MobEffectList.fromId(PotionEffectType.NIGHT_VISION.getId()));
        entityPlayer.playerConnection.sendPacket(removeEntityEffect);
        // resend the existing one
        MobEffect mobEffect = entityPlayer.getEffect(MobEffectList.fromId(PotionEffectType.NIGHT_VISION.getId()));
        PacketPlayOutEntityEffect entityEffect = new PacketPlayOutEntityEffect(player.getEntityId(), mobEffect);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(entityEffect);
        return;
    }
    // Simply remove the entity effect
    PacketPlayOutRemoveEntityEffect removeEntityEffect = new PacketPlayOutRemoveEntityEffect(player.getEntityId(), MobEffectList.fromId(PotionEffectType.NIGHT_VISION.getId()));
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(removeEntityEffect);
}
Also used : PacketPlayOutEntityEffect(net.minecraft.server.v1_10_R1.PacketPlayOutEntityEffect) MobEffect(net.minecraft.server.v1_10_R1.MobEffect) EntityPlayer(net.minecraft.server.v1_10_R1.EntityPlayer) PacketPlayOutRemoveEntityEffect(net.minecraft.server.v1_10_R1.PacketPlayOutRemoveEntityEffect) CraftPlayer(org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer)

Example 8 with PacketPlayOutRemoveEntityEffect

use of net.minecraft.server.v1_12_R1.PacketPlayOutRemoveEntityEffect in project MechanicsMain by WeaponMechanics.

the class Scope_1_13_R2 method removeNightVision.

@Override
public void removeNightVision(Player player) {
    if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
        EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
        // Simply remove the entity effect
        PacketPlayOutRemoveEntityEffect removeEntityEffect = new PacketPlayOutRemoveEntityEffect(player.getEntityId(), MobEffectList.fromId(PotionEffectType.NIGHT_VISION.getId()));
        entityPlayer.playerConnection.sendPacket(removeEntityEffect);
        // resend the existing one
        MobEffect mobEffect = entityPlayer.getEffect(MobEffectList.fromId(PotionEffectType.NIGHT_VISION.getId()));
        PacketPlayOutEntityEffect entityEffect = new PacketPlayOutEntityEffect(player.getEntityId(), mobEffect);
        ((CraftPlayer) player).getHandle().playerConnection.sendPacket(entityEffect);
        return;
    }
    // Simply remove the entity effect
    PacketPlayOutRemoveEntityEffect removeEntityEffect = new PacketPlayOutRemoveEntityEffect(player.getEntityId(), MobEffectList.fromId(PotionEffectType.NIGHT_VISION.getId()));
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(removeEntityEffect);
}
Also used : PacketPlayOutEntityEffect(net.minecraft.server.v1_13_R2.PacketPlayOutEntityEffect) MobEffect(net.minecraft.server.v1_13_R2.MobEffect) EntityPlayer(net.minecraft.server.v1_13_R2.EntityPlayer) PacketPlayOutRemoveEntityEffect(net.minecraft.server.v1_13_R2.PacketPlayOutRemoveEntityEffect) CraftPlayer(org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer)

Aggregations

EntityPlayer (net.minecraft.server.v1_10_R1.EntityPlayer)1 MobEffect (net.minecraft.server.v1_10_R1.MobEffect)1 PacketPlayOutEntityEffect (net.minecraft.server.v1_10_R1.PacketPlayOutEntityEffect)1 PacketPlayOutRemoveEntityEffect (net.minecraft.server.v1_10_R1.PacketPlayOutRemoveEntityEffect)1 EntityPlayer (net.minecraft.server.v1_11_R1.EntityPlayer)1 MobEffect (net.minecraft.server.v1_11_R1.MobEffect)1 PacketPlayOutEntityEffect (net.minecraft.server.v1_11_R1.PacketPlayOutEntityEffect)1 PacketPlayOutRemoveEntityEffect (net.minecraft.server.v1_11_R1.PacketPlayOutRemoveEntityEffect)1 EntityPlayer (net.minecraft.server.v1_12_R1.EntityPlayer)1 MobEffect (net.minecraft.server.v1_12_R1.MobEffect)1 PacketPlayOutEntityEffect (net.minecraft.server.v1_12_R1.PacketPlayOutEntityEffect)1 PacketPlayOutRemoveEntityEffect (net.minecraft.server.v1_12_R1.PacketPlayOutRemoveEntityEffect)1 EntityPlayer (net.minecraft.server.v1_13_R2.EntityPlayer)1 MobEffect (net.minecraft.server.v1_13_R2.MobEffect)1 PacketPlayOutEntityEffect (net.minecraft.server.v1_13_R2.PacketPlayOutEntityEffect)1 PacketPlayOutRemoveEntityEffect (net.minecraft.server.v1_13_R2.PacketPlayOutRemoveEntityEffect)1 EntityPlayer (net.minecraft.server.v1_14_R1.EntityPlayer)1 MobEffect (net.minecraft.server.v1_14_R1.MobEffect)1 PacketPlayOutEntityEffect (net.minecraft.server.v1_14_R1.PacketPlayOutEntityEffect)1 PacketPlayOutRemoveEntityEffect (net.minecraft.server.v1_14_R1.PacketPlayOutRemoveEntityEffect)1