setDataFlag() public method

public setDataFlag ( $propertyId, $id, boolean $value = true, integer $type = self::DATA_TYPE_BYTE )
$propertyId
$id
$value boolean
$type integer
Example #1
0
 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);
     }
 }
Example #2
0
 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);
     }
     if ($this->id === Effect::INVISIBILITY) {
         $entity->setDataFlag(Entity::DATA_FLAGS, Entity::DATA_FLAG_INVISIBLE, false);
         $entity->setNameTagVisible(true);
     } elseif ($this->id === Effect::SPEED) {
         $attr = $entity->getAttributeMap()->getAttribute(Attribute::MOVEMENT_SPEED);
         $attr->setValue($attr->getValue() / (1 + 0.2 * $this->amplifier));
     } elseif ($this->id === Effect::SLOWNESS) {
         $attr = $entity->getAttributeMap()->getAttribute(Attribute::MOVEMENT_SPEED);
         $attr->setValue($attr->getValue() / (1 - 0.15 * $this->amplifier));
     }
 }
Example #3
0
 public function remove(Entity $entity)
 {
     Server::getInstance()->getPluginManager()->callEvent($ev = new RemoveEffectEvent($entity, $this));
     if ($ev->isCancelled) {
         return false;
     }
     if ($entity instanceof Player) {
         $pk = new MobEffectPacket();
         $pk->eid = 0;
         $pk->eventId = MobEffectPacket::EVENT_REMOVE;
         $pk->effectId = $this->getId();
         $entity->dataPacket($pk);
     }
     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);
     }
 }
Example #4
0
 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);
         if ($this->id === Effect::SPEED or $this->id === Effect::SLOWNESS) {
             if ($entity instanceof Player) {
                 $entity->setMovementSpeed(0.1);
             }
         }
     }
     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);
     }
 }