Skip to content

Commit

Permalink
SkullEntity: Removed occurence of overwriting a variable with a value…
Browse files Browse the repository at this point in the history
… of a different type
  • Loading branch information
ColinHDev committed Jun 6, 2022
1 parent 02833d8 commit 7c4fe72
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ColinHDev/CSkull/entities/SkullEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,12 @@ public function onChunkPopulated(int $chunkX, int $chunkZ, Chunk $chunk) : void
public function onBlockChanged(Vector3 $block) : void {
// This method is called when a block is changed with World::setBlockAt(), e.g. when a block is broken by an
// explosion. That's why we need to check if this entity can still exist on its position.
$block = $this->getBlockAtPosition();
if (!SkullEntityManager::isBlockValid($block)) {
$blockAtPosition = $this->getBlockAtPosition();
if (!SkullEntityManager::isBlockValid($blockAtPosition)) {
// It can be despawned as it's supporting skull block is broken.
$this->flagForDespawn();
// As the skull block was broken, we can also remove that row from the database.
$position = $block->getPosition();
$position = $blockAtPosition->getPosition();
DataProvider::getInstance()->deleteSkullByPosition(
$position->world->getFolderName(),
$position->x,
Expand Down

0 comments on commit 7c4fe72

Please sign in to comment.