Skip to content

Commit

Permalink
Fix chunks being unloaded when playing a game
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergittos committed Mar 5, 2024
1 parent fd890c0 commit c45a1c6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/sergittos/bedwars/listener/GameListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
use pocketmine\event\player\PlayerMoveEvent;
use pocketmine\event\player\PlayerQuitEvent;
use pocketmine\event\server\DataPacketSendEvent;
use pocketmine\event\world\ChunkUnloadEvent;
use pocketmine\item\ItemTypeIds;
use pocketmine\item\MilkBucket;
use pocketmine\item\VanillaItems;
Expand Down Expand Up @@ -426,6 +427,13 @@ public function onQuit(PlayerQuitEvent $event): void {
}
}

public function onChunkUnload(ChunkUnloadEvent $event): void {
$game = BedWars::getInstance()->getGameManager()->getGameByWorld($event->getWorld());
if($game !== null and $game->getStage() instanceof PlayingStage) {
$event->cancel();
}
}

public function onExplosionPrime(EntityPreExplodeEvent $event): void {
$event->setRadius(5);
}
Expand Down

0 comments on commit c45a1c6

Please sign in to comment.