43 $this->type = $in->getByte();
45 $entry = new ScorePacketEntry();
46 $entry->scoreboardId = $in->getVarLong();
47 $entry->objectiveName = $in->getString();
48 $entry->score = $in->getLInt();
49 if($this->type !== self::TYPE_REMOVE){
50 $entry->type = $in->getByte();
52 case ScorePacketEntry::TYPE_PLAYER:
53 case ScorePacketEntry::TYPE_ENTITY:
54 $entry->actorUniqueId = $in->getActorUniqueId();
56 case ScorePacketEntry::TYPE_FAKE_PLAYER:
57 $entry->customName = $in->getString();
60 throw new PacketDecodeException(
"Unknown entry type $entry->type");
63 $this->entries[] = $entry;
68 $out->putByte($this->type);
70 foreach($this->entries as $entry){
72 $out->putString($entry->objectiveName);
73 $out->putLInt($entry->score);
74 if($this->type !== self::TYPE_REMOVE){
75 $out->putByte($entry->type);
77 case ScorePacketEntry::TYPE_PLAYER:
78 case ScorePacketEntry::TYPE_ENTITY:
79 $out->putActorUniqueId($entry->actorUniqueId);
81 case ScorePacketEntry::TYPE_FAKE_PLAYER:
82 $out->putString($entry->customName);
85 throw new \InvalidArgumentException(
"Unknown entry type $entry->type");