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

PlayerItemConsumeEvent doesnt work properly

Discussion in 'Development' started by SVega, Sep 1, 2022.

  1. SVega

    SVega Spider

    Messages:
    13
    GitHub:
    svega9848
    When I use this event and try to send a message to a player when the item has a custom name, the item isnt consumed

    public function onConsume(PlayerItemConsumeEvent $e) {
    $player = $e->getPlayer();
    $item = $e->getItem();
    if($item->hasCustomName()) {
    $player->sendMessage("Test");
    }}

    This is the code, but it doesnt work right
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    749
    First of all, check if it's being executed. Are listeners registered?
     
  3. SVega

    SVega Spider

    Messages:
    13
    GitHub:
    svega9848
    The listener works perfectly when i dont use item conditions
     
  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.