Skip to content

Custom States & Triggers

Aria edited this page Nov 26, 2019 · 5 revisions

How to implement your own States/Triggers

To create a custom Break State or Trigger you'll need to create a new class which extends BreakState or BreakTrigger respectively. You'll need to overwrite different methods to define how the state/trigger will work:

States

type() returns the string needed to put in the configuration to load the state.
activeState(BreakingBlock) returns true if the state conditions are met.
getStateValue(BreakingBlock) returns the value to subtract from the hardness.
register(ConfigurationSection) is called when the state is loaded from the config.
(This is usually where you load the different arguments)

Triggers

type() returns the string needed to put in the configuration to load the state.
execute(Player, Block) the code to run when triggered.
register(ConfigurationSection) is called when the trigger is loaded from the config.
(This is usually where you load the different arguments)

Clone this wiki locally