Skip to content

Commit

Permalink
fixing crash when chunk not loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
tgwaste committed Jul 12, 2023
1 parent 37d58d0 commit b6dee7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Weather
version: 2.0.2
version: 2.0.3
main: tgwaste\Weather\Main
api: 5.0.0
author: tgwaste
Expand Down
5 changes: 5 additions & 0 deletions src/tgwaste/Weather/Weather.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ public function sendLightning() {

$x = (int)$location->x + $dist1[mt_rand(0, 1)];
$z = (int)$location->z + $dist2[mt_rand(0, 1)];

if (!$world->isChunkLoaded((int)$x, (int)$z) || !$world->isChunkLocked((int)$x, (int)$z)) {
return;
}

$y = $world->getHighestBlockAt((int)$x, (int)$z);

if ($y === null) {
Expand Down

0 comments on commit b6dee7e

Please sign in to comment.