-
Notifications
You must be signed in to change notification settings - Fork 0
Criteria
The OR criteria is quite powerful in creating advanced conditions.
Normally, when combining criteria, it means you need to meet all the criteria.
However, utilizing the OR criteria, it allows you to add other criteria as its children, and only checks if you meet one of the children criteria to satisfy the parent OR criteria.
criteria:
- type: OR
children:
- type: PERMISSION
permission: 'some.permission'
- type: PERMISSION
option: 'other.permission'The permission criteria will most likely be the most used criteria.
You can define any permission for a scoreboard's criteria.
criteria:
- type: PERMISSION
permission: 'example.permission'
default: trueThe permission specified is the required permission the player must have to meet the criteria.
default is optional, and defaults to false if not specified. If default is true, then the criteria will be met if even if they don't have the permission. If default is true, you must negate the permission from the player if you don't want them to meet the criteria.
The event criteria is another powerful criteria.
This allows you to display scoreboards when specific events are triggered!
The most simple examples are the join and combat scoreboards.
criteria:
- type: EVENT
event: 'org.bukkit.event.player.PlayerJoinEvent'
event-player: 'getPlayer'
stay-seconds: 6event is the event the criteria is listening for. You must use the full package of the event. You may use any plugin's custom events as well.
event-player is the event's method that will return the player.
stay-seconds determines how long the scoreboard will stay up.
Above is an example of a criteria listening for the PlayerJoinEvent.
What happens is, the player will meet this criteria once they join the server, and it will stay up for 6 seconds.
You can also use variables to get different information from the event!
The syntax for an event variable is {event.<eventName>.<method>}.
You can call multiple methods.
For example: {event.EntityDamageByEntityEvent.getDamager.getName}
getDamager and getName are both methods.
Furthermore, if the method you input returns null, you can include a value to fall back to.
Syntax: {event.<eventName>.<method>:[fallback]}
Example: {event.PlayerJoinEvent.getPlayer.getName:%player_name%}
In the example, if getPlayer.getName returns null, it will display %player_name% instead (which is a PlaceholderAPI placeholder).
The combat scoreboard example showcases some variables being used.