No edit summary
m Slight rephrasing
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''Event Actions''', or simply ''events'', are a system in Housing that allow for chains of [[actions]] to be triggered on a player when they fire a certain event within the house, such as joining, dying, getting a kill or dropping an item.
'''Event Actions''', or simply ''events'', are a system in Housing that allow for chains of [[actions]] to be triggered on a player when they fire a certain event within the house, such as joining, dying, getting a kill or dropping an item.
Event Actions were added in 2021 alongside Local Stats, the precursor to [[stats|player stats]]. At the time, only Player Join, Player Death, Player Kill and Player Respawn were supported. As of 2024, there are 18 supported types of events.


== Actions ==
== Actions ==
Many events prevent certain actions from being added, such as how Group Change disables the action Change Player Group. This is likely to combat [https://en.wikipedia.org/w/Recursion recursion], a way to infinitely loop something.
Certain event actions prevent specific actions from being added, such as the action Change Player Group being blacklisted from the Group Changed event. This was likely implemented to prevent [[wikipedia:Recursion_(computer_science)|recursion]], a type of programming logic that allows code to call itself repeatedly.
 
Event Actions can hold up to 30 conditional actions in a single action chain as opposed to the default 15.
 
=== Cancelling events ===
Some events have the ability to be cancelled through the Cancel Event action, such as Player Drop Item. This will stop the event before it is triggered. For example, by cancelling the Player Damage event you will stop the player from taking damage.


== Conditions ==
The Player Block Break event only triggers when a block is ''not'' successfully broken, and thus does not have the action available.
Many Action Events support additional conditions within [[Conditionals]], allowing for actions to be run when an event is of a certain type or meets a certain criteria.  


=== Additional conditions ===
The [[Conditional]] action has extra conditions to choose from in certain event actions. Below are all of the added event action conditions that are not usable outside of their respective contexts.
{| class="wikitable sortable"
{| class="wikitable sortable"
|+ Additional conditions
|+
!Event Action
!Condition
!Description
!Notes
|-
|PvP Stage Change
|PvP Enabled
|Requires the PvP state to have changed to enabled from disabled.
|
|-
|-
! Condition !! class="unsortable" |Settings !! Action Event(s) !! class="unsortable" |Additional Notes
|Fish Caught
|Fishing Environment
|Check the type of environment that the player fished in.
|Lava Fishing requires the {{Command|lavaFishing|hideSlash=true}} [[Game Rules|game rule]] to be enabled.
|-
|-
| Pvp Enabled || - || Pvp State Change || -
|Player Enter Portal
|Portal Type
|Check the type of portal that was used by the player.
|Players in survival mode will trigger Nether Portals after 4 seconds, while creative mode is instant.
|-
|-
| Fishing Environment || Water or Lava || Fish Caught || Lava fishing requires the ''lavaFishing'' [[gamerule]] to be enabled.
|Player Damage
|Damage Cause
|Check the type of damage that was taken by the player.
|
|-
|-
| Portal Type || Nether Portal or End Portal || Enter Portal || Players in survival mode will enter a Nether Portal after 4 seconds.
|Player Damage
|Damage Amount
|Check the amount of damage that was taken by the player.
|
|-
|-
| Damage Cause || Various damage causes || Player Damage || -
|Player Block Break
|Block Type
|Check that the type of block that has been broken matches the item provided.
|
|-
|-
| Damage Amount || Comparator and Compare Value || Player Damage || -
|Player Block Break
|Within Region
|Requires the location to be within the selected region.
|The appearance is the same as the regular condition, but the behaviour takes the position of the block instead of the player.
|-
|-
| Block Type || Block Selector and Type Requirement Boolean || Player Break Block || -
|Player Drop Item
| rowspan="3" |Is Item
| rowspan="3" |Requires the item from the event to match the provided item.
| rowspan="3" |
|-
|-
| Within Region || Region Selector || Player Break Block || This condition replaces the standard ''Within Region'' condition, testing for the broken block's location rather than the player's.
|Player Pick Up Item
|-
|-
| Is Item || Item Selector, Metadata Boolean, Inventory Selector, and Required Amount || Player Drop Item, Player Pick Up Item, and Player Change Held Item
|Player Change Held Item
| -
|}
|}

Latest revision as of 02:32, 3 November 2024

Event Actions, or simply events, are a system in Housing that allow for chains of actions to be triggered on a player when they fire a certain event within the house, such as joining, dying, getting a kill or dropping an item.

Event Actions were added in 2021 alongside Local Stats, the precursor to player stats. At the time, only Player Join, Player Death, Player Kill and Player Respawn were supported. As of 2024, there are 18 supported types of events.

Actions

Certain event actions prevent specific actions from being added, such as the action Change Player Group being blacklisted from the Group Changed event. This was likely implemented to prevent recursion, a type of programming logic that allows code to call itself repeatedly.

Event Actions can hold up to 30 conditional actions in a single action chain as opposed to the default 15.

Cancelling events

Some events have the ability to be cancelled through the Cancel Event action, such as Player Drop Item. This will stop the event before it is triggered. For example, by cancelling the Player Damage event you will stop the player from taking damage.

The Player Block Break event only triggers when a block is not successfully broken, and thus does not have the action available.

Additional conditions

The Conditional action has extra conditions to choose from in certain event actions. Below are all of the added event action conditions that are not usable outside of their respective contexts.

Event Action Condition Description Notes
PvP Stage Change PvP Enabled Requires the PvP state to have changed to enabled from disabled.
Fish Caught Fishing Environment Check the type of environment that the player fished in. Lava Fishing requires the

/lavaFishing game rule to be enabled.

Player Enter Portal Portal Type Check the type of portal that was used by the player. Players in survival mode will trigger Nether Portals after 4 seconds, while creative mode is instant.
Player Damage Damage Cause Check the type of damage that was taken by the player.
Player Damage Damage Amount Check the amount of damage that was taken by the player.
Player Block Break Block Type Check that the type of block that has been broken matches the item provided.
Player Block Break Within Region Requires the location to be within the selected region. The appearance is the same as the regular condition, but the behaviour takes the position of the block instead of the player.
Player Drop Item Is Item Requires the item from the event to match the provided item.
Player Pick Up Item
Player Change Held Item