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

getOriginalDamager, getDamage and getFinalDamage

Comments in 'Plugin Development' started by mamayadesu, Apr 24, 2015.

  1. mamayadesu
    Offline

    mamayadesu Active Member Plugin Developer

    Joined:
    Sep 19, 2013
    Posts:
    146
    Plugins:
    4
    Minecraft User:
    mamayadesu
    In what a difference between functions getDamage(), getFinalDamage() and getOriginalDamage()? Event EntityDamageEvent
  2. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    PHP:
    $event->getDamage(); //I think this is the damage that is dealt to the other player?
    $event->getFinalDamage(); //probably the damage after you have set it with $event->setDamage()
    $event->getOriginalDamage(); //equivalent to $event->getDamage() without having modified the damage
  3. mamayadesu
    Offline

    mamayadesu Active Member Plugin Developer

    Joined:
    Sep 19, 2013
    Posts:
    146
    Plugins:
    4
    Minecraft User:
    mamayadesu
    Thank you. But if I won't use setDamage(), getDamage() will = getFinalDamage() ?
  4. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    I'm not really sure.
    Last edited: Apr 24, 2015
  5. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    Damage gives you the amount of damage that the entity is inflicting. For example damage due to a stone sword vs a diamond sword. Final damage is the damage received by the entity after applying any defense modifiers ie armour. This is not fully implemented, last I checked.
    PEMapModder likes this.
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I tried to implement it, but due to one careless bug it didn't work. Actually if you used PocketMine 1.4.1 beta plus my RaRFix plugin, it should be implemented for all damage events from PocketMine.
  7. mamayadesu
    Offline

    mamayadesu Active Member Plugin Developer

    Joined:
    Sep 19, 2013
    Posts:
    146
    Plugins:
    4
    Minecraft User:
    mamayadesu
    So what function better for check damage which I got? getFinalDamage() ?
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    How are you using it?

Share This Page

Advertisement