Triggers

Triggers are a function used in Command Blocks. They allow players to make events happen, depending on whether another event happens, in a Peaceful server. For example, players can use triggers to give a player Gold if they kill a mob. Since there are so many types of triggers, players can make servers with great variety. Information in parenthesis are miscellaneous notes that help clarify the command blocks, and should not be put in with your actual commands.

Remember values like "survival tool" or "copper asteroid" must be written like "survival\_tool" or "CopperAsteroid"!

## List of Triggers (as of update v0.4.18.alpha)

### ArmorEquipChanged

Event triggered when armor equip changed.

* Variables: $playerId, $player, $previous (previous armor), $current (current armor).

* Usage: When a player's clothing/suit is changed.

* Examples: if $current == previous, /chat $player $playerId

### AsteroidMined

Event triggered when asteroid mined.

* Variables: $type (name of resource gained), $player, $remaining (how much resource is remaining).

* Usage: When a player mines an asteroid.

* Examples: if $remaining <= 10, then /chat $player "There are less than 10 resources remaining."

### BuildingAttacked

Event triggered when a building gets damaged.

* Variables: $entityId (id of attacked building), $entityType (type of attacked building), $attackingPlayer, $attackingPlayerRole, $attackingMob (id of the attacking mob), $damage (amount of damage).

* Usage: When a placed structure/building gets damaged.

* Examples: if $entityType == Bed, then /chat $player "The bed got attacked."

### BuildingDeconstructed

Event triggered when a building gets deconstructed.

* Variables: $entityId (id of building), $entityType (type of building), $player, $playerId.

* Usage: When a building gets deconstructed.

* Examples: if $entityType == Wall, then /chat $player "You broke a $entityType."

### BuildingPlaced

Event triggered when a building gets placed.

* Variables: $entityId (id of building), $entityType (iype of building), $player, $playerId.

* Usage: When a building is placed.

* Examples: if $player == JunonPlayer, then /chat @a "JunonPlayer placed something."

### ColonyLike

Event triggered when a player likes colony.

* Variables: $player.

* Usage: When a player likes a colony.

* Examples: if $player != PlayerOwner, then /chat @a "$player liked the colony for public attention and to show appreciation."

### ColonyUnlike

Event triggered when player unlikes colony.

* Variables: $player.

* Usage: When a player unlikes a colony.

* Examples: if $player != PlayerOwner, then /chat @a "$player unliked the game to get this humiliating message."

### CorpseButchered

Event triggered when corpse butchered.

* Variables: $entityId (id of entity who butchered it), $player, $corpseType.

* Usage: When a corpse is butchered. Can be used for players and slaves.

* Examples: if $corpseType == Human, then /chat @a "$player chopped a human."

### CorpseDragged

Event triggered when corpse dragged.

* Variables: $entityId (id of the entity who dragged it), $player, $corpseType, $corpseId.

* Usage: When a corpse is picked up.

* Examples: if $corpseType == human, then /chat $player "You grabbed this dead human."

### CorpseReleased

Event triggered when corpse released.

* Variables: $entityId (id of the entity who dragged it), $player, $corpseType, $corpseId.

* Usage: When a corpse is put down.

* Examples: if $corpseType == Ghost, then /chat $player "You held the air."

### CropHarvested

Event triggered when a crop gets harvested.

* Variables: $entityId (id of crop), $entityType (type of crop), $yieldType (?), $player (player harvesting the crop)

* Usage: When a player harvests a crop.

* Examples:

### CropPlanted

Event triggered when a crop gets planted.

* Variables: $entityId (id of crop), $entityType (type of crop), $player (player planting the crop).

* Usage: When a player plants a crop.

* Examples:

### FoodCooked

Event triggered when food cooked.

* Variables: $entityId (id of user cooking food), $player (username of player), $foodType.

* Usage: When a player cooks food.

* Examples:

### GoldChanged

Event triggered when gold changed.

* Variables: $playerId, $player, $previous (previous amount of gold), $current (current amount of gold), $delta (amount changed)

* Usage: When a player's amount of gold is changed.

* Examples:

### HealthChanged

Event triggered when entity health changed.

* Variables: $entityId, $entityType, $playerId, $player, $previous (previous amount of health), $current (current amount of health), $delta (how much the health was changed)

* Usage: When an entity's health is changed. Can be used for any entity, not just players.

* Examples:

### HungerChanged

Event triggered when player hunger changed.

* Variables: $playerId, $player, $previous (previous amount of hunger), $current (current amount of hunger), $delta (how much the hunger changed by)

* Usage: Event triggered when a player's hunger is changed.

* Examples:

### InteractBuilding

Event triggered when player interacts with building.

* Variables: $entityId (id of building), $entityType (type of building), $playerId, $player.

* Usage: When a player interacts with a placed building.

* Examples:

### ItemBuy

Event triggered when player buys items.

* Variables: $playerId, $player, $itemType, $count (amount of items).

* Usage: When a player purchases an item from a Trader.

* Examples:

### ItemConsumed

Event triggered when player consumes item.

* Variables: $playerId, $player, $itemType
* Usage: When a player consumes a consumable item.
* Examples:

### ItemCrafted

Event triggered when asteroid mined. (Yes, that is the actual description. Yes, it is a mistake.)

* Variables: $type (name of crafted item), $player.
* Usage: When a player crafts an item.
* Examples:

### ItemDropped

Event triggered when player drops item.

* Variables: $playerId, $player, $itemType, $count (amount of item that was dropped).
* Usage: When a player drops an item on the ground.
* Examples:

### ItemPickup

Event triggered when player picks up item.

* Variables: $playerId, $player, $itemType, $count (how much of the item the player picked up).
* Usage: When a player picks up an item that was dropped.
* Examples:

### ItemSell

Event triggered when player sells items.

* Variables: $playerId, $player, $itemType, $count (amount of item that was sold).
* Usage: When a player sells items using a Trader.
* Examples:

### ItemUsed

Event triggered when player uses item.

* Variables: $playerId, $player, $itemType
* Usage: When a player uses an item Keep in mind that different objects have different effects, and may have to be coded differently for a desired effect.
* Examples:

### MobAttacked

Event triggered when a mob gets damaged.

* Variables: $entityId (id of mob who got attacked), $entityType (type of mob), $attackingPlayer (player who attacked the mob), $attackingPlayerRole, $attackingMob (id of mob who attacked the other mob), $damage (amount of damage).
* Usage: For when a mob gets damaged by another mob or a player.
* Examples:

### MobDestroyed

Event triggered when a mob dies.

* Variables: $entityId (id of the mob that died), $entityType (type of mob that died), $killingPlayer (player that killed the mob), $killingPlayerRole, $killingMob (id of mob that killed the other mob).
* Usage: For when a mob gets killed by another mob or a player.
* Examples:

### MobFeed

Event triggered when a mob is fed.

* Variables: $entityId (id of mob that was fed), $entityType (type of mob), $playerId (id of player that fed the mob), $player (username of player that fed the mob), $itemType (the item that the mob was fed).
* Usage: When a mob is fed by a player.
* Examples:

### MobFollow

Event triggered when a mob starts following player.

* Variables: $entityId (id of mob), $entityType (type of mob), $playerId, $player.
* Usage: When a mob begins to follow a player.
* Examples:

### MobMount

Event triggered when a player mounts mob.

* Variables: $entityId (id of mob), $entityType (type of mob), $playerId, $player.
* Usage: When a player mounts a mob.
* Examples:

### MobRelease

Event triggered when a mob stops following player.

* Variables: $entityId (id of mob), $entityType (type of mob), $playerId, $player.
* Usage: When a mob stops following a player.
* Examples:

### MobTamed

Event triggered when a mob is tamed.

* Variables: $entityId (id of mob), $entityType (type of mob), $playerId (id of player who tamed the mob), $player (name of player who tamed the mob).
* Usage: When a player tames a mob (done by feeding the mob multiple times).
* Examples:

### MobUnmount

Event triggered when a player unmounts mob.

* Variables: $entityId (id of mob), $entityType (type of mob), $playerId (id of player that unmounted the mob), $player (username of player that unmounted the mob).
* Usage: When a player unmounts a mob.
* Examples:

### OxygenChanged

Event triggered when player oxygen changed.

* Variables: $playerId, $player, $previous (previous oxygen level), $current (current oxygen level), $delta (amount changed).
* Usage: When a player's oxygen level is changed.
* Examples:

### PlatformCleaned

Event triggered when platform cleaned.

* Variables: $playerId (id of player that cleaned the platform), $player (username of player that cleaned the platform), $entityId (id of entity that cleaned the platform), $row (row of the cleaned area), $col (column of the cleaned area).
* Usage: When a platform is cleaned by a player or a Clean Bot.
* Examples:

### PlayerAttacked

Event triggered when a player gets damaged.

* Variables: $player (damaged player), $playerRole (damaged player's role), $attackingPlayer, $attackingPlayerRole, $attackingMob, $damage (amount of damage).
* Usage: When a player is damaged by another player or a mob.
* Examples:

### PlayerDestroyed

Event triggered when a player dies.

* Variables: $player (dead player), $playerRole (dead player's role), $killingPlayer, $killingPlayerRole, $killingMob.
* Usage: When a player is killed by another player or a mob.
* Examples:

### PlayerJoined

Event triggered when a player joins a game.

* Variables: $player, $playerRole.
* Usage: When a player enters a server.
* Examples:

### PlayerKeyboard

Event triggered when player presses a key.

* Variables: $playerId, $player, $key (key that was pressed).
* Usage: When a player presses a certain key on their keyboard.
* Examples:

### PlayerLeft

Event triggered when

### PlayerMessage

Event triggered when a player sends a chat message.

* Variables: $player, $message (the message that was sent).
* Usage: When a player sends a message in the chat.
* Examples:

### PlayerMove

Event triggered when player changes position.

* Variables: $player, $row (row that the player is in), $col (column that the player is in).
* Usage: When a player goes to a specific set of coordinates.
* Examples:

### PlayerRespawn

Event triggered when player respawns.

* Variables: $playerId, $player.
* Usage: When a player respawns.
* Examples:

### RegionEnter

Event triggered when entity enters a region.

* Variables: $region (name of region), $player (name of player who entered), $playerRole (role of player who entered), $entityId (id of entity who entered), $entityType (type of entity who entered).
* Usage: When a player or mob enters a region.
* Examples:

### RegionLeave

Event triggered when entity leaves a region.

* Variables: $region (name of region), $player (name of player who left), $playerRole (role of player who left), $entityId (id of entity who left), $entityType (type of entity who left).
* Usage: When a player or mob leaves a region.
* Examples:

### RoleChanged

Event triggered when role changed.

* Variables: $playerId (id of player whose role is changed), $player (name of player whose role is changed), $previous (previous role), $current (current role).
* Usage: When a player's role is changed.
* Examples:

### ScoreChanged

Event triggered when player score changed.

* Variables: $playerId (id of player whose score is changed), $player (name of player whose score is changed), $previous (previous score), $current (current score), $delta (how much the score was changed).
* Usage: When a player's score is changed.
* Examples:

### StaminaChanged

Event triggered when player stamina changed.

* Variables: $playerId, $player, $previous (previous amount), $current (current amount), $delta (how much the stamina was changed).
* Usage: When a player's stamina is changed.
* Examples:

### TeamMemberAdded

Event triggered when member added to team.

* Variables: $player (name of added player), $team (name of team), $count (number of members in team).
* Usage: When a player is added to a team.
* Examples:

### TeamMemberRemoved

Event triggered when member removed from team.

* Variables: $player (name of removed player), $team (name of team), $count (number of members in team).
* Usage: When a player is removed from a team.
* Examples:

### WorldLoaded

Event triggered world is first loaded. Useful for setting up commands such as sidebar etc.

* Variables: None listed (All variables can be used with this command).
* Usage: When a world is first loaded.
* Examples: