public function setDataFlag($propertyId, $id, $value = true, $type = self::DATA_TYPE_BYTE) { if ($this->getDataFlag($propertyId, $id) !== $value) { $flags = (int) $this->getDataProperty($propertyId); $flags ^= 1 << $id; $this->setDataProperty($propertyId, $type, $flags); } }
public function remove(Entity $entity) { if ($entity instanceof Player) { $pk = new MobEffectPacket(); $pk->eid = 0; $pk->eventId = MobEffectPacket::EVENT_REMOVE; $pk->effectId = $this->getId(); $entity->dataPacket($pk->setChannel(Network::CHANNEL_WORLD_EVENTS)); } if ($this->id === Effect::INVISIBILITY) { $entity->setDataFlag(Entity::DATA_FLAGS, Entity::DATA_FLAG_INVISIBLE, false); $entity->setDataProperty(Entity::DATA_SHOW_NAMETAG, Entity::DATA_TYPE_BYTE, 1); } }