Class PlayerCustomKnockbackEvent
- All Implemented Interfaces:
ArenaEvent
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result -
Field Summary
Fields inherited from class org.bukkit.event.player.PlayerEvent
player -
Constructor Summary
ConstructorsConstructorDescriptionPlayerCustomKnockbackEvent(Player player, Arena arena, Entity damager, boolean hitSelf, float damageMultiplier, float addKnockbackY, float multiplierKnockbackY, float multiplierKnockbackXZ, float maxVelocityY, float maxVelocityXZ) -
Method Summary
Modifier and TypeMethodDescriptionfloatGet the knockback that is being added (addition) to the player's current Y velocity.getArena()Get the arena in which the player is currently in.floatGet the damage multiplier that is being applied to the player as a result of the damage.Get the entity that caused the knockback.static HandlerListfloatGet the maximum XZ velocity that is being applied to the player.floatGet the maximum Y velocity that is being applied to the player.floatGet the knockback that is being multiplied with the player's current XZ velocity.floatGet the knockback that is being multiplied with the player's current Y velocity.booleanCheck if the player hit themselves.voidsetDamageMultiplier(float damageMultiplier) Set the damage multiplier that is being applied to the player as a result of the damage.voidsetKnockback(float addKnockbackY, float multiplierKnockbackY, float multiplierKnockbackXZ) Set the velocity modifications that are being applied to the player.voidsetMaxVelocity(float maxVeloY, float maxVeloXZ) Set the maximum velocities that are being applied to the player.voidRemoves the max velocities a player may get applied.voidSet the knockback to the vanilla values.Methods inherited from class org.bukkit.event.player.PlayerEvent
getPlayerMethods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
PlayerCustomKnockbackEvent
-
-
Method Details
-
getArena
Get the arena in which the player is currently in.- Specified by:
getArenain interfaceArenaEvent- Returns:
- The arena that is involved in this event
-
getDamager
Get the entity that caused the knockback.This may e.g. be the fireball that hit the player, or a player that hit the player.
- Returns:
- The entity that caused the knockback
-
isHitSelf
public boolean isHitSelf()Check if the player hit themselves.A player can hit themselve with e.g. a fireball, or if one of their companions (i.a. own arrow) hits them.
- Returns:
trueif the player hit themselves,falseotherwise
-
getDamageMultiplier
public float getDamageMultiplier()Get the damage multiplier that is being applied to the player as a result of the damage.It uses the formula
finalDamage = originalDamage * damageMultiplier. Therefore, set it to1.0fto keep the vanilla damage.- Returns:
- The damage multiplier
-
setDamageMultiplier
public void setDamageMultiplier(float damageMultiplier) Set the damage multiplier that is being applied to the player as a result of the damage.It uses the formula
finalDamage = originalDamage * damageMultiplier. Therefore, set it to1.0fto keep the vanilla damage.- Parameters:
damageMultiplier- The new damage multiplier
-
getAddKnockbackY
public float getAddKnockbackY()Get the knockback that is being added (addition) to the player's current Y velocity.- Returns:
- The added Y velocity
-
getMultiplierKnockbackY
public float getMultiplierKnockbackY()Get the knockback that is being multiplied with the player's current Y velocity.- Returns:
- The new multiplier for the Y velocity
-
getMultiplierKnockbackXZ
public float getMultiplierKnockbackXZ()Get the knockback that is being multiplied with the player's current XZ velocity.- Returns:
- The new multiplier for the XZ velocities
-
getMaxVelocityY
public float getMaxVelocityY()Get the maximum Y velocity that is being applied to the player.The result of
getAddKnockbackY()andgetMultiplierKnockbackY()will never exceed this value.- Returns:
- The maximum Y velocity
-
getMaxVelocityXZ
public float getMaxVelocityXZ()Get the maximum XZ velocity that is being applied to the player.The result of
getMultiplierKnockbackXZ()will never exceed this value.- Returns:
- The maximum XZ velocity
-
setKnockback
public void setKnockback(float addKnockbackY, float multiplierKnockbackY, float multiplierKnockbackXZ) Set the velocity modifications that are being applied to the player.- Parameters:
addKnockbackY- The added Y velocitymultiplierKnockbackY- The new multiplier for the Y velocitymultiplierKnockbackXZ- The new multiplier for the XZ velocities- See Also:
-
setVanillaKnockback
public void setVanillaKnockback()Set the knockback to the vanilla values.This means no additional Y velocity, and no multipliers for the XZ and Y velocities. As a result, MBedwars will not modify the knockback at all.
- See Also:
-
setMaxVelocity
public void setMaxVelocity(float maxVeloY, float maxVeloXZ) Set the maximum velocities that are being applied to the player.- Parameters:
maxVeloY- The maximum Y velocitymaxVeloXZ- The maximum XZ velocity- See Also:
-
setNoMaxVelocity
public void setNoMaxVelocity()Removes the max velocities a player may get applied.This means that players may receive uncapped knockback velocities.
- See Also:
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-