mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Server: Removed identifiers array
This is completely unnecessary and adds extra complexity for no good reason. Maybe it was used historically, but nowadays it is only used to identify players to send async-prepared batch packets to. There are two alternative ways to do that: 1. use spl_object_hash() as the targets array in CompressBatchedTask 2. use ServerScheduler's object storage to retain references to the Player[] array. I've opted for the second method. Removing these identifiers allows great code simplification in removePlayer() and removes the need for those old stupid hacks. This also includes a backwards-compatibility break by removing the $identifier parameter of Server->addPlayer().
This commit is contained in:
@ -134,7 +134,7 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
|
||||
$this->players[$identifier] = $player;
|
||||
$this->identifiersACK[$identifier] = 0;
|
||||
$this->identifiers[spl_object_hash($player)] = $identifier;
|
||||
$this->server->addPlayer($identifier, $player);
|
||||
$this->server->addPlayer($player);
|
||||
}
|
||||
|
||||
public function handleEncapsulated(string $identifier, EncapsulatedPacket $packet, int $flags) : void{
|
||||
|
Reference in New Issue
Block a user