CommandHelper

CommandHelper

46.5k Downloads

get_scoreboard_name()

LadyCailinBot opened this issue ยท 2 comments

commented

CMDHELPER-2861 - Reported by VergilPrime

1 or two arguements, name and [scoreboard]. Retrieves the formatted name that appears in the tablist/above head which includes the prefix and suffix added by the player's team.

commented

Comment by PseudoKnight

This is functionally get_teams() with a bit of logic.

  foreach(get_teams(@scoreboard), @team,
    if(array_contains(@team['players'], @player)) {
      return(@team['prefix'].@player.@team['suffix'])
    }
  )
)```

A get_team(@player) function would reduce the complexity of this and many other scripts that use the scoreboard for team games.
commented

Comment by PseudoKnight

Added get_pteam(player, [scoreboard]).