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

Updating nametag in some period of time

Discussion in 'Development' started by Levi, Jun 18, 2018.

  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    I use purechat for nametags and i modified it to have {kills} in nametags. But when i get kills, it doesn't update. Is there any way to do something that updates the kills every amount of time? Like how pureperms do it there's GroupChangeEvent
     
  2. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Use task to update name
     
  3. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    That lag
     
  4. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Do you store player kills somewhere?
     
  5. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    yep in array
     
  6. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    So, after you update the array, just...
    PHP:
    $player->setNameTag(str_replace("{KILLS}"$kills$player->getNameTag()));
     
  7. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Will this use too much resources since it update nametag every kill ?
     
  8. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    DataPropertyManager updates are bundled and scheduled every tick, it's already well-optimized. You should be fine.
     
    xXNiceAssassinlo YT 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.