Skip to content
Mike Liu edited this page Aug 25, 2016 · 49 revisions

Foxguard has a bunch of flags that are associated with various events. When an event occurs, FoxGuard produces a set of flags that combine to form a unique description of that event. The key point here is that for every event, there are multiple flags that are fired in a set. Handlers sort these sets using "matcher" sets.

List of Flags

Below is a list of flags, and approximately what they represent.

Identifier Description
root All events have the root flag (with a single exception)
buff Describes something that is not normal minecraft behavior, but when allowed, adds something. (E.g. invincibility.)
debuff Describes something that is normal minecraft behavior (normally allowed), but can prevented when denied. (E.g. breaking blocks.)
interact When a player clicks on something.
primary When the player clicks using the primary mouse button.
secondary When the player clicks using the secondary mouse button.
block Describes events involving blocks.
change When blocks are changed.
place When blocks are placed. (New block ID)
break When blocks are broken. (Changes to block ID of air)
modify When blocks are modified. (Same block ID, different data)
decay When blocks decay. (Whatever SpongeAPI means by that)
grow When blocks grow. (Like crops and stuff)
post Describes events in which a combination of various changes are packed into one event. (Pistons behave this way for example.)
explosion Describes explosion events.
damage Describes events where the the source cause is doing damage to an entity.
kill Describes events where damage would kill the target
*ignite Describes events where an entity is being lit on fire
spawn Describes events where an entity is being spawned
entity Describes events where a target entity is involved
living When said target entity is living.
mob When said living target entity is a mob. (Capable of AI)
passive When said target mob is not aggressive (Like cows)
hostile When said target mob is aggressive. (Like zombies)
human When said target mob is a human. (Fake player created through SpongeAPI)
player When said target living entity is a real player. (Which means they are not a mob)
pass When a player tries to pass in and out of a handler's area of effect.
enter When the player enters said area.
exit When the player exits said area.
invincible Describes whether the source player should be invincible to incoming damage. This is a buff.
undying Describes whether the source player should be immune to death. This is also a buff.

Flags with a * next to them are in the code, but don't do anything YET. They will do stuff soon.

List of Events

Below is a list of events, and what flag sets they produce. Each event group will have a base set of flags that all events in that group will have. They will then have variable flags in addition to the base flags to differentiate between events.

Format syntax:

  • Words without any marks are flags.
  • Words in angle brackets are groups. They are described below the format.
  • The question mark prefix "?" is used to denote optional flags or groups.
  • Parentheses are used to denote local (unnamed) groups.
  • The pipe symbol "|" is used to denote an OR relationship within a local group.
  • Sometimes the same flag can appear twice due to the use of optionals. Just disregard the second instance.

Block Change Events

This group of events is fired when blocks in the world are changed somehow.

Format: <base> <type> base: root debuff block change type: place|break|modify|decay|grow|post

Examples: A player mines a block: root debuff block change break A lever is flipped: root debuff block change modify Water turns lava into obsidian: root debuff block change place

Explosion Event

This event is fired when an explosion occurs. It is currently broken and awaiting a fix from SpongeAPI.

Format: root debuff block change explosion

Damage Event

These events are fired when a source (Often a player) does damage to another entity.

Format: <base> ?(kill living) <type> base: root debuff damage entity type: ?(living ?(player | (mob (passive|hostile|human)))

Entity types are a bit more complicated, so the above format might seem confusing. Here is a breakdown of what it all means. The entity being referred to in this event is the entity receiving the damage. This damage is either dealt by the environment if it is a passive event (no player cause), or it is being dealt by a player (The player whose permission is in question). We are checking the permission of the source, not the target. The entity flags are describing the target. Just keep that in mind.

We already know that the target is an entity. If the entity is living (has a health bar and can die) then the living flag is added. Then they can additionally be either a player or a mob, but not both. If they are one or the other, their corresponding flags are added as well. Finally, if they are a mob, they must either be passive, hostile, or a human (fake player created through SpongeAPI). The corresponding flag is then added on.

Clone this wiki locally