Created
June 2, 2020 13:41
-
-
Save PJZ9n/0deb0ac3960600ff8d48066adc786687 to your computer and use it in GitHub Desktop.
原石破壊
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace Example; | |
use pocketmine\block\Block; | |
use pocketmine\event\block\BlockBreakEvent; | |
use pocketmine\event\Listener; | |
use pocketmine\plugin\PluginBase; | |
class Main extends PluginBase implements Listener | |
{ | |
public function onEnable() | |
{ | |
$this->getServer()->getPluginManager()->registerEvents($this, $this); | |
} | |
public function onBlockBreak(BlockBreakEvent $event) | |
{ | |
$player = $event->getPlayer(); | |
$name = $player->getName(); | |
$block = $event->getBlock(); | |
if ($block->getId() === Block::DIAMOND_ORE) { | |
$this->getLogger()->info("{$name}がダイヤ原石を破壊しました!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment