Miscellaneous

Less important but interesting topics.

Subsections of Miscellaneous

Variable

  • 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.
  • You can use /getvariables 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>
  • There are variables are generated by the menu.
  • To use variables from another menu: {menu_<menu_name>.yml_<variable>
    • Example: If you use Store Argument Processor in a menu called test.yml and want to use {merged_args} in other menus, you can use {menu_test.yml_merged_args}

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%

Message Color

Basic Color

  • Some options that accepts a string can also support colors in that string
  • You can use colors to “colorize” the string. If you have been using other plugins that interact with messages and texts, you may be familiar with some color characters (&c, &b, etc) or a combination of color and transformation (&c&l, &b&o&l, etc).
  • Color codes
  • You can use &u to get the random color for the text

HEX Color

  • After the 5.0 update, BetterGUI now supports HEX color (the thing with 3 Red Green Blue values) in texts and messages.
  • You can use it by using the HEX format &#rrggbb (rr, gg and bb are the value of the red, green and blue channel of the color, from 00 to FF)
  • For example, &#FF0000 represents the red color. &#FF0000Hello World! will return the red Hello World!
  • HEX Color

Click Type

  • You may notice, in the example menu, there are some weird values in command (action) and click-requirement.
  • What are those left, right, middle and default?
  • Those are called Click Type. It indicates the different behaviors of the button on different click types (left-click, right-click, middle-click, etc).
  • List of Click Type
  • Along with the click types, you can set a default click type, whose behaviors will be set on all available click types.

In action

COMMAND:
  LEFT: "tell: &cYou left-clicked"
  RIGHT: "tell: &cYou right-clicked"
  MIDDLE: "tell: &cYou middle-clicked"
  # Default for every click types
  DEFAULT:
    - "tell: &cUnknown click type"
    - "tell: Left, Right, Middle only"

In click-requirement

click-requirement:
  left:
    test:
      cooldown: 10
  right:
    test:
      cooldown: 20
  middle:
    test:
      cooldown: 30
  default:
    test:
      cooldown: 40
    fail-command:
      - "tell: &cCalm down"

NUMBER_KEY with number key

  • The format: NUMBER_KEY_<0-8>
  • You can set the NUMBER_KEY click type with a number key (from 0 to 8, specify the 1 to 9 number key)
  • This requires use-modern-click-type to be enabled