Skip to content
Tanguy edited this page Sep 24, 2024 · 35 revisions

Download

You can download the expansion on PlaceholderAPI's eCloud at https://api.extendedclip.com/expansions/playerlist/

Usage:

Config examples and Placeholder Syntaxes

Head over to PlaceholderAPI's config file and search for the playerlist section

  • playerlist:
      # Text shown when the index is out of range
      offline-text: "Offline"
      # Separator for filters such as PERMISSION, WORLD and PLACEHOLDER
      argument-separator: ','
    
      # Here's where you defined all your lists
      lists:
        # The name of this list is "staff"
        staff:
          # We only want online staff members
          type: ONLINE
          # If we're part of the list, we want to be included
          included: true
          filters:
          # Does the player have the group.staff permission? 
          - PERMISSION:group.staff
          # Can you see the player? (usually managed by vanish plugins)
          - CANSEE
        all:
          # We want all players that ever joined the server
          type: ALL
          included: true
          sorting-types:
            # Sorting players that are online first
            - PLACEHOLDER:%player_online%:yes,no
        custom:
          type: CUSTOM
          # Your custom list of elements (supports placeholders)
          input: "4, 2, 9, 5"
          # Character(s) that separates each element in the input
          separator: ", "
          # Filters are supported if the input contains player names.
          sorting-types:
            # Sorting elements starting with the lowest number (in this case: 2, 4, 5, 9)
            - LOW_TO_HIGH
  • %playerlist_<name>_<list|amount|#>% (see Output Types

Types:

  • ALL - Matches all players
  • ONLINE - Matches online players
  • OFFLINE - Matches offline players

Filters:

Filters Description Valid Lists Note
PERMISSION:<permission> Matches all players that have the defined permission ONLINE Supports multiple permissions separated by , (Ex: perm1,perm2)
WORLD:<world> Matches all players in the specified world ONLINE Supports multiple worlds separated by , (Ex: world1,world2)
NEARBY:<distance> Matches all players in the defined radius in blocks Online
WHITELISTED Matches all players in the whitelist. ONLINE, OFFLINE, ALL
BANNED Matches all players banned from the server OFFLINE ONLINE and ALL type work but for obvious reason don't exactly matter
CANSEE Matches all players you can see ONLINE This feature checks players which aren't hidden from you in game by other plugins such as vanish plugins.
PLACEHOLDER:<input1>=<output1>,<input2>=<output2>,... Matches all players which the placeholder defined in the input returns the specified output (only 1 condition must be met by the player) ONLINE, OFFLINE, ALL Not all placeholders support offline players, this is not an issue with this expansion but with the author of the placeholder's expansion. I can't do anything about that.
VERSION:<protocolVersion> Matches all players with the version specified Online To specify versions, you have to use the Version Numbers defined here. Supports multiple versions separated by a + and range of versions with - (both can be mixed!) Ex: ver1-ver3+ver5. Requires ViaVersion.
GAMEMODE:<gamemode> ONLINE List of online players in the specified gamemode

Sorting Types:

Types Description
A_TO_Z:<placeholder> Sorts alphabetically
Z_TO_A:<placeholder> Sorts reverse alphabetically
LOW_TO_HIGH:<placeholder> Sorts numerically
HIGH_TO_LOW:<placeholder> Sorts reverse numerically
PLACEHOLDER:<placeholder>:<output1>,<output2>,... Sorts by the placeholder's output in the defined order

Note: Aside from the PLACEHOLDER sorting type, when no placeholder is provided, the name of the player/element of the custom list will be used instead.

Output Types:

  • list - Returns a list of players separated by ,
  • amount - Returns amount of players matched
  • <number> - Returns the player at the specified index, starts from 0.

Examples:

List of players in group

If you're using LuckPerms (which most people do and should), you can easily check if a player has a group by checking the group. permission.
Head over to your PlaceholderAPI config.yml file and find the playerlist section, then add the following:

  playerlist:
    lists:
      my_awesome_group_list:
        type: ONLINE
        included: true
        filters:
        - PERMISSION:group.<groupName>
        - CANSEE

Now you can use %playerlist_my_awesome_group_list_amount% to get the amount of players that have your group! (don't forget to replace <groupName> by your actual group without the <>, you can also change my_awesome_group_list to whatever you want)
Note: Players with OP or the * permission will always be included, as well as people that have multiple groups.
If you instead want the player's primary group or just not include OP/* permission, or you're using another plugin aside from LuckPerms, use the PLACEHOLDER filter and check if %vault_group% is equal to your group (e.g. replace the PERMISSION:group.<groupName> line by PLACEHOLDER:%vault_group%=<groupName>)

List of players in a WorldGuard region

This requires the WorldGuard expansion to be installed

  playerlist:
    lists:
      spawn:
        type: ONLINE
        included: true
        filters:
        - PLACEHOLDER:%worldguard_region_name%=spawn
        - CANSEE