Make uniform datapacket type for plugin event

This commit is contained in:
yefengeeeeeeeeeee 2026-07-12 18:58:25 +08:00
parent 426fd93cb6
commit 047852e0bf
2 changed files with 6 additions and 2 deletions

View file

@ -32,7 +32,9 @@ class DataPacketReceiveEvent extends ServerEvent implements CancellableEvent{
} }
public function getPacket(){ public function getPacket(){
return $this->packet; $packetCurrent = clone $this->packet;
$packetCurrent->PROTOCOL = ProtocolInfo::CURRENT_PROTOCOL;
return $packetCurrent;
} }
public function getPlayer(){ public function getPlayer(){

View file

@ -32,7 +32,9 @@ class DataPacketSendEvent extends ServerEvent implements CancellableEvent{
} }
public function getPacket(){ public function getPacket(){
return $this->packet; $packetCurrent = clone $this->packet;
$packetCurrent->PROTOCOL = ProtocolInfo::CURRENT_PROTOCOL;
return $packetCurrent;
} }
public function getPlayer(){ public function getPlayer(){