Class GameplayHooks
java.lang.Object
dev.itsharshxd.zentrix.api.scenario.hook.GameplayHooks
The gameplay decision points Zentrix consults active scenarios about.
Every request below is scoped to one game: it is only raised for players, blocks and entities that belong to the match the scenario was activated for, so a scenario running in one arena can never see or change anything happening in another.
Requests whose fields are documented as mutable may be edited in place and then
passed, which lets several scenarios refine the same request
before Zentrix applies it. Returning HookOutcome.replace(Object) or
HookOutcome.cancel() instead ends the consultation immediately.
- Since:
- 1.6.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA block broken by a player inside the match.static final classA crafting result about to be shown to a player of the match.static final classDamage about to be applied to a player in the match.static final classThe deathmatch Zentrix is about to start, described as it would run it on its own.static final classA player of the match dying.static final classAn entity killed inside the match.static final classZentrix's periodic check of whether the match is over. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GameplayHook<GameplayHooks.BlockDropRequest, List<org.bukkit.inventory.ItemStack>> What a broken block drops.static final GameplayHook<GameplayHooks.CraftRequest, org.bukkit.inventory.ItemStack> The result of a crafting operation.Where the deathmatch happens.static final GameplayHook<GameplayHooks.EntityDropRequest, List<org.bukkit.inventory.ItemStack>> What a killed entity drops.static final GameplayHook<GameplayHooks.DamageRequest, Double> How much damage a player takes.static final GameplayHook<GameplayHooks.DeathRequest, Boolean> What happens when a player in the match dies.static final GameplayHook<GameplayHooks.WinConditionRequest, Boolean> Whether the match is over. -
Method Summary
-
Field Details
-
BLOCK_DROPS
public static final GameplayHook<GameplayHooks.BlockDropRequest,List<org.bukkit.inventory.ItemStack>> BLOCK_DROPSWhat a broken block drops. Replacing supplies the complete drop list; cancelling drops nothing at all. -
ENTITY_DROPS
public static final GameplayHook<GameplayHooks.EntityDropRequest,List<org.bukkit.inventory.ItemStack>> ENTITY_DROPSWhat a killed entity drops. Replacing supplies the complete drop list; cancelling drops nothing at all. -
PLAYER_DAMAGE
How much damage a player takes. Replacing sets the final amount; cancelling prevents the damage. -
PLAYER_DEATH
What happens when a player in the match dies. Replacing withtruetells Zentrix the scenario handled the death itself and its own elimination handling must be skipped; cancelling suppresses the drops only. -
CRAFT_RESULT
public static final GameplayHook<GameplayHooks.CraftRequest,org.bukkit.inventory.ItemStack> CRAFT_RESULTThe result of a crafting operation. Replacing substitutes the crafted item; cancelling blocks the recipe. -
WIN_CONDITION
Whether the match is over. Replacing withtrueends the game, withfalsekeeps it running; cancelling also keeps it running. This is the hook an alternative win condition installs. -
DEATHMATCH_DESTINATION
public static final GameplayHook<GameplayHooks.DeathmatchDestinationRequest,DeathmatchDestination> DEATHMATCH_DESTINATIONWhere the deathmatch happens. Replacing supplies aDeathmatchDestinationand Zentrix runs its whole ordinary deathmatch there instead of copying its template; passing or cancelling leaves the template arena in place, so a scenario whose preferred world turns out to be unavailable only has to pass and the match carries on untouched.Raised once per deathmatch, after the start is committed to and before any world is copied.
- Since:
- 1.6.0
-