use of net.minecraft.server.v1_11_R1.MobEffect 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);
}
use of net.minecraft.server.v1_11_R1.MobEffect 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);
}
use of net.minecraft.server.v1_11_R1.MobEffect in project MechanicsMain by WeaponMechanics.
the class Scope_1_13_R2 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);
}
use of net.minecraft.server.v1_11_R1.MobEffect 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);
}
use of net.minecraft.server.v1_11_R1.MobEffect in project PaperDev by Kamillaova.
the class CraftTippedArrow method addCustomEffect.
@Override
public boolean addCustomEffect(PotionEffect effect, boolean override) {
int effectId = effect.getType().getId();
MobEffect existing = null;
for (MobEffect mobEffect : getHandle().effects) {
if (MobEffectList.getId(mobEffect.getMobEffect()) == effectId) {
existing = mobEffect;
}
}
if (existing != null) {
if (!override) {
return false;
}
getHandle().effects.remove(existing);
}
getHandle().a(CraftPotionUtil.fromBukkit(effect));
getHandle().refreshEffects();
return true;
}
Aggregations