Is there a plugin for this or would it be possible to make an easy plugin for show item id when choosing a item for hotbar? Im would really appriciate a plugin that shows item id next to item name when you select it for hotbar. That would make my life and probably some others life much easyer when making shops etc.. Takes ages when you need to look up ids on computer etc..
Not Possible to show item id next to name but it's possible to send popup with id: PHP: public function onItemHeld(PlayerItemHeldEvent $event){$item = $event->getItem();$player = $event->getPlayer();if($player->isOp()){ // Lets make it for ops only to not bother other players$player->sendPopup($item->getId()." ", 2);return true;}}
1. Use hasPermission instead of isOp 2. Use (string) instead of ." " to convert an integer into a string. 3. Just send the name with the ID.
1. isOp() and done, hasPermission() and register permission. 2. I was thinking about putting name after id. But as he asked only id i deleted $item->getName(). 3. '2.'
PHP: public function onItemHeld(PlayerItemHeldEvent $event){$item = $event->getItem();$player = $event->getPlayer();if($player->hasPermission('item.info')){ // Added permissions$player->sendPopup($item->getName()." ".$item->getId().":".$item->getDamage()." x".$item->getCount(), 2); // More info about item that is heldreturn true;}} plugin.yml: Code: permissions: items.info: default: OP description: " "
Something wrong : Code: Error: syntax error, unexpected 'public function onItemHeld' (T_STRING), expecting function (T_FUNCTION) File: /Aventcube-Server-master/src/AventCube/Main Line: 482 Type: E_PARSE THIS CRASH WAS CAUSED BY A PLUGIN Code: [473] [474] public function onBlockPlace(BlockPlaceEvent $event){ [475] $player = $event->getPlayer()->getName(); [476] if ($this->login[$player]<2){ [477] $event->setCancelled(true); [478] } [479] } [480] [481] [482] public function onItemHeld(PlayerItemHeldEvent $event){ [483] $item = $event->getItem(); [484] $player = $event->getPlayer(); [485] if($player->isOp()){ // Lets make it for ops only to not bother other players [486] $player->sendPopup($item->getId()." ", 2); [487] return true; [488] } [489] } [490] [491]
PHP: $sender->sendMessage("[Iditem]You are holding $inHandname ID $inHandid meta $inHandmeta"); Dumb message
I had this posted then deleted it thinking it wasn't what you where asking for. And it isn't. But you said you wanted it so you wouldn't have to look up item ID's on your computer. This plugin will give you the item ID, name, and meta of the item in the players hand. command: /iditem https://forums.pocketmine.net/threads/iditem-plugin.10069/#post-103207 sorry for blowing up your alerts If you think that message is dumb, check the message if you put in an argument. I have to update the argument message to just give the regular message even if they put in an argument. I mean, that is the point of the plugin. Unless you meant because...and Thanks PHP: $inHanditem = $sender->getInventory()->getItemInHand(); $sender->sendMessage("[Iditem] You are holding ".$inHanditem->getName()." ID ".$inHanditem->getId()." meta ".$inHanditem->getDamage());
Then use edit this line PHP: if($player->hasPermission('item.info')){ to PHP: if($player->isOp()){ // @PEMapModder dislike xD
I see my problem i registered permission "items.info" but i'm checking for "item.info" change plugin.yml: Code: permissions: item.info: default: OP description: " " And ignore my post above
Changed... but still it wont show ID next to name when i swape between items on hotbar.. use pocketmine\plugin\PluginBase; use pocketmine\event\player\PlayerItemHeldEvent as HoldEvent; use pocketmine\Player; do i need any else?
register listener add PHP: use pocketmine\event\Listener; and register Listener onEnable() PHP: public function onEnable(){$this->getServer()->getPluginManager()->registerEvents($this, $this);}
This appeared in console now.. [Server thread/NOTICE]: RuntimeException: "Argument 1 passed to pocketmine\plugin\PluginManager::registerEvents() must implement interface pocketmine\event\Listener, instance of MariusB\ItemID\main given, called in /home/mariusbjornor/MinecraftTestServer/plugins/ItemID/src/MariusB/ItemID/main.php on line 12 and defined" (E_RECOVERABLE_ERROR) in "/src/pocketmine/plugin/PluginManager" at line 698
Change PHP: class Main extends implements Listener{} And change your class name to ucfirst()! // set first letter to Capital