mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-05-16 01:41:22 +00:00
75c4f41be5
## Additions * Adds support for Minecraft 1.17! * Adds vanished player support to the `/pk who <Player>` command. * Should work with most common vanishing plugins, tested using Essentials vanish. * Affects `/pk who` and `/pk who <Player>`. * Adds new `"Abilities.Earth.EarthSmash.Lift.Knockup"` configuration option to control the velocity applied to players standing where an EarthSmash is created. * Adds new `"Abilities.Earth.EarthSmash.Lift.Range"` configuration option to control the range in which entities need to be standing in relation to where an EarthSmash is created to get the Knockup applied. ## Fixes * Fixes players sometimes "falling through" their EarthSmash if they try to create it underneath themselves. * Reduces the overall push so it feels more natural. * Expands the push radius so it can affect entities within one block of the location. * Fixes IceWave activating sometimes when PhaseChange wasn't clicked. * Fixes IceWave users getting stuck on their ice midair. * Fixes the display command showing hidden combos and passives * Fixes an error caused by adding attribute modifiers to abilities sometimes. * Fixes an error preventing the plugin from working on Minecraft 1.17. * ClassDefNotFoundError resulting from EntityHuman being moved during the 1.17 Minecraft update. We no longer rely on NMS for this area as a proper API has been introduced. As such, GeneralMethods and EarthArmor have been updated to reflect these changes.
133 lines
3.2 KiB
Java
133 lines
3.2 KiB
Java
package com.projectkorra.projectkorra.waterbending.combo;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Map;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
import org.bukkit.Location;
|
|
import org.bukkit.block.Block;
|
|
import org.bukkit.entity.Player;
|
|
|
|
import com.projectkorra.projectkorra.ability.ComboAbility;
|
|
import com.projectkorra.projectkorra.ability.IceAbility;
|
|
import com.projectkorra.projectkorra.ability.util.ComboManager.AbilityInformation;
|
|
import com.projectkorra.projectkorra.attribute.Attribute;
|
|
import com.projectkorra.projectkorra.util.ClickType;
|
|
import com.projectkorra.projectkorra.util.TempBlock;
|
|
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
|
|
|
|
public class IceWave extends IceAbility implements ComboAbility {
|
|
|
|
private static final Map<Block, TempBlock> FROZEN_BLOCKS = new ConcurrentHashMap<>();
|
|
|
|
@Attribute(Attribute.COOLDOWN)
|
|
private long cooldown;
|
|
private Location origin;
|
|
|
|
public IceWave(final Player player) {
|
|
super(player);
|
|
|
|
if (!hasAbility(player, WaterSpoutWave.class)) {
|
|
return;
|
|
}
|
|
|
|
if (!this.bPlayer.canBendIgnoreBindsCooldowns(this)) {
|
|
return;
|
|
}
|
|
|
|
if (this.bPlayer.isOnCooldown("IceWave") && !this.bPlayer.isAvatarState()) {
|
|
this.remove();
|
|
return;
|
|
}
|
|
|
|
this.cooldown = getConfig().getLong("Abilities.Water.IceWave.Cooldown");
|
|
|
|
if (this.bPlayer.isAvatarState()) {
|
|
this.cooldown = 0;
|
|
}
|
|
|
|
this.start();
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return "IceWave";
|
|
}
|
|
|
|
@Override
|
|
public void progress() {
|
|
if (this.player.isDead() || !this.player.isOnline()) {
|
|
this.remove();
|
|
return;
|
|
}
|
|
|
|
if (this.origin == null && WaterSpoutWave.containsType(this.player, WaterSpoutWave.AbilityType.RELEASE)) {
|
|
this.bPlayer.addCooldown("IceWave", this.cooldown);
|
|
this.origin = this.player.getLocation();
|
|
|
|
final WaterSpoutWave wave = WaterSpoutWave.getType(this.player, WaterSpoutWave.AbilityType.RELEASE).get(0);
|
|
wave.setIceWave(true);
|
|
} else if (!WaterSpoutWave.containsType(this.player, WaterSpoutWave.AbilityType.RELEASE)) {
|
|
this.remove();
|
|
return;
|
|
}
|
|
}
|
|
|
|
public static boolean canThaw(final Block block) {
|
|
return FROZEN_BLOCKS.containsKey(block);
|
|
}
|
|
|
|
public static void thaw(final Block block) {
|
|
if (FROZEN_BLOCKS.containsKey(block)) {
|
|
FROZEN_BLOCKS.get(block).revertBlock();
|
|
FROZEN_BLOCKS.remove(block);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void remove() {
|
|
this.bPlayer.addCooldown("WaterWave", this.cooldown);
|
|
}
|
|
|
|
@Override
|
|
public boolean isSneakAbility() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isHarmlessAbility() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public long getCooldown() {
|
|
return this.cooldown;
|
|
}
|
|
|
|
public void setCooldown(final long cooldown) {
|
|
this.cooldown = cooldown;
|
|
}
|
|
|
|
@Override
|
|
public Location getLocation() {
|
|
return this.origin;
|
|
}
|
|
|
|
public void setLocation(final Location location) {
|
|
this.origin = location;
|
|
}
|
|
|
|
@Override
|
|
public Object createNewComboInstance(final Player player) {
|
|
return new IceWave(player);
|
|
}
|
|
|
|
@Override
|
|
public ArrayList<AbilityInformation> getCombination() {
|
|
final ArrayList<AbilityInformation> iceWave = new ArrayList<>();
|
|
iceWave.add(new AbilityInformation("WaterSpout", ClickType.SHIFT_UP));
|
|
iceWave.add(new AbilityInformation("PhaseChange", ClickType.LEFT_CLICK));
|
|
return iceWave;
|
|
}
|
|
}
|