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

Enchantment not Working

Discussion in 'Development' started by QuiverlyRivalry, Mar 23, 2020.

  1. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    My code: https://hasteb.in/asadotuj.php
    Problem: For some reason it skips the whole add enchantment and then execute the sendMessage test. Check the video the code above shows that when it’s run it adds enchant and sends message test, but in the video it doesn’t add anything but still sends message??

     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    You will need to put the newly enchanted item in the player's hand:
    PHP:
    $player->getInventory()->setItemInHand($item);
     
    GamakCZ and QuiverlyRivalry like this.
  3. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    It works. Thanks so much :DDD!
     
    HimbeersaftLP likes this.
  4. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    No problem! Your plugin looks very cool so far!
     
  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.