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

How would I code up a tip death messages?

Discussion in 'Plugin Help' started by doopiness, Dec 5, 2020.

  1. doopiness

    doopiness Creeper

    Messages:
    1
    GitHub:
    doopiness
    Basically slightly on top of the inventory, the message would be like
    "§c{player} §fwas killed by §c{player} !"
    or "§c{player} §fell into the void !}"
    so to basically just move the death messages slightly above the middle of the inventory.
     
  2. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    PHP:
    public function onPlayerDeath(PlayerDeathEvent $event){
            
    $entity $event->getEntity();
            if(
    $entity instanceof Player){
                     
    $event->setMessage("");
                     foreach(
    $this->plugin->getServer()->getOnlinePlayers() as $player){
                                
    $player->sendTip($entity->getName()." Died in a hole!");
                     }
             }
    }
     
    Last edited: Dec 7, 2020
  3. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Mark prefix as solved :D
     
  4. Pqoster

    Pqoster Spider Jockey

    Messages:
    25
    wouldn't it be easier to use $this->getServer ()->broadcastTip()?
     
    minijaham likes this.
  5. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Yes, I just noticed that broadcastTip() was a thing.
    It is easier but they function the same :l
     
  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.