use of net.minecraft.network.protocol.game.ClientboundRemoveMobEffectPacket in project MechanicsMain by WeaponMechanics.
the class Scope_1_18_R2 method removeNightVision.
@Override
public void removeNightVision(org.bukkit.entity.Player player) {
if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
ServerPlayer entityPlayer = ((CraftPlayer) player).getHandle();
// Simply remove the entity effect
ClientboundRemoveMobEffectPacket removeEntityEffect = new ClientboundRemoveMobEffectPacket(player.getEntityId(), MobEffect.byId(PotionEffectType.NIGHT_VISION.getId()));
entityPlayer.connection.send(removeEntityEffect);
// resend the existing one
MobEffectInstance mobEffect = entityPlayer.getEffect(MobEffect.byId(PotionEffectType.NIGHT_VISION.getId()));
ClientboundUpdateMobEffectPacket entityEffect = new ClientboundUpdateMobEffectPacket(player.getEntityId(), mobEffect);
((CraftPlayer) player).getHandle().connection.send(entityEffect);
return;
}
// Simply remove the entity effect
ClientboundRemoveMobEffectPacket removeEntityEffect = new ClientboundRemoveMobEffectPacket(player.getEntityId(), MobEffect.byId(PotionEffectType.NIGHT_VISION.getId()));
((CraftPlayer) player).getHandle().connection.send(removeEntityEffect);
}
use of net.minecraft.network.protocol.game.ClientboundRemoveMobEffectPacket in project MechanicsMain by WeaponMechanics.
the class Scope_1_17_R1 method removeNightVision.
@Override
public void removeNightVision(org.bukkit.entity.Player player) {
if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
ServerPlayer entityPlayer = ((CraftPlayer) player).getHandle();
// Simply remove the entity effect
ClientboundRemoveMobEffectPacket removeEntityEffect = new ClientboundRemoveMobEffectPacket(player.getEntityId(), MobEffect.byId(PotionEffectType.NIGHT_VISION.getId()));
entityPlayer.connection.send(removeEntityEffect);
// resend the existing one
MobEffectInstance mobEffect = entityPlayer.getEffect(MobEffect.byId(PotionEffectType.NIGHT_VISION.getId()));
ClientboundUpdateMobEffectPacket entityEffect = new ClientboundUpdateMobEffectPacket(player.getEntityId(), mobEffect);
((CraftPlayer) player).getHandle().connection.send(entityEffect);
return;
}
// Simply remove the entity effect
ClientboundRemoveMobEffectPacket removeEntityEffect = new ClientboundRemoveMobEffectPacket(player.getEntityId(), MobEffect.byId(PotionEffectType.NIGHT_VISION.getId()));
((CraftPlayer) player).getHandle().connection.send(removeEntityEffect);
}
use of net.minecraft.network.protocol.game.ClientboundRemoveMobEffectPacket in project MechanicsMain by WeaponMechanics.
the class Scope_1_18_R1 method removeNightVision.
@Override
public void removeNightVision(org.bukkit.entity.Player player) {
if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION)) {
ServerPlayer entityPlayer = ((CraftPlayer) player).getHandle();
// Simply remove the entity effect
ClientboundRemoveMobEffectPacket removeEntityEffect = new ClientboundRemoveMobEffectPacket(player.getEntityId(), MobEffect.byId(PotionEffectType.NIGHT_VISION.getId()));
entityPlayer.connection.send(removeEntityEffect);
// resend the existing one
MobEffectInstance mobEffect = entityPlayer.getEffect(MobEffect.byId(PotionEffectType.NIGHT_VISION.getId()));
ClientboundUpdateMobEffectPacket entityEffect = new ClientboundUpdateMobEffectPacket(player.getEntityId(), mobEffect);
((CraftPlayer) player).getHandle().connection.send(entityEffect);
return;
}
// Simply remove the entity effect
ClientboundRemoveMobEffectPacket removeEntityEffect = new ClientboundRemoveMobEffectPacket(player.getEntityId(), MobEffect.byId(PotionEffectType.NIGHT_VISION.getId()));
((CraftPlayer) player).getHandle().connection.send(removeEntityEffect);
}
Aggregations