mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
AsyncPool: Remove Server dependency (API breaks included)
This brings two plugin-breaking changes: AsyncTask->onCompletion() and AsyncTask->onProgressUpdate() no longer accept Server parameters. This now allows for the functionality of AsyncPool and AsyncTask to be tested outside of a Server.
This commit is contained in:
@ -26,7 +26,6 @@ namespace pocketmine\network\mcpe;
|
||||
use pocketmine\level\format\Chunk;
|
||||
use pocketmine\network\mcpe\protocol\FullChunkDataPacket;
|
||||
use pocketmine\scheduler\AsyncTask;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\tile\Spawnable;
|
||||
|
||||
class ChunkRequestTask extends AsyncTask{
|
||||
@ -75,7 +74,7 @@ class ChunkRequestTask extends AsyncTask{
|
||||
$this->setResult(NetworkCompression::compress($stream->buffer, $this->compressionLevel), false);
|
||||
}
|
||||
|
||||
public function onCompletion(Server $server) : void{
|
||||
public function onCompletion() : void{
|
||||
/** @var CompressBatchPromise $promise */
|
||||
$promise = $this->fetchLocal();
|
||||
$promise->resolve($this->getResult());
|
||||
|
@ -24,7 +24,6 @@ declare(strict_types=1);
|
||||
namespace pocketmine\network\mcpe;
|
||||
|
||||
use pocketmine\scheduler\AsyncTask;
|
||||
use pocketmine\Server;
|
||||
|
||||
class CompressBatchTask extends AsyncTask{
|
||||
|
||||
@ -46,7 +45,7 @@ class CompressBatchTask extends AsyncTask{
|
||||
$this->setResult(NetworkCompression::compress($this->data, $this->level), false);
|
||||
}
|
||||
|
||||
public function onCompletion(Server $server) : void{
|
||||
public function onCompletion() : void{
|
||||
/** @var CompressBatchPromise $promise */
|
||||
$promise = $this->fetchLocal();
|
||||
$promise->resolve($this->getResult());
|
||||
|
@ -35,7 +35,6 @@ use Mdanter\Ecc\Serializer\Signature\DerSignatureSerializer;
|
||||
use pocketmine\network\mcpe\protocol\LoginPacket;
|
||||
use pocketmine\Player;
|
||||
use pocketmine\scheduler\AsyncTask;
|
||||
use pocketmine\Server;
|
||||
|
||||
class ProcessLoginTask extends AsyncTask{
|
||||
|
||||
@ -216,11 +215,11 @@ class ProcessLoginTask extends AsyncTask{
|
||||
return rtrim(strtr(base64_encode($str), '+/', '-_'), '=');
|
||||
}
|
||||
|
||||
public function onCompletion(Server $server) : void{
|
||||
public function onCompletion() : void{
|
||||
/** @var Player $player */
|
||||
$player = $this->fetchLocal();
|
||||
if(!$player->isConnected()){
|
||||
$server->getLogger()->error("Player " . $player->getName() . " was disconnected before their login could be verified");
|
||||
$this->worker->getLogger()->error("Player " . $player->getName() . " was disconnected before their login could be verified");
|
||||
}elseif($player->setAuthenticationStatus($this->authenticated, $this->error)){
|
||||
if(!$this->useEncryption){
|
||||
$player->getNetworkSession()->onLoginSuccess();
|
||||
|
Reference in New Issue
Block a user