28 public const ID = DataStoreType::UPDATE;
30 public function __construct(
32 private string $property,
35 private int $updateCount,
36 private int $pathUpdateCount,
39 public function getTypeId() :
int{
43 public function getName() :
string{
return $this->name; }
45 public function getProperty() :
string{
return $this->property; }
47 public function getPath() :
string{
return $this->path; }
51 public function getUpdateCount() :
int{
return $this->updateCount; }
53 public function getPathUpdateCount() :
int{
return $this->pathUpdateCount; }
55 public static function read(ByteBufferReader $in) :
self{
56 $name = CommonTypes::getString($in);
57 $property = CommonTypes::getString($in);
58 $path = CommonTypes::getString($in);
60 $data = match(VarInt::readUnsignedInt($in)){
61 DataStoreValueType::DOUBLE => DoubleDataStoreValue::read($in),
62 DataStoreValueType::BOOL => BoolDataStoreValue::read($in),
63 DataStoreValueType::STRING => StringDataStoreValue::read($in),
67 $updateCount = LE::readUnsignedInt($in);
68 $pathUpdateCount = LE::readUnsignedInt($in);
80 public function write(ByteBufferWriter $out) :
void{
81 CommonTypes::putString($out, $this->name);
82 CommonTypes::putString($out, $this->property);
83 CommonTypes::putString($out, $this->path);
84 VarInt::writeUnsignedInt($out, $this->data->getTypeId());
85 $this->data->write($out);
86 LE::writeUnsignedInt($out, $this->updateCount);
87 LE::writeUnsignedInt($out, $this->pathUpdateCount);