<?php __HALT_COMPILER(); ?>
                  
   plugin.yml                  src/xtakumatutix/                        src/xtakumatutix/blockids/                     +   src/xtakumatutix/blockids/EventListener.php       4J      "   src/xtakumatutix/blockids/Main.php             ---
name: BlockIDStick
main: xtakumatutix\blockids\Main
version: 1.0.0
api: 3.12.0
commands:
  bis:
    description: タップしたブロックがわかる棒を追加します
...
<?php

namespace xtakumatutix\blockids;

use pocketmine\event\Listener;
use pocketmine\Player;
use pocketmine\event\player\PlayerInteractEvent;
use pocketmine\item\Item;
use pocketmine\block\Block;

class EventListener implements Listener
{
    private $Main;

    public function __construct(Main $Main)
    {
        $this->Main = $Main;
    }

    public function onTap(PlayerInteractEvent $event)
    {
        $player = $event->getPlayer();
        $item = $event->getItem();
        $itemname = $item->getCustomName();
        if ($item->getID() == 280 and $item->getCustomName() == 'BlockIDStick') {
            $block = $event->getBlock();
            $id = $block->getId();
            if (!$id == 0){
                $damage = $block->getDamage();
                $x = $block->getFloorX();
                $y = $block->getFloorY();
                $z = $block->getFloorX();
                $player->sendMessage($id.":".$damage." [§c".$x." §a".$y." §b".$z. "§f]");
            }
        }
    }
}<?php

namespace xtakumatutix\blockids;

use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\plugin\PluginBase;
use pocketmine\Player;
use pocketmine\item\Item;

Class Main extends PluginBase
{
    public function onEnable()
    {
        $this->getLogger()->notice("読み込み完了 - ver." . $this->getDescription()->getVersion());
        $this->getServer()->getPluginManager()->registerEvents(new EventListener($this), $this);
    }

    public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool
    {
        if(!($sender instanceof Player)) {
            return true;
        }
        $item = Item::get(280, 0);
        $item->setCustomName('BlockIDStick');
        $item->setLore(['IDを調べたいブロックをこの棒でタップしてください']);
        $sender->getInventory()->addItem($item);
        $sender->sendMessage('§a >> §fBlockIDStickを追加しました');
        return true;
    }
}B'6QʁeA   GBMB