Conditions allow for bars or their modules to be hidden if they do not meet the criteria that is set. This feature was added in version 1.5.2. Previous versions had a system which used bar options to hide bars which is now removed. Old removed options will be automatically converted to the new conditions format.
Config Examples
In this example the entire bar will be hidden if the condition is not met. The condition will hide the bar if the player is in creative or spectator mode.
health:
bar:
width: 40
function: 'health'
conditions:
- 'gamemode{gm=creative,spectator;m=false}'
In this example the number display will be hidden if the condition is not met. The condition will only hide the specific part if not met. In addition to the displays, individual modules may also have conditions.
health:
bar:
width: 40
function: 'health'
displays:
icon:
enabled: true
type: 'prefix'
offset: 0
text: '\uF000'
number-display:
enabled: true
type: 'bar'
conditions:
- 'bar-progress{v=1;oper=less;m=true}'
alignment:
type: 'center'
offset: 2
text: '<white>%value%<gray>/<white>%max%'
Useful Conditions
Conditions | Old Option Equivalent | Description |
---|---|---|
gamemode{gm=creative,spectator;m=false} |
HIDE_WHEN_GAMEMODE |
This condition will be false when a player is in either creative or spectator mode. |
bar-progress{v=0;oper=greater;m=true} |
HIDE_WHEN_EMPTY |
This condition will be false when the bar is empty. |
bar-progress{v=1;oper=less;m=true} |
HIDE_WHEN_FULL |
This condition will be false when the bar is full. |
mounted{m=false} |
HIDE_WHEN_MOUNTED |
This condition will be false when the player is mounted. |
bar-inactive{m=true} |
HIDE_WHEN_INACTIVE |
This condition will be false when the bar is inactive. |
Conditions
Default Parameters
These parameters are included in every condition.
Parameter | Aliases | Description | Type | Default Value |
---|---|---|---|---|
match |
m, default, d |
What the condition will match to. This condition gamemode{gm=creative;m=true} will be true if the player is in creative, while this condition gamemode{gm=creative;m=false} will be false. |
Boolean | true |
Conditions | Description | Condition Type |
---|---|---|
bar-inactive | Used for bar inactivity. | Basic |
bar-progress | Used for detecting the progress of the bar. | Comparison |
effect | Used for detecting potion effects on the player. | Basic |
gamemode | Checks for a player's gamemode. | Basic |
mounted | Checks if a player is mounted on a living entity. | Basic |
placeholder | Used for making custom conditions. | Basic |
Comparison Conditions
Default Parameters
These parameters are included in every comparison condition.
Parameter | Aliases | Description | Type | Default Value |
---|---|---|---|---|
operator |
oper, op |
Which operator to use for comparing the values. | greater, g, equal, e, less, l |
N/A |
equalto |
et |
If set to true less or greater will also resolve as true if both of the values equal each other. |
Boolean | false |