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

Armor Efects

Discussion in 'Facepalm' started by RecapTionsLater, Apr 29, 2017.

  1. RecapTionsLater

    RecapTionsLater Shog Chips

    Messages:
    0
    Hello pmmp team i usualy find out this stuff by my self but then i got stuck so i came here.
    So i was wondering what the code to get armoreffects is.
    Bassically lets say when i put on full gold i get regen strenght and speed and i looked all over the docs the only thing i found, or believe is right is the events that i am using. So if anyone can give me the code it will be very nice of you.
     
  2. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
  3. Lowkey

    Lowkey Slime

    Messages:
    94
    You can use EntityArmorChangeEvent and check if the player is wearing gold armour, like so:

    PHP:
    public function onArmor(EntityChangeArmorEvent $e){

    $entity $e->getEntity();
    //We now use if statements and check if $entity is an instanceof Player.

    if($entity instanceof Player){
    if(
    //Code to check helmet, chestplate and leggings goes here){
     
    Last edited: May 2, 2017
  4. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    It's actually EntityArmorChangeEvent, not EntityChangeArmorEvent. Not a big deal, but it could be misleading to others.
     
  5. Lowkey

    Lowkey Slime

    Messages:
    94
    *facepalming myself* edited!
     
  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.