mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 09:19:42 +00:00
fixup some formatting issues
This commit is contained in:
parent
bb675ac99b
commit
9df2ca3655
@ -46,10 +46,10 @@ class CallbackInventoryChangeListener implements InventoryChangeListener{
|
|||||||
|
|
||||||
public static function onAnyChange(\Closure $onChange) : self{
|
public static function onAnyChange(\Closure $onChange) : self{
|
||||||
return new self(
|
return new self(
|
||||||
static function(Inventory $inventory, int $unused) use($onChange) : void{
|
static function(Inventory $inventory, int $unused) use ($onChange) : void{
|
||||||
$onChange($inventory);
|
$onChange($inventory);
|
||||||
},
|
},
|
||||||
static function(Inventory $inventory) use($onChange) : void{
|
static function(Inventory $inventory) use ($onChange) : void{
|
||||||
$onChange($inventory);
|
$onChange($inventory);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -98,7 +98,7 @@ class ChunkCache implements ChunkListener{
|
|||||||
$chunkZ,
|
$chunkZ,
|
||||||
$this->world->getChunk($chunkX, $chunkZ),
|
$this->world->getChunk($chunkX, $chunkZ),
|
||||||
$this->caches[$chunkHash],
|
$this->caches[$chunkHash],
|
||||||
function() use($chunkX, $chunkZ){
|
function() use ($chunkX, $chunkZ){
|
||||||
$this->world->getLogger()->error("Failed preparing chunk $chunkX $chunkZ, retrying");
|
$this->world->getLogger()->error("Failed preparing chunk $chunkX $chunkZ, retrying");
|
||||||
|
|
||||||
$this->restartPendingRequest($chunkX, $chunkZ);
|
$this->restartPendingRequest($chunkX, $chunkZ);
|
||||||
|
@ -449,7 +449,7 @@ class NetworkSession{
|
|||||||
* @param bool $notify
|
* @param bool $notify
|
||||||
*/
|
*/
|
||||||
public function disconnect(string $reason, bool $notify = true) : void{
|
public function disconnect(string $reason, bool $notify = true) : void{
|
||||||
$this->tryDisconnect(function() use($reason, $notify){
|
$this->tryDisconnect(function() use ($reason, $notify){
|
||||||
if($this->player !== null){
|
if($this->player !== null){
|
||||||
$this->player->disconnect($reason, null, $notify);
|
$this->player->disconnect($reason, null, $notify);
|
||||||
}
|
}
|
||||||
@ -467,7 +467,7 @@ class NetworkSession{
|
|||||||
* @throws \UnsupportedOperationException
|
* @throws \UnsupportedOperationException
|
||||||
*/
|
*/
|
||||||
public function transfer(string $ip, int $port, string $reason = "transfer") : void{
|
public function transfer(string $ip, int $port, string $reason = "transfer") : void{
|
||||||
$this->tryDisconnect(function() use($ip, $port, $reason){
|
$this->tryDisconnect(function() use ($ip, $port, $reason){
|
||||||
$this->sendDataPacket(TransferPacket::create($ip, $port), true);
|
$this->sendDataPacket(TransferPacket::create($ip, $port), true);
|
||||||
$this->disconnect($reason, false);
|
$this->disconnect($reason, false);
|
||||||
if($this->player !== null){
|
if($this->player !== null){
|
||||||
@ -484,7 +484,7 @@ class NetworkSession{
|
|||||||
* @param bool $notify
|
* @param bool $notify
|
||||||
*/
|
*/
|
||||||
public function onPlayerDestroyed(string $reason, bool $notify = true) : void{
|
public function onPlayerDestroyed(string $reason, bool $notify = true) : void{
|
||||||
$this->tryDisconnect(function() use($reason, $notify){
|
$this->tryDisconnect(function() use ($reason, $notify){
|
||||||
$this->doServerDisconnect($reason, $notify);
|
$this->doServerDisconnect($reason, $notify);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -510,7 +510,7 @@ class NetworkSession{
|
|||||||
* @param string $reason
|
* @param string $reason
|
||||||
*/
|
*/
|
||||||
public function onClientDisconnect(string $reason) : void{
|
public function onClientDisconnect(string $reason) : void{
|
||||||
$this->tryDisconnect(function() use($reason){
|
$this->tryDisconnect(function() use ($reason){
|
||||||
if($this->player !== null){
|
if($this->player !== null){
|
||||||
$this->player->disconnect($reason, null, false);
|
$this->player->disconnect($reason, null, false);
|
||||||
}
|
}
|
||||||
@ -742,7 +742,7 @@ class NetworkSession{
|
|||||||
ChunkCache::getInstance($this->player->getWorld())->request($chunkX, $chunkZ)->onResolve(
|
ChunkCache::getInstance($this->player->getWorld())->request($chunkX, $chunkZ)->onResolve(
|
||||||
|
|
||||||
//this callback may be called synchronously or asynchronously, depending on whether the promise is resolved yet
|
//this callback may be called synchronously or asynchronously, depending on whether the promise is resolved yet
|
||||||
function(CompressBatchPromise $promise) use($chunkX, $chunkZ, $onCompletion){
|
function(CompressBatchPromise $promise) use ($chunkX, $chunkZ, $onCompletion){
|
||||||
if(!$this->isConnected()){
|
if(!$this->isConnected()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
|
|||||||
/** @var CommandEnum[] $enums */
|
/** @var CommandEnum[] $enums */
|
||||||
$enums = [];
|
$enums = [];
|
||||||
|
|
||||||
$addEnumFn = static function(CommandEnum $enum) use(&$enums, &$enumIndexes, &$enumValueIndexes){
|
$addEnumFn = static function(CommandEnum $enum) use (&$enums, &$enumIndexes, &$enumValueIndexes){
|
||||||
if(!isset($enumIndexes[$enum->getName()])){
|
if(!isset($enumIndexes[$enum->getName()])){
|
||||||
$enums[$enumIndexes[$enum->getName()] = count($enumIndexes)] = $enum;
|
$enums[$enumIndexes[$enum->getName()] = count($enumIndexes)] = $enum;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user