Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

player equipment change

Comments in 'Plugin Development' started by mclab, Apr 25, 2015.

  1. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    What event I should use for player equipment change?
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    You might want EntityArmorChangeEvent. Keep in mind that $event->getEntity() will return an Entity and not a Player. You will need to check and make sure that it is a player.
    PEMapModder likes this.
  3. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    Like this?

    PHP:
    public function inv(EntityArmorChangeEvent $event){
         
    $player $event->getEntity();
         if(
    $player instanceof Player){
           
    $player->sendMessage("Test");
         }
       }
    Last edited by a moderator: Apr 25, 2015
  4. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,707
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Looks good.
  5. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    But dont working :/
    No errors
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,306
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Did you mean changing the hotbar item or the armor?
  7. mclab
    Offline

    mclab Active Member

    Joined:
    Dec 24, 2014
    Posts:
    49
    Minecraft User:
    Dragonflex
    hotbar item.

Share This Page

Advertisement