Class GameplayHooks

java.lang.Object
dev.itsharshxd.zentrix.api.scenario.hook.GameplayHooks

public final class GameplayHooks extends Object
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
  • Field Details

    • BLOCK_DROPS

      public static final GameplayHook<GameplayHooks.BlockDropRequest,List<org.bukkit.inventory.ItemStack>> BLOCK_DROPS
      What 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_DROPS
      What a killed entity drops. Replacing supplies the complete drop list; cancelling drops nothing at all.
    • PLAYER_DAMAGE

      public static final GameplayHook<GameplayHooks.DamageRequest,Double> PLAYER_DAMAGE
      How much damage a player takes. Replacing sets the final amount; cancelling prevents the damage.
    • PLAYER_DEATH

      public static final GameplayHook<GameplayHooks.DeathRequest,Boolean> PLAYER_DEATH
      What happens when a player in the match dies. Replacing with true tells 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_RESULT
      The result of a crafting operation. Replacing substitutes the crafted item; cancelling blocks the recipe.
    • WIN_CONDITION

      public static final GameplayHook<GameplayHooks.WinConditionRequest,Boolean> WIN_CONDITION
      Whether the match is over. Replacing with true ends the game, with false keeps it running; cancelling also keeps it running. This is the hook an alternative win condition installs.
    • DEATHMATCH_DESTINATION

      Where the deathmatch happens. Replacing supplies a DeathmatchDestination and 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