Class ClassAbilityProcEvent
java.lang.Object
org.bukkit.event.Event
dev.itsharshxd.zentrix.api.events.ZentrixEvent
dev.itsharshxd.zentrix.api.events.ZentrixGameEvent
dev.itsharshxd.zentrix.api.events.classes.ClassAbilityProcEvent
- All Implemented Interfaces:
org.bukkit.event.Cancellable
public final class ClassAbilityProcEvent
extends ZentrixGameEvent
implements org.bukkit.event.Cancellable
Called when a built-in class ability triggers, after Zentrix decided it applies - the class,
the match state and, for chance-based abilities, the roll - and before its effect happens.
Listeners can cancel the effect entirely, change its strength through
setMagnitude(double) where getMagnitude() is present, replace the item it hands
out where getItem() is present, or keep the ability's currency reward from being paid
without touching the effect itself. A cancelled proc pays no reward either.
| Proc | Magnitude | Item | Target |
|---|---|---|---|
ClassAbilityProcEvent.Proc.TRUE_DAMAGE | bonus damage, dealt a tick later | - | the victim |
ClassAbilityProcEvent.Proc.BOW_SHOT_BUFF | - | - | the entity hit |
ClassAbilityProcEvent.Proc.CHEST_BONUS | - | the bonus item added to the container | - |
ClassAbilityProcEvent.Proc.FALL_DAMAGE_REDUCTION | the fraction of fall damage prevented, 0 to 1 | - | - |
ClassAbilityProcEvent.Proc.EXTRA_CATCH | - | the extra copy of the catch dropped | - |
ClassAbilityProcEvent.Proc.MINERAL_DROP | - | the mineral dropped | - |
ClassAbilityProcEvent.Proc.AUTO_SMELT | - | the smelted result given instead of the ore's drops | - |
Main thread; only fired while a listener is registered.
- Since:
- 1.8.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumA built-in class ability trigger.Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionClassAbilityProcEvent(@NotNull ZentrixGame game, @NotNull org.bukkit.entity.Player player, @NotNull ClassAbilityProcEvent.Proc proc, @Nullable org.bukkit.entity.Entity target, double magnitude, @Nullable org.bukkit.inventory.ItemStack item) -
Method Summary
Modifier and TypeMethodDescription@NotNull StringThe ability type of the class, one ofClassAbilities.TYPES.static @NotNull org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerListGets the handler list for this event.@NotNull Optional<org.bukkit.inventory.ItemStack> getItem()A copy of the item the proc hands out, for the procs that hand one out.@NotNull OptionalDoubleThe proc's strength, for the procs that have one.@NotNull org.bukkit.entity.PlayerThe player whose class ability triggered.@NotNull ClassAbilityProcEvent.ProcgetProc()What triggered.@NotNull Optional<org.bukkit.entity.Entity> The entity the ability acts on, for the combat procs.booleanbooleanWhether the ability's configured currency reward will be paid.voidsetCancelled(boolean cancelled) voidsetItem(@NotNull org.bukkit.inventory.ItemStack item) Replaces the item the proc hands out.voidsetMagnitude(double magnitude) Changes the proc's strength.voidsetRewarded(boolean rewarded) Keeps the currency reward from being paid, or pays it again, without changing the effect.Methods inherited from class dev.itsharshxd.zentrix.api.events.ZentrixGameEvent
getArenaName, getGame, getGameId, getGameState, getGameTypeName, getPlayerCount, getRuntimeId, getSourceArenaNameMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
ClassAbilityProcEvent
public ClassAbilityProcEvent(@NotNull @NotNull ZentrixGame game, @NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull ClassAbilityProcEvent.Proc proc, @Nullable @Nullable org.bukkit.entity.Entity target, double magnitude, @Nullable @Nullable org.bukkit.inventory.ItemStack item)
-
-
Method Details
-
getPlayer
@NotNull public @NotNull org.bukkit.entity.Player getPlayer()The player whose class ability triggered. -
getProc
What triggered. -
getAbilityType
The ability type of the class, one ofClassAbilities.TYPES. -
getTarget
The entity the ability acts on, for the combat procs. -
getMagnitude
The proc's strength, for the procs that have one. -
setMagnitude
public void setMagnitude(double magnitude) Changes the proc's strength.- Throws:
IllegalStateException- for a proc without a magnitudeIllegalArgumentException- for a negative or non-finite value, or a fall damage reduction above 1
-
getItem
A copy of the item the proc hands out, for the procs that hand one out. -
setItem
public void setItem(@NotNull @NotNull org.bukkit.inventory.ItemStack item) Replaces the item the proc hands out.- Throws:
IllegalStateException- for a proc that hands out no itemIllegalArgumentException- for air or an empty stack
-
isRewarded
public boolean isRewarded()Whether the ability's configured currency reward will be paid. -
setRewarded
public void setRewarded(boolean rewarded) Keeps the currency reward from being paid, or pays it again, without changing the effect. -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()Description copied from class:ZentrixGameEventGets the handler list for this event.- Overrides:
getHandlersin classZentrixGameEvent- Returns:
- The handler list
-
getHandlerList
@NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
-