Fixed Size Tab List Displaying Players - CodeCrafter47/AdvancedTabOverlay GitHub Wiki
Now it is time to display players to the tab list.
This is done using the !players
component.
In the following you see a very simplistic example displaying players on the tab list using the !players
component.
showTo: "true"
priority: 1
showHeaderFooter: false
playerSets:
all_players: all
type: FIXED_SIZE
size: 80
defaultIcon: colors/black.png
defaultPing: 1000
components:
- !players
playerSet: all_players
playerComponent: "${player name}"
morePlayersComponent: "... and ${other_count} others"
The !players
tag tells the plugin that we want to use the !players
component at that position. After that tag we need to configure some options
for the !players
component.
Here we have a look at the three options of the !players
component used in the example above.
There are more options available.
Those are described in the Components wiki page.
-
The
playerSet
option selects which players to display on the tab list.If you want to change which players the tab list displays, e.g. so it only displays players in a specific group, do the following:
- Create a player set containing the players you want to display. Check out the Player Sets wiki page for more information.
- Set
playerSet
to the name of the player set you created in step i.
-
The
playerComponent
option controls the text displayed in player slots. You can use placeholders to display nicknames, prefixes and suffixes and otherwise change the appearance of the player name.Note that when using placeholders you should use the
player
variant of the placeholder. -
The
morePlayersComponent
option is a custom slot that is displayed if there is not enough space on the tab list to display all of the players:
When using the players component we can still use custom slots. Here is how it works:
showTo: "true"
priority: 1
showHeaderFooter: false
playerSets:
all_players: all
type: FIXED_SIZE
size: 80
defaultIcon: colors/black.png
defaultPing: 1000
components:
-
- {right: "&bWelcome"}
- "${viewer name}"
-
-
-
-
-
- !players
playerSet: all_players
playerComponent: "${player name}"
morePlayersComponent: "... and ${other_count} others"
And here is how it looks:
Let's see what happens if we add some custom slots below the !players
component like this:
showTo: all
priority: 1
playerSets:
all_players: all
type: FIXED_SIZE
size: 80
defaultIcon: colors/black.png
defaultPing: 1000
components:
-
- {right: '&bWelcome'}
- '${viewer name}'
-
-
-
-
-
- !players
playerSet: all_players
playerComponent: "${player name}"
morePlayersComponent: '... and ${other_count} others'
# Add four more custom slots here:
- "&eFour"
- "&emore"
- "&ecustom"
- "&eSlots"
The result of that modification is the following:
Not exactly what we want. Now need some way to tell the plugin to move the last
four custom slots to the bottom. To do that we need to use !spacer
component:
showTo: all
priority: 1
playerSets:
all_players: all
type: FIXED_SIZE
size: 80
defaultIcon: colors/black.png
defaultPing: 1000
components:
-
- {right: '&bWelcome'}
- '${viewer name}'
-
-
-
-
-
- !players
playerSet: all_players
playerComponent: "${player name}"
morePlayersComponent: '... and ${other_count} others'
# Add the !spacer component
- !spacer
# Add four more custom slots here:
- "&eFour"
- "&emore"
- "&ecustom"
- "&eSlots"
This is finally what we wanted:
But how does it work? The !spacer
component will occupy as many unused slots
as it can, which will force our four custom slots to be at the very bottom
of the tab list.
In this example we will use the !players
component twice to display staff separately from the other players.
For the purpose of this example we assume that all staff member have the tablist.staff
permission.
We create two player sets:
One called staff
which contains all players with the tablist.staff
permission.
And one called non_staff
which contains all players not have the tablist.staff
permission.
We use the !players
component twice. The first time with the staff
player set and the second time with the non_staff
player set.
Custom slots are used to clearly separate the two.
showTo: all
priority: 1000
showHeaderFooter: false
playerSets:
all_players: all
staff: ${player permission tablist.staff}
non_staff: ( !${player permission tablist.staff} )
type: FIXED_SIZE
size: 60
defaultIcon: colors/dark_gray.png
defaultPing: 1000
components:
- {text: "&cRank: &6${viewer vault_primary_group}", icon: "default/rank.png", ping: 0}
- {text: "&cPing: &6${viewer ping}ms", icon: "default/ping.png", ping: 0}
- {text: "&cTPS: &6${viewer server_tps}", icon: "default/server.png", ping: 0}
-
-
-
- {center: "&e&lāāāāāāāāāā"}
- {center: "&e&lStaff"}
- {center: "&e&lāāāāāāāāāā"}
- !players
playerSet: staff
playerComponent: "${player name}"
morePlayersComponent: {text: "&7... and &e${other_count} &7others", icon: "colors/gray.png", ping: 0}
- !table {} # Adding an empty table component will cause the next component to be in the leftmost column
-
-
-
- {center: "&e&lāāāāāāāāāā"}
- {center: "&e&lPlayers"}
- {center: "&e&lāāāāāāāāāā"}
- !players
playerSet: non_staff
playerComponent: "${player name}"
morePlayersComponent: {text: "&7... and &e${other_count} &7others", icon: "colors/gray.png", ping: 0}
- !spacer
-
-
-
- {text: "&6=============", icon: "colors/gold.png", ping: 0}
- {text: "&6=============", icon: "colors/gold.png", ping: 0}
- {text: "&6=============", icon: "colors/gold.png", ping: 0}
- {text: "&cTime: &6${time H:mm:ss}", icon: "default/clock.png", ping: 0}
- {text: "&cPlayers: &6${playerset:all_players size}", icon: "default/players.png", ping: 0}
- {text: "&cBalance: &6${viewer vault_balance}", icon: "default/balance.png", ping: 0}
The !players
component has more options that can used to customize its appearance further.
You can find out about configuring the player order on the Player Order page.
For all possible options of the components have a look at the Components page.