m Slight rephrasing
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Stub}}
'''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''' are a [[Systems|System]] in Housing that allow for [[Actions|Action]] chains to be ran on a player the moment an event happens, such as joining the house, dying, killing another player, or dropping an item. There are currently 18 Event Actions in Housing.
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 Action Events limit the selection of [[Actions]] you can add to them, such as the ''Group Change'' Action Event limiting the use of the ''Change Player's Group'' Action. This prevents the use of infinite loops(recursion) within Housing's [[Systems]].<!-- I'm not sure how to concisely get across which actions are supported by certain action events. -->
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.  


== Cancel Event Action ==
Event Actions can hold up to 30 conditional actions in a single action chain as opposed to the default 15.
The ''Cancel Event'' [[Actions|Action]] is only available within select Action Events, and will sometimes prevent the event from occurring. For example, adding this action to the ''Player Death'' Action Event will prevent the player from dying. Adding this to [[Conditionals]] allows for complex scripting and control over many aspects of vanilla Minecraft gameplay.


This Action is supported within the ''Player Death'', ''Fish Caught'', ''Player Damage'', ''Player Drop Item'', ''Player Pick Up Item'', ''Player Change Held Item'', ''Player Toggle Sneak'', and ''Player Toggle Fly'' Action Events.
=== 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
|-
|-
! Condition !! class="unsortable" |Settings !! Action Event(s) !! class="unsortable" |Additional Notes
|PvP Stage Change
|PvP Enabled
|Requires the PvP state to have changed to enabled from disabled.
|
|-
|-
| Pvp Enabled || - || Pvp State Change || -
|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.
|-
|-
| Fishing Environment || Water or Lava || Fish Caught || Lava fishing requires the ''lavaFishing'' [[gamerule]] 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.
|-
|-
| Portal Type || Nether Portal or End Portal || Enter Portal || Players in survival mode will enter a Nether Portal after 4 seconds.
|Player Damage
|Damage Cause
|Check the type of damage that was taken by the player.
|
|-
|-
| Damage Cause || Various damage causes || Player Damage || -
|Player Damage
|Damage Amount
|Check the amount of damage that was taken by the player.
|
|-
|-
| Damage Amount || Comparator and Compare Value || Player Damage || -
|Player Block Break
|Block Type
|Check that the type of block that has been broken matches the item provided.
|
|-
|-
| Block Type || Block Selector and Type Requirement Boolean || Player Break Block || -
|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.
|-
|-
| 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 Drop Item
| rowspan="3" |Is Item
| rowspan="3" |Requires the item from the event to match the provided item.
| rowspan="3" |
|-
|-
| Is Item || Item Selector, Metadata Boolean, Inventory Selector, and Required Amount || Player Drop Item, Player Pick Up Item, and Player Change Held Item
|Player Pick Up 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