1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Make A Menu On Player's Inventory

Discussion in 'Development' started by Bintang Putra, Jun 13, 2017.

  1. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    Hi, I want to make a menu on player's inventory.
    so, when the player clicked a block, then it will run a command. Like in the image Screenshot at Jun 13 09-27-34.png

    I curently using PlayerItemHeldEvent()
    PHP:
    public function onItemHeld(PlayerItemHeldEvent $event)
    {
        
    $player $event->getPlayer();
        if (
    $event->getItem()->getCustomName() == "TEST") {
            
    $player->sendTip(TextFormat::BOLD TextFormat::DARK_RED "Wow, You Choosed TEST");
        }
    }
    But, how we know when the player clicked the item in the air, or clicked the item while opening inventory
     
  2. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    use InventoryTransactionEvent or EntityInventoryChangeEvent
     
  3. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    I'll try it
     
  4. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    so how do i check what item he clicked?
     
  5. Lowkey

    Lowkey Slime

    Messages:
    94
    Use PlayerInteractEvent and check the ID, Name or instanceof and it's class.
     
  6. Kenn Fatt

    Kenn Fatt Slime

    Messages:
    82
    GitHub:
    kennfatt
    why you use sendTip :D it will be different on Pocket and Classic UI.
     
  7. 0x15f

    0x15f Baby Zombie

    Messages:
    145
    GitHub:
    0x15f
    Here's a great example of how to check which item was clicked "ChestShop" by @Muqsit
     
    Muqsit likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.