Variable

Description

  • Variable (or sometimes Placeholder) is a special string that will be replaced to a value that is relative to the player.
  • Variables can be seen as the string inside curly brackets {}. We will see some of these variables in the next section.
  • An admin can use the command /getvaraibles to get the list of registered variables
  • You can use variables in your text by putting them in curly brackets. For example, Hello {player}! will say hello to the player, with {player} replaced to the player's name.

Built-ins

  • {player} returns the player's name
  • {uuid} returns the unique id of the player
  • {online} returns the number of online players
  • {max_players} returns the max capacity of players in the server
  • {world} returns the current world of the player
  • {world_env} returns the environment of the current world of the player
  • {x} returns the current X position of the player
  • {y} returns the current Y position of the player
  • {z} returns the current Z position of the player
  • {bed_world} returns the current world of the player's bed
  • {bed_world_env} returns the environment of the current world of the player's bed
  • {bed_x} returns the current X position of the player's bed
  • {bed_y} returns the current Y position of the player's bed
  • {bed_z} returns the current Z position of the player's bed
  • {exp} returns the experiences (XP) of the player
  • {level} returns the level of the player
  • {exp_to_level} returns the required XP to go to the next level
  • {food_level} returns the food level of the player
  • {ip} returns the IP address of the player
  • {biome} returns the current biome in the player's current location
  • {ping} returns the latency of the player's connection
  • {random_<i>} or {random_<i1>:<i2}} returns a random number from 0 to <i>, or from <i1> to <i2>
  • Variables start with menu_ are called Menu Variables.
  • Those variables are generated by the menu.
  • To use variables from another menu: {menu_<menu_name>.yml_<variable>
    • Example: If you use Args Menu in a menu called test.yml and want to use {merged_args} in other menus, you can use {menu_test.yml_merged_args}

Hook to PlaceholderAPI

  • You can use placeholders from PlaceholderAPI in your text.
  • You can also use variables from BetterGUI to other plugins via PlaceholderAPI
  • The format for this is %bettergui_<variable>% (<variable> is a variable without the curly brackets {})
  • For example, this is the placeholder to use {player} in other plugins: %bettergui_player%