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

How to change damage type of pearls?

Discussion in 'Help' started by artulloss, Mar 28, 2018.

  1. artulloss

    artulloss Witch

    Messages:
    63
    GitHub:
    artulloss
    Why I need to do this: I disable fall damage on my server so players can jump down into maps. I currently edit the phars to do this, however this makes updates very hard. How could I change this using a plugin?
     
  2. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
  3. artulloss

    artulloss Witch

    Messages:
    63
    GitHub:
    artulloss
    We have a no fall damage plugin, and I even wrote an iprotector edit allowing to disable fall damage in a certain area, the problem is all 3 of these work by disabling fall damage like so:

    if($ev->getCause() === EntityDamageEvent::CAUSE_FALL) {
    $ev->setCancelled();
    }

    This is the correct way to this however pocketmine defaultly sets pearls to the fall damage type. A simple work around is editing a the phar to change the damage type to something other than fall damage allowing the no fall damage and the pearl damage to not conflict. I need a way to achieve the same effect with a plug-in, because I'd like to be able to keep my server up to date easily.
     
  4. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    are you talking about ender pearl damage?
     
  5. artulloss

    artulloss Witch

    Messages:
    63
    GitHub:
    artulloss
  6. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    the only possible way to do that would be to either check if an EntityTeleportEvent has been triggered immediately before the EntityDamageEvent. (or if a sound has been added at that location, but that is a bit overcomplicated)
    This is quite a hack solution, but should work well.
     
  7. artulloss

    artulloss Witch

    Messages:
    63
    GitHub:
    artulloss
    Ah I see, would it be more efficient server load wise to just edit the phar?
     
  8. korado531m7

    korado531m7 Slime

    Messages:
    77
    GitHub:
    korado531m7
    i think, get fron projectilehitevent and check whether player has ender pearl, if so set cancelled (on entitydamageevent) or heal.
     
  9. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    wait, he wants to disable fall damage but KEEP pear damage
     
    artulloss likes this.
  10. artulloss

    artulloss Witch

    Messages:
    63
    GitHub:
    artulloss
    Yea, is there any benefit having the damage reason fall damage over anything else for pearls? My only problem is I'm having trouble making phars to update my server and I like to update about every other week as long as it doesn't break anything, keeps it easier to know what needs to be updated/already is updated when the next major update comes out.
     
  11. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
    as per vanilla, ender pearl damage is intended to be treated as fall damage (hence why feather falling enchantment reduces it and such).
     
    artulloss likes this.
  12. artulloss

    artulloss Witch

    Messages:
    63
    GitHub:
    artulloss
    Yea I get that, it's fine it's easy to compile from source anyways.
     
  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.