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

Plugin to modify attribute

Discussion in 'Requests' started by Nairod92, Mar 1, 2020.

  1. Nairod92

    Nairod92 Creeper

    Messages:
    5
    Hello,

    I am looking for a plugin to change attribute of an items.
    For example : I want a bone to deal 10 attack damage.

    Thank you in advance
     
  2. amirTBM

    amirTBM Spider Jockey

    Messages:
    27
    GitHub:
    we
    you have to edit it from pocketmine src
     
  3. Nairod92

    Nairod92 Creeper

    Messages:
    5
    Where in src?
     
  4. amirTBM

    amirTBM Spider Jockey

    Messages:
    27
    GitHub:
    we
    2 ways : 1. extract pocketmine with devtools and edit it then make it phar with devtools
    2. download pocketmmine mp config from github then make it phar with devtools and put it in you folder
     
  5. Nairod92

    Nairod92 Creeper

    Messages:
    5
    Okey but what do I have to do in the phar?
     
  6. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    Or use EntityDamageEvent
     
  7. Nairod92

    Nairod92 Creeper

    Messages:
    5
    How ?
     
  8. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    PHP:
    public function onDamage(EntityDamageEvent $event){
        if(
    $event->getEntity() instanceof Player){
            
    $player $event->getEntity();
            if(
    $player->getInventory()->getItemInHand()->getId() === Item::BONE){
                
    $event->setBaseDamage(10);
            }
        }
    }
     
    Last edited: Mar 1, 2020
    GamakCZ likes this.
  9. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    PHP:
    public function onDamage(EntityDamageEvent $event){
        
    $player $event->getEntity();
        if(
    $player instanceof Player){       
            if(
    $player->getInventory()->getItemInHand()->getId() === Item::BONE) {
                
    $event->setBaseDamage(10);
            }
        }
    }
    If you use just 1 = , return is always true
     
    NTT likes this.
  10. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    My bad :p
     
  11. Nairod92

    Nairod92 Creeper

    Messages:
    5
    Thank you
    Where I have to copy paste this? In the src/entity/entitydamageevent ?
     
  12. amirTBM

    amirTBM Spider Jockey

    Messages:
    27
    GitHub:
    we
    src\pocketmine\item\any item you want
     
  13. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    To some class with registered Listener interface...
     
  14. GamakCZ

    GamakCZ Zombie Pigman

    Messages:
    598
    GitHub:
    GamakCZ
    Nope this, won't work :facepalm:
     
  15. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    I agree with Gamakcz
     
  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.