Search in sources :

Example 86 with CraftPlayer

use of org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer in project MechanicsMain by WeaponMechanics.

the class Scope_1_11_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_11_R1.PacketPlayOutEntityEffect) MobEffect(net.minecraft.server.v1_11_R1.MobEffect) EntityPlayer(net.minecraft.server.v1_11_R1.EntityPlayer) PacketPlayOutRemoveEntityEffect(net.minecraft.server.v1_11_R1.PacketPlayOutRemoveEntityEffect) CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer)

Example 87 with CraftPlayer

use of org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer in project MechanicsMain by WeaponMechanics.

the class Scope_1_11_R1 method addNightVision.

@Override
public void addNightVision(Player player) {
    // 6000 = 5min
    PacketPlayOutEntityEffect entityEffect = new PacketPlayOutEntityEffect(-player.getEntityId(), new MobEffect(MobEffectList.fromId(PotionEffectType.NIGHT_VISION.getId()), 6000, 2));
    ((CraftPlayer) player).getHandle().playerConnection.sendPacket(entityEffect);
}
Also used : PacketPlayOutEntityEffect(net.minecraft.server.v1_11_R1.PacketPlayOutEntityEffect) MobEffect(net.minecraft.server.v1_11_R1.MobEffect) CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer)

Example 88 with CraftPlayer

use of org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer in project MechanicsMain by WeaponMechanics.

the class Scope_1_11_R1 method updateAbilities.

@Override
public void updateAbilities(Player player) {
    EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
    entityPlayer.playerConnection.sendPacket(new PacketPlayOutAbilities(entityPlayer.abilities));
}
Also used : EntityPlayer(net.minecraft.server.v1_11_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer) PacketPlayOutAbilities(net.minecraft.server.v1_11_R1.PacketPlayOutAbilities)

Example 89 with CraftPlayer

use of org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer in project MechanicsMain by WeaponMechanics.

the class Scope_1_12_R1 method updateAbilities.

@Override
public void updateAbilities(Player player) {
    EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
    entityPlayer.playerConnection.sendPacket(new PacketPlayOutAbilities(entityPlayer.abilities));
}
Also used : EntityPlayer(net.minecraft.server.v1_12_R1.EntityPlayer) CraftPlayer(org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer) PacketPlayOutAbilities(net.minecraft.server.v1_12_R1.PacketPlayOutAbilities)

Example 90 with CraftPlayer

use of org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer in project MechanicsMain by WeaponMechanics.

the class Scope_1_12_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_12_R1.PacketPlayOutEntityEffect) MobEffect(net.minecraft.server.v1_12_R1.MobEffect) EntityPlayer(net.minecraft.server.v1_12_R1.EntityPlayer) PacketPlayOutRemoveEntityEffect(net.minecraft.server.v1_12_R1.PacketPlayOutRemoveEntityEffect) CraftPlayer(org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)

Aggregations

Player (org.bukkit.entity.Player)234 ServerPlayer (net.minecraft.server.level.ServerPlayer)128 CraftPlayer (org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer)122 CraftPlayer (org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer)106 CraftPlayer (org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer)101 CraftPlayer (org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer)91 CraftPlayer (org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer)90 CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)81 ItemStack (org.bukkit.inventory.ItemStack)78 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)75 EntityPlayer (net.minecraft.server.level.EntityPlayer)68 Property (com.mojang.authlib.properties.Property)67 CraftPlayer (org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer)66 Location (org.bukkit.Location)60 GameProfile (com.mojang.authlib.GameProfile)59 CraftPlayer (org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer)58 CraftPlayer (org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer)55 CraftPlayer (org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer)54 CraftPlayer (org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer)49 CraftPlayer (org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer)48