- Compatible API Versions
- 1.0.0
- Sourcecode
- https://github.com/Creeperface01/Holograms
Usage
First you have to create a new hologram instance by /hologram <hologram ID> (you cannot use "edit" or "update" as hologram ID)
if you want to edit/remove a hologram later use command /hologram edit - it will open a configuration UI where you can change its position, text etc. (This command automatically selects the nearest hologram to you.)
(For colors you can use '&' instead of '§')
Creating a new hologram
a) General tab
In general tab you can change the position of the hologram, autoupdate or remove it.
b) Text Settings
In "text settings" you can change/add new lines and translations
c) Grids
Since version 3.0 holograms support grids. To display hologram as a grid enable this in grid settings
1. Manual creation
You can make grids by writing the lines directly in the text window like that
which will be shown like
2. Grid sourcewhich will be shown like
For grids like leaderboards or some live statistics I recommend using grid source.
Grid source is in other words data provider for the grid. By default Holograms provide only MySQL grid source, but in the future I'll add more sources. Also new grid sources can be added by plugins.
Usage:
Grid source is in other words data provider for the grid. By default Holograms provide only MySQL grid source, but in the future I'll add more sources. Also new grid sources can be added by plugins.
Usage:
To use the grid source you must configure new grid in grids.yml configuration file.
Example:
Then in game in the grid settings fill grid source with the name of the configured grid in this case it's mysqlgrid
Normalize data - normalize the result of grid source for example result like "Tĥïŝ ĩš â fůňķŷ Šťŕĭńġ" will be changed to "This is a funky String"
Space between columns - defines the minimal spacing between two columns, 4 = 1 space character
Add grid header - in case of MySQL, that will show the name of mysql column above every grid column.
Column templates
Currently holograms contain some basic in-game customization of how data should be displayed, one of them is column template which you can set in grid settings. Using column templates you can change format of column or add a text before or after the column. Another customizations can be made on the mysql side by creating a view which I also recommend to use for displaying top statistics or any other form of showing the results.
In future updates I plan to add more ways to customize the source output and some other UI changes in general.
Example:
Code:
grids:
mysqlgrid: #name of the grid
source: mysql #source type
offset: 0 #data row offset in the grid source
limit: 10 #maximal count of rows loaded/displayed
refresh: 10 #the minimal interval in seconds when source will reload the data
data: #data for the specific grid source (mysql in this case)
columns: ["column1", "column3"] #can be omitted or left empty to select all the columns
table: gridtable #table or view to get data from
Normalize data - normalize the result of grid source for example result like "Tĥïŝ ĩš â fůňķŷ Šťŕĭńġ" will be changed to "This is a funky String"
Space between columns - defines the minimal spacing between two columns, 4 = 1 space character
Add grid header - in case of MySQL, that will show the name of mysql column above every grid column.
Column templates
Currently holograms contain some basic in-game customization of how data should be displayed, one of them is column template which you can set in grid settings. Using column templates you can change format of column or add a text before or after the column. Another customizations can be made on the mysql side by creating a view which I also recommend to use for displaying top statistics or any other form of showing the results.
In future updates I plan to add more ways to customize the source output and some other UI changes in general.
Configuration:
Code:
#distance between separate lines
lines_gaps: 0.3
#if hologram packets should be compressed asynchronously
async_batch: false
#how often should be holograms saved to config (in minutes)
save_interval: 5
Premissions
hologram.use - permission to use /hologram command
Translations
Holograms also provides basic support for multi languaged holograms which means every player can see different text. However this feature is dependent on another plugin/library which tells hologram what language player uses. There is not any public language plugin as I know so if you are a developer you can use simple API to get translations working
Placeholders
You can use placeholders in holograms to show some actual information on hologram. To enable this, install PlaceholderAPI plugin which provides that
Plugin API
Whole documented API can be found here
basic usage
PHP:
HologramAPI api = HologramAPI.getInstance(); //to get API instance
- get Hologram instance
- register new grids or grid sources