Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

BasicHUD 1.0.6

A configurable heads up display

Configuration
Configuration is through the config.yml file. The following sections are defined:

main
  • ticks: How often to refresh the popup
  • format: Display format
Permission Nodes
  • basichud.user : Allow players to have an HUD
  • basichud.cmd : Allow players to access HUD command
  • basichud.cmd.toggle : Allow players to toggle HUD on/off
  • basichud.cmd.switch : Allow players to switch formats (Defaults to Op)
Configured Formats
The displayed text can be:

  • A fixed string.
  • A string containing {variables}
  • A string containing <?php and <?=. This allows you to embed arbitrary PHP code in the format. This is similar to how web pages are done.
The default variables are:

  • {BasicHUD}
  • {MOTD}
  • {tps}
  • {player}
  • {world}
  • {x}
  • {y}
  • {z}
  • {yaw}
  • {pitch}
  • {bearing}
  • {10SPACE}
  • {20SPACE}
  • {30SPACE}
  • {40SPACE}
  • {50SPACE}
  • {NL}
  • {BLACK}
  • {DARK_BLUE}
  • {DARK_GREEN}
  • {DARK_AQUA}
  • {DARK_RED}
  • {DARK_PURPLE}
  • {GOLD}
  • {GRAY}
  • {DARK_GRAY}
  • {BLUE}
  • {GREEN}
  • {AQUA}
  • {RED}
  • {LIGHT_PURPLE}
  • {YELLOW}
  • {WHITE}
  • {OBFUSCATED}
  • {BOLD}
  • {STRIKETHROUGH}
  • {UNDERLINE}
  • {ITALIC}
  • {RESET}
You can add more variables by creating a vars.php in the plugin directory. For your convenience, there is vars-example.php available that you can use as a starting point. Copy this file to vars.php.

The example vars.php will create a{score}and{money}variable if you have the relevant plugins.

By default, if you have SimpleAuth installed, the HUD will be inactive until you log-in. If you are using something other than SimpleAuth you can copy the message-example.php to message.php and do whatever checks you need to do.

Multi-Format options
BasicHUD supports multiple formats. These can be configured through the config.yml. So instead of format only having one format configured, you can configure multiple, like this example:

Code:
format:
   lv3: '{GREEN}{BasicHUD} {YELLOW}Lv3 {WHITE}{world} ({x},{y},{z}) {bearing} {RED}EUR:{money} Pts:{score}'
   lv2: '{GREEN}{BasicHUD} {GREEN}Lv2 {WHITE}{world} ({x},{y},{z}) {bearing} {RED}EUR:{money} Pts:{score}'
   lv1: '{GREEN}{BasicHUD} {BLUE}Lv1 {WHITE}{world} ({x},{y},{z}) {bearing} {RED}EUR:{money} Pts:{score}'
   lv0: '{GREEN}{BasicHUD} {GRAY}Lv0 {WHITE}{world} ({x},{y},{z}) {bearing} {RED}EUR:{money} Pts:{score}'
In this example, four formats are defined. To select the format, BasicHUD will test permissions in order until the player has the permission:

  • basichud.rank.selector
So if the player wants to use format lv2, permission basichud.rank.lv2 is required. For multiple matches, the first match is used. If none matches, the last format is used.

Switching formats is not saved. So on join the player always gets the default format. If you want HUD format choices to be saved you need a permissions plugin.

API
Since BasicHUD takes over the built-in sendPopup functionality, it provides a replacement function for it. To use it you need this fragment of code:

PHP:
if (($hud $this->getServer()->getPluginManager()->getPlugin("BasicHUD")) !== null) {
  
$hud->sendPopup($player,$msg);
} else {
  
$player->sendPopup($msg);
}
Advertisement