-
Notifications
You must be signed in to change notification settings - Fork 29
Events
Factions mod contains it's own API that you can hook into to develop your own mods. To register a callback, simply call the method register
on the event with your callback method. The namespace in which all events are contained is io.icker.factions.api.events
, which contains each type of event (indicated by the large headers), each of them containing the actual events.
1️⃣ The first word in the header (int
) specifies the expected return type.
2️⃣ The second word ExampleEvent
specifies the event name.
➕ Every parameter (String exampleParameter
) is a value which will be passed to your callback
🔥 This symbol indicates the condition which causes this event to fire
↩️ This symbol indicates a possible return value, and what it does
import io.icker.factions.api.events.PlayerEvents;
import net.minecraft.entity.Entity;
import net.minecraft.util.ActionResult;
public class Example {
public static void register() {
PlayerEvents.IS_INVULNERABLE.register(Example::isInvulnerable); // Register the event listener
}
private static ActionResult isInvulnerable(Entity source, Entity target) {
if (target.getName().asString() != "Notch") {
return ActionResult.FAIL; // If the targets name wasn't Notch, always take damage
}
return ActionResult.PASS; // Name was Notch, continue on executing callbacks
}
}
:fire: server
saved, either due to an auto-save, shutting down, or /save-all
:fire: Mob spawned
:information_source: This event is currently not implemented
:fire: owner
created faction
:fire: faction
disbanded
:fire: user
joined faction
:fire: user
left faction
:fire: faction
modified
:fire: faction
's power was changed from oldPower
:fire: faction
's home was set/changed
:fire: A member within faction
ran /factions claim remove all
, or the faction
was disbanded
:fire: player
interacting with entity
in world
:leftwards_arrow_with_hook: ActionResult.FAIL
cancels the interact event, and cancels further processing.
:leftwards_arrow_with_hook: ActionResult.SUCCESS
continues the interact event, and cancels further processing.
:leftwards_arrow_with_hook: ActionResult.PASS
continues further processing.
:fire: source
attacking target
:leftwards_arrow_with_hook: ActionResult.FAIL
cancels the damage event, and cancels further processing.
:leftwards_arrow_with_hook: ActionResult.SUCCESS
continues the damage event, and cancels further processing.
:leftwards_arrow_with_hook: ActionResult.PASS
continues further processing.
:fire: player
moved
:fire: player
killed by source
:fire: player
faction power tick occured
:fire: claim
added
:fire: A claim belonging to faction
and at chunk position (x
, z
) in level
was removed
:fire: Faction home
set
:fire: relationship
formed
:fire: relationship
mutually formed
:fire: relationship
mutually ended, was previously oldStatus