mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-05-15 17:31:26 +00:00
787b303c9f
## Additions * Adds a built-in bending board sidebar to visualize bound abilities and cooldowns. * The board respects worlds where bending is disabled. * Players can use the command `/pk board` to toggle the visibility of their board. * Includes an API that community developers can use in BendingBoardManager. * Adds the `"Properties.BendingBoard"` config option to enable or disable the board server. * Adds language file configuration options to control BendingBoard visuals. * `"Board.Title"` * Controls the title at the top of the board. * Supports the standard Minecraft color codes. * `"Board.SelectionPrefix"` * Controls the prefix shown corresponding to your current hot bar slot. * Supports the standard Minecraft color codes. * `"Board.EmptySlot"` * Controls what is shown for empty slots. * Supports the standard Minecraft color codes. * `{slot_number}` can be used as a placeholder for the slot number. * `"Board.MiscSeparator"` * Controls the separation between hot bar binds and temporary cooldowns such as Combos. * Supports the standard Minecraft color codes. * Adds support for KingdomsX version 1.10.19.1 * Adds ability permission check to passive abilities. They should now respect their `bending.ability.<ability name>` permissions. * Adds `AbilityVelocityAffectEntityEvent` * A cancellable event that will fire whenever an ability would alter the velocity of an entity. * Adds the `Abilities.Earth.EarthSmash.Shoot.CollisionRadius` configuration option * Sets the collision radius of shot EarthSmash. ## Fixes * Fixes FireBlast going through liquids. * Fixes duplication involving waterlogged containers. * Fixes being able to not enter the name of a Preset when using the `/pk preset create <name>` command. * Fixes getDayFactor() not being applied correctly and occasionally producing the wrong value. * Fixes a rounding issue with some Fire ability damage configuration options. * Fixes an error when attempting to start EarthGrab. * Fixes PhaseChange error when melting snow. * Fixes a memory/process leak in how cooldowns were removed. * A player's cooldowns could only be removed when they were online. If a player's cooldown expired while they weren't online, their cooldown would attempt to revert every tick until the player rejoined. This has been resolved so cooldowns can revert while a player is offline. * A side effect of this fix is that it is now possible for `PlayerCooldownChangeEvents` to fire while their corresponding Player is offline. * Fixes an issue with `MultiAbilityManager#hasMultiAbilityBound` where it would return true if any MultiAbility is bound, not if the specified MultiAbility was bound. ## Misc Changes * Updates Towny version to 0.96.2.0 * DensityShift sand blocks can now be used as a bendable source. * Changes AvatarState so that its cooldown is applied when the ability ends instead of when it starts. * Changes togglable abilities such as AvatarState, Illumination, and TremorSense to visually show when they are enabled in the BendingBoard and on BendingPreview in the same way as the ChiBlocking Stances. * Updated the text of some ability descriptions and instructions. * Adds new cache to PhaseChange to greatly improve the performance of water/ice updates.
147 lines
4.3 KiB
Java
147 lines
4.3 KiB
Java
package com.projectkorra.projectkorra.chiblocking;
|
|
|
|
import org.bukkit.Location;
|
|
import org.bukkit.Sound;
|
|
import org.bukkit.entity.Player;
|
|
import org.bukkit.potion.PotionEffect;
|
|
import org.bukkit.potion.PotionEffectType;
|
|
|
|
import com.projectkorra.projectkorra.Element;
|
|
import com.projectkorra.projectkorra.ability.ChiAbility;
|
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
|
|
|
public class AcrobatStance extends ChiAbility {
|
|
|
|
@Attribute(Attribute.COOLDOWN)
|
|
private long cooldown;
|
|
@Attribute(Attribute.DURATION)
|
|
private long duration;
|
|
@Attribute(Attribute.SPEED)
|
|
private int speed;
|
|
@Attribute("Jump")
|
|
private int jump;
|
|
@Attribute("ChiBlockBoost")
|
|
private double chiBlockBoost;
|
|
@Attribute("ParalyzeDodgeBoost")
|
|
private double paralyzeDodgeBoost;
|
|
|
|
public AcrobatStance(final Player player) {
|
|
super(player);
|
|
if (!this.bPlayer.canBend(this)) {
|
|
return;
|
|
}
|
|
this.cooldown = getConfig().getLong("Abilities.Chi.AcrobatStance.Cooldown");
|
|
this.duration = getConfig().getLong("Abilities.Chi.AcrobatStance.Duration");
|
|
this.speed = getConfig().getInt("Abilities.Chi.AcrobatStance.Speed") - 1;
|
|
this.jump = getConfig().getInt("Abilities.Chi.AcrobatStance.Jump") - 1;
|
|
this.chiBlockBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ChiBlockBoost");
|
|
this.paralyzeDodgeBoost = getConfig().getDouble("Abilities.Chi.AcrobatStance.ParalyzeChanceDecrease");
|
|
|
|
final ChiAbility stance = this.bPlayer.getStance();
|
|
if (stance != null) {
|
|
stance.remove();
|
|
if (stance instanceof AcrobatStance) {
|
|
this.bPlayer.setStance(null);
|
|
return;
|
|
}
|
|
}
|
|
this.start();
|
|
this.bPlayer.setStance(this);
|
|
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_HURT, 0.5F, 2F);
|
|
}
|
|
|
|
@Override
|
|
public void progress() {
|
|
if (!this.bPlayer.canBendIgnoreBinds(this) || !this.bPlayer.hasElement(Element.CHI)) {
|
|
this.remove();
|
|
return;
|
|
} else if (this.duration != 0 && System.currentTimeMillis() > this.getStartTime() + this.duration) {
|
|
this.remove();
|
|
return;
|
|
}
|
|
|
|
if (!this.player.hasPotionEffect(PotionEffectType.SPEED) || this.player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() < this.speed || (this.player.getPotionEffect(PotionEffectType.SPEED).getAmplifier() == this.speed && this.player.getPotionEffect(PotionEffectType.SPEED).getDuration() == 1)) {
|
|
this.player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 10, this.speed, true, false), true);
|
|
}
|
|
if (!this.player.hasPotionEffect(PotionEffectType.JUMP) || this.player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() < this.jump || (this.player.getPotionEffect(PotionEffectType.JUMP).getAmplifier() == this.jump && this.player.getPotionEffect(PotionEffectType.JUMP).getDuration() == 1)) {
|
|
this.player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 10, this.jump, true, false), true);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void remove() {
|
|
super.remove();
|
|
this.bPlayer.addCooldown(this);
|
|
this.bPlayer.setStance(null);
|
|
this.player.playSound(this.player.getLocation(), Sound.ENTITY_ENDER_DRAGON_SHOOT, 0.5F, 2F);
|
|
this.player.removePotionEffect(PotionEffectType.SPEED);
|
|
this.player.removePotionEffect(PotionEffectType.JUMP);
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return "AcrobatStance";
|
|
}
|
|
|
|
@Override
|
|
public Location getLocation() {
|
|
return this.player != null ? this.player.getLocation() : null;
|
|
}
|
|
|
|
@Override
|
|
public long getCooldown() {
|
|
return this.cooldown;
|
|
}
|
|
|
|
@Override
|
|
public boolean isSneakAbility() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean isHarmlessAbility() {
|
|
return true;
|
|
}
|
|
|
|
public int getSpeed() {
|
|
return this.speed;
|
|
}
|
|
|
|
public void setSpeed(final int speed) {
|
|
this.speed = speed;
|
|
}
|
|
|
|
public int getJump() {
|
|
return this.jump;
|
|
}
|
|
|
|
public void setJump(final int jump) {
|
|
this.jump = jump;
|
|
}
|
|
|
|
public long getDuration() {
|
|
return this.duration;
|
|
}
|
|
|
|
public void setDuration(final long duration) {
|
|
this.duration = duration;
|
|
}
|
|
|
|
public double getChiBlockBoost() {
|
|
return this.chiBlockBoost;
|
|
}
|
|
|
|
public void setChiBlockBoost(final double chiBlockBoost) {
|
|
this.chiBlockBoost = chiBlockBoost;
|
|
}
|
|
|
|
public double getParalyzeDodgeBoost() {
|
|
return this.paralyzeDodgeBoost;
|
|
}
|
|
|
|
public void setParalyzeDodgeBoost(final double paralyzeDodgeBoost) {
|
|
this.paralyzeDodgeBoost = paralyzeDodgeBoost;
|
|
}
|
|
|
|
}
|