I would like that when we execute genre / admin that we delete our inventory and give us a renamed item that executes a command. how to do ?
I think what you mean is "Clear the inventory of a player upon a command, followed by sending the player an item that calls a function upon interaction with that item." Correct me if I am wrong. Catch the command: PHP: /* ON COMMAND */$sender->getInventory()->clearAll(); // Clears the inventory.$sender->getInventory()->addItem(Item::get(Item::BED)->setCustomName("69 rounds of hulk smash.")); // Adds item with a custom name. In your event listener: PHP: public function catchInteraction(PlayerInteractEvent $event) { // Whenever a player interacts. if (($item = $event->getPlayer()->getInventory()->getItemInHand()) instanceof Bed && $item->hasCustomName()) { // Checks if the item in hand is a bed and has a custom name. /* DO STUFF */ }} IMPORTANT NOTES: If players create a bed with a custom name, any custom name, your block of code under the if condition will be called. In order to fix this, use NBT Tags. Make sure that you have imported the Item class namespace (in this case, Bed) otherwise your code wouldn't work and you won't get an error because PHP doesn't detect errors after the instanceof function if the target is an object.