mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Added PlayerPostChunkSendEvent (#4937)
this is primarily useful for debugging plugins, but could also be useful for other things, such as spawning fake blocks, particles, etc.
This commit is contained in:
parent
8b1bd5b7ff
commit
8b8560a701
44
src/event/player/PlayerPostChunkSendEvent.php
Normal file
44
src/event/player/PlayerPostChunkSendEvent.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\event\player;
|
||||
|
||||
use pocketmine\player\Player;
|
||||
|
||||
/**
|
||||
* Called after a player is sent a chunk as part of their view radius.
|
||||
*/
|
||||
final class PlayerPostChunkSendEvent extends PlayerEvent{
|
||||
|
||||
public function __construct(
|
||||
Player $player,
|
||||
private int $chunkX,
|
||||
private int $chunkZ
|
||||
){
|
||||
$this->player = $player;
|
||||
}
|
||||
|
||||
public function getChunkX() : int{ return $this->chunkX; }
|
||||
|
||||
public function getChunkZ() : int{ return $this->chunkZ; }
|
||||
}
|
@ -65,6 +65,7 @@ use pocketmine\event\player\PlayerJoinEvent;
|
||||
use pocketmine\event\player\PlayerJumpEvent;
|
||||
use pocketmine\event\player\PlayerKickEvent;
|
||||
use pocketmine\event\player\PlayerMoveEvent;
|
||||
use pocketmine\event\player\PlayerPostChunkSendEvent;
|
||||
use pocketmine\event\player\PlayerQuitEvent;
|
||||
use pocketmine\event\player\PlayerRespawnEvent;
|
||||
use pocketmine\event\player\PlayerToggleFlightEvent;
|
||||
@ -785,6 +786,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
|
||||
$this->getNetworkSession()->notifyTerrainReady();
|
||||
}
|
||||
(new PlayerPostChunkSendEvent($this, $X, $Z))->call();
|
||||
});
|
||||
},
|
||||
static function() : void{
|
||||
|
Loading…
x
Reference in New Issue
Block a user