-
Notifications
You must be signed in to change notification settings - Fork 1
Events
If there's an error at when a condition is checked, you most likely have a mistake in your condition (syntax).
All available events in the plugin's API are able to get some commands attached. These commands can be bound to conditions.
Each event has its own section in the events.yml file. An event can have a parent condition attached. This condition must be passed in order for the other conditions even to be checked.
Click here for a list of all events of Lands. Whenever a new event gets added, you need to manually configure it in events.yml, if you want to execute commands for it.
A condition supports the following operators:
-
&&
And -
||
Or -
==
Equals -
!=
Not equals -
!
Negation -
>=
Greater or equals (only applicable with numbers) -
>
Greater (only applicable with numbers) -
<=
Smaller or equals (only applicable with numbers) -
<
Smaller (only applicable with numbers)
Some events are called for different entities, where some variables might be null. Example: The "LandOwnerChangeEvent" can be called for an area, but also for a land. When called for a land, then all area_...
variables will be null. This allows you to differentiate if the owner was changed for a land or just an area (rental). Example:
condition: 'area_name != null' # called for an area
-
+
Addition -
-
Subtraction -
*
Multiplication -
/
Division
-
==
Equals -
!=
Not equals -
tolowercase("Text ABC")
will changeText ABC
totext abc
-
variable_or_text contains("text")
Contains text, whereasvariable_or_text
can be a variable or "text".
-
haspermission("permission")
Check if a player has a permission. Replacepermission
with a permission of your choice. You can specify a player by usinghaspermission([player_uuid, "permission"])
whereplayer_uuid
is a provided variable from the event that must end in "_uuid".
Text must be enclosed by quotation marks. Example:
condition: 'player_name=="Steve"'
The variables of each event can be viewed by enabling the logging.debug
option in config.yml.
You must invoke the event to print all variables and affected player groups to the console. PlaceholderAPI placeholders are supported for both player related conditions and commands, but not for cancellation conditions and general conditions that are not bound to a player group.
You can define a list of objects (including logical expressions) by surrounding them by []
and separating list items by ,
.
-
["aBc"] contains("aBc")
Contains -
tolowercase(["aBc"])
Turns["aBc"]
into["abc"]
Example:
condition: '["abc", "def"] contains(["abc"])' # = true
condition: '["abc", "def"] equals ["abc", "fed"]' = false
You can execute commands for different groups of players. These players may not be online at command execution.
Each player group can have multiple conditions with multiple commands attached. The condition is checked for every individual player that is part of this group. You can get the player's name or UUID by using this_name
and this_uuid
as a variable. Example:
land_online:
1:
condition: 'player_lands_own >= 0'
commands:
- 'say First condition with one command attached.'
2:
condition: '(player_lands_trusted <= player_lands_own + 2 && player_name=="Steve") || land_name=="Test"'
commands:
- 'say Second condition with one command attached.'
You can cancel an event by setting the condition at the cancel
option. Later, you can check if the event has been cancelled.
You might not want to run certain commands, when the event has been cancelled. Therefore, it's highly recommended to check the event cancellation. You can find an example below.
-
cancelled
- will equal true if the event has been cancelled by you or any 3rd party plugin -
cancelled_self
- will equal true, if the event has been cancelled by your condition.
LandOwnerChangeEvent:
cancel: 'reason=="UPKEEP"'
commands:
condition: 'cancelled == false && reason=="BOUGHT"'
groups:
player_self:
1:
condition: 'area_name != null' # purchased area
commands:
- 'msg Hello {owner_new_name}, you''ve purchased the area {area_name}.'
2:
condition: 'area_name == null' # purchased the whole land
commands:
- 'msg Hello {owner_new_name}, you''ve purchased the whole land {land_name}.'
land_online:
1:
condition: 'area_name == null' # purchased the whole land
commands:
- 'msg {player_name} The player {owner_new_name} is now the new owner of your land {land_name}.'
area_online:
1:
condition: 'area_name != null' # purchased area
commands: # {player_name} will be the player that is part of the "land_trusted" collection.
- 'msg {player_name} The player {owner_new_name} bought the area {area_name}.'