Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
Fixed: Call to undefined method pocketmine\event\block\BlockPlaceEven…
Browse files Browse the repository at this point in the history
…t::getBlock()
  • Loading branch information
NhanAZ committed Jun 4, 2023
1 parent 32b7087 commit 1ae895d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/NhanAZ/BlockData_Example_Plugin/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace NhanAZ\BlockData_Example_Plugin;

use NhanAZ\BlockData\BlockData;
use pocketmine\block\Block;
use pocketmine\block\VanillaBlocks;
use pocketmine\event\block\BlockBreakEvent;
use pocketmine\event\block\BlockPlaceEvent;
Expand Down Expand Up @@ -43,9 +44,12 @@ public function onPlayerInteract(PlayerInteractEvent $event): void {
* @priority HIGH
*/
public function onBlockPlace(BlockPlaceEvent $event): void {
$block = $event->getBlock();
if ($block->isSameType(VanillaBlocks::GLASS())) {
$this->blockdata->setData($block, "durability:4");
$blocks = $event->getTransaction()->getBlocks();
foreach ($blocks as [$x, $y, $z, $block]) {
if (!$block instanceof Block) return;
if ($block->isSameType(VanillaBlocks::GLASS())) {
$this->blockdata->setData($block, "durability:4");
}
}
}

Expand Down

0 comments on commit 1ae895d

Please sign in to comment.