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

Void Kill message

Discussion in 'Development' started by BlueWhaleYT, Mar 11, 2020.

  1. BlueWhaleYT

    BlueWhaleYT Spider Jockey

    Messages:
    42
    GitHub:
    bluewhaleyt
    Hi there.
    I don't see any plugins regarding to Void Kill message.
    As the situation
    When "A" player punch "B" player to the void. It will show "B" player has punch to the void by "A" player.

    How I exactly implement it?
    Regards.
     
  2. Asanino

    Asanino Spider

    Messages:
    14
    PHP:
    public function onPlayerDeath(PlayerDeathEvent $e){

    $cause $e->getcause();
    if(
    $cause === EntityDamageEvent::CAUSE_VOID){
    //Code to be executed. Example:

    $this->getServer()->broadcastMessagge($e->getDamager(). "pushed "$e->getEntity(). "into the void");


     } 

    Didn't have time to test. But should do the work
     
  3. ExZe

    ExZe Silverfish

    Messages:
    21
    GitHub:
    mzztin
    I'm sure that this won't work, since $e->getDamager() the void is.

    Damager isnt a valid player so
     
  4. Asanino

    Asanino Spider

    Messages:
    14
    You're right. Actually i don't how to do that. Maybe adding an if($Damager instanceof Player). But i don't think this will work tough.
     
  5. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    You will need to save the last damager of the last EntityDamageByEntityEvent for every player (maybe in combination with a timestamp so it doesn't count every void-fall as a push)
     
    ExZe likes this.
  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.