Skip to content

Commit

Permalink
Do some minor changes from last commits
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergittos committed Jan 24, 2024
1 parent 641e2ff commit 00b4cd2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/sergittos/bedwars/game/stage/PlayingStage.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ public function onQuit(Session $session): void {
$session->resetSettings();
$session->setTrackingSession(null);

if ($session->getTeam() !== null) {
if($session->hasTeam()) {
$team = $session->getTeam();
$team->removeMember($session);
if (!$team->isAlive()) {
if(!$team->isAlive()) {
$this->game->broadcastMessage("{BOLD}{WHITE}TEAM ELIMINATED > {RESET}" . $team->getColoredName() . " Team {RED}has been eliminated!");
}
}
Expand Down
19 changes: 8 additions & 11 deletions src/sergittos/bedwars/listener/GameListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,14 @@ public function onPlace(BlockPlaceEvent $event): void {
return;
}

foreach ($event->getTransaction()->getBlocks() as [$x, $y, $z, $block]) {
if ($block instanceof TNT) {
$world = $block->getPosition()->getWorld();
if ($world !== null && $world->isLoaded()) {
BedWars::getInstance()->getScheduler()->scheduleDelayedTask(new ClosureTask(function () use ($block) {
// Ensure the world is still loaded when the task runs
if ($block->getPosition()->getWorld() !== null) {
$block->ignite(60);
}
}), 1);
}
foreach($event->getTransaction()->getBlocks() as [$x, $y, $z, $block]) {
if($block instanceof TNT) {
BedWars::getInstance()->getScheduler()->scheduleDelayedTask(new ClosureTask(function () use ($block) {
$world = $block->getPosition()->world;
if($world !== null and $world->isLoaded()) {
$block->ignite(60);
}
}), 1);
continue;
}
$session->getGame()->addBlock($block->getPosition());
Expand Down

0 comments on commit 00b4cd2

Please sign in to comment.