GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
AttributeMap Class Reference

Public Member Functions

 addAttribute (Attribute $attribute)
 
 getAttribute (int $id)
 
 getAll ()
 
 needSend ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 

Member Function Documentation

◆ addAttribute()

addAttribute ( Attribute  $attribute)
Parameters
Attribute$attribute
31  {
32  $this->attributes[$attribute->getId()] = $attribute;
33  }

◆ getAll()

getAll ( )
Returns
array
47  : array{
48  return $this->attributes;
49  }

◆ getAttribute()

getAttribute ( int  $id)
Parameters
int$id
Returns
Attribute|null
40  {
41  return $this->attributes[$id] ?? null;
42  }

◆ needSend()

needSend ( )
Returns
Attribute[]
54  : array{
55  return array_filter($this->attributes, function(Attribute $attribute){
56  return $attribute->isSyncable() and $attribute->isDesynchronized();
57  });
58  }

◆ offsetExists()

offsetExists (   $offset)
Parameters
mixed$offset
Returns
bool
65  {
66  return isset($this->attributes[$offset]);
67  }

◆ offsetGet()

offsetGet (   $offset)
Parameters
mixed$offset
Returns
float
74  {
75  return $this->attributes[$offset]->getValue();
76  }

◆ offsetSet()

offsetSet (   $offset,
  $value 
)
Parameters
mixed$offset
mixed$value
82  {
83  $this->attributes[$offset]->setValue($value);
84  }

◆ offsetUnset()

offsetUnset (   $offset)
Parameters
mixed$offset
89  {
90  throw new \RuntimeException("Could not unset an attribute from an attribute map");
91  }

The documentation for this class was generated from the following file: