Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- publiс function onChunkLoad(ChunkLoadEvent $event){
- $chunk = $event->getChunk()
- $this->getServer()->getScheduler()->scheduleDelayedTask(new sendPacket($this, $chunk->getX(), $chunk->getY()), 2);
- }
- =================================================================================
- class sendPacket extends PluginTask{
- public $chunkX;
- public $chunkY;
- public function __construct(Main $plugin, $chunkX, $chunkY){
- parent::__construct($plugin);
- $this->chunkX = $chunkX;
- $this->chunkY = $chunkY;
- }
- public function onRun($currentTick){
- $pk = new \pocketmine\network\mcpe\protocol\UpdateBlockPacket;
- $pk->x = $this->chunkX * 16 + 8;
- $pk->y = 128;
- $pk->z = $this->chunkY * 16 + 8;
- $pk->blockId = 20;
- $pk->blockData = 0;
- $this->getOwner()->getServer()->broadcastPacket($this->getOwner()->getServer()->getOnlinePlayers(), $pk);
- }
- }
Advertisement