27 public const ID = DataStoreType::CHANGE;
29 public function __construct(
31 private string $property,
32 private int $updateCount,
36 public function getTypeId() :
int{
40 public function getName() :
string{
return $this->name; }
42 public function getProperty() :
string{
return $this->property; }
44 public function getUpdateCount() :
int{
return $this->updateCount; }
48 public static function read(ByteBufferReader $in) :
self{
49 $name = CommonTypes::getString($in);
50 $property = CommonTypes::getString($in);
51 $updateCount = VarInt::readUnsignedInt($in);
53 $data = match(VarInt::readUnsignedInt($in)){
54 DataStoreValueType::DOUBLE => DoubleDataStoreValue::read($in),
55 DataStoreValueType::BOOL => BoolDataStoreValue::read($in),
56 DataStoreValueType::STRING => StringDataStoreValue::read($in),
68 public function write(ByteBufferWriter $out) :
void{
69 CommonTypes::putString($out, $this->name);
70 CommonTypes::putString($out, $this->property);
71 VarInt::writeUnsignedInt($out, $this->updateCount);
72 VarInt::writeUnsignedInt($out, $this->data->getTypeId());
73 $this->data->write($out);