mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 07:55:05 +00:00
1.9.2 (#1153)
## 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.
This commit is contained in:
parent
787b303c9f
commit
75c4f41be5
10 changed files with 1058 additions and 1050 deletions
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.projectkorra</groupId>
|
||||
<artifactId>projectkorra</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<version>1.9.2</version>
|
||||
<name>ProjectKorra</name>
|
||||
<repositories>
|
||||
<!-- local jar files, add more using: mvn install:install-file -Dfile=aaa.jar -DgroupId=aaa -DartifactId=aaa -Dversion=aaa -Dpackaging=jar -DlocalRepositoryPath=path/to/ProjectKorra/localrepo/ -->
|
||||
|
|
|
@ -119,8 +119,6 @@ import com.projectkorra.projectkorra.util.BlockCacheElement;
|
|||
import com.projectkorra.projectkorra.util.ColoredParticle;
|
||||
import com.projectkorra.projectkorra.util.MovementHandler;
|
||||
import com.projectkorra.projectkorra.util.ParticleEffect;
|
||||
import com.projectkorra.projectkorra.util.ReflectionHandler;
|
||||
import com.projectkorra.projectkorra.util.ReflectionHandler.PackageType;
|
||||
import com.projectkorra.projectkorra.util.TempArmor;
|
||||
import com.projectkorra.projectkorra.util.TempArmorStand;
|
||||
import com.projectkorra.projectkorra.util.TempBlock;
|
||||
|
@ -149,20 +147,8 @@ public class GeneralMethods {
|
|||
private static final ArrayList<Ability> INVINCIBLE = new ArrayList<>();
|
||||
private static ProjectKorra plugin;
|
||||
|
||||
private static Method getAbsorption;
|
||||
private static Method setAbsorption;
|
||||
private static Method getHandle;
|
||||
|
||||
public GeneralMethods(final ProjectKorra plugin) {
|
||||
GeneralMethods.plugin = plugin;
|
||||
|
||||
try {
|
||||
getAbsorption = ReflectionHandler.getMethod("EntityHuman", PackageType.MINECRAFT_SERVER, "getAbsorptionHearts");
|
||||
setAbsorption = ReflectionHandler.getMethod("EntityHuman", PackageType.MINECRAFT_SERVER, "setAbsorptionHearts", Float.class);
|
||||
getHandle = ReflectionHandler.getMethod("CraftPlayer", PackageType.CRAFTBUKKIT_ENTITY, "getHandle");
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -675,26 +661,25 @@ public class GeneralMethods {
|
|||
ActionBar.sendActionBar(displayedMessage, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of absorption hearts of a specified {@link Player}.
|
||||
* @param player the {@link Player} to get the absorption hearts of.
|
||||
* @deprecated Use {@link Player#getAbsorptionAmount()}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static float getAbsorbationHealth(final Player player) {
|
||||
|
||||
try {
|
||||
final Object entityplayer = getHandle.invoke(player);
|
||||
final Object hearts = getAbsorption.invoke(entityplayer);
|
||||
return (float) hearts;
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
return (float) player.getAbsorptionAmount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of absorption hearts of a specified {@link Player}.
|
||||
* @param player the {@link Player} to set the absorption hearts of.
|
||||
* @param hearts a float representing the number of hearts to set.
|
||||
* @deprecated Use {@link Player#setAbsorptionAmount(double)}
|
||||
*/
|
||||
@Deprecated
|
||||
public static void setAbsorbationHealth(final Player player, final float hearts) {
|
||||
|
||||
try {
|
||||
final Object entityplayer = getHandle.invoke(player);
|
||||
setAbsorption.invoke(entityplayer, hearts);
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
player.setAbsorptionAmount(hearts);
|
||||
}
|
||||
|
||||
public static int getArmorTier(Material mat) {
|
||||
|
|
|
@ -3,46 +3,46 @@ package com.projectkorra.projectkorra.attribute;
|
|||
public enum AttributeModifier {
|
||||
|
||||
ADDITION((oldValue, modifier) -> {
|
||||
if (oldValue instanceof Double || modifier instanceof Double) {
|
||||
if (oldValue instanceof Double) {
|
||||
return oldValue.doubleValue() + modifier.doubleValue();
|
||||
} else if (oldValue instanceof Float || modifier instanceof Float) {
|
||||
} else if (oldValue instanceof Float) {
|
||||
return oldValue.floatValue() + modifier.floatValue();
|
||||
} else if (oldValue instanceof Long || modifier instanceof Long) {
|
||||
} else if (oldValue instanceof Long) {
|
||||
return oldValue.longValue() + modifier.longValue();
|
||||
} else if (oldValue instanceof Integer || modifier instanceof Integer) {
|
||||
} else if (oldValue instanceof Integer) {
|
||||
return oldValue.intValue() + modifier.intValue();
|
||||
}
|
||||
return 0;
|
||||
}), SUBTRACTION((oldValue, modifier) -> {
|
||||
if (oldValue instanceof Double || modifier instanceof Double) {
|
||||
if (oldValue instanceof Double) {
|
||||
return oldValue.doubleValue() - modifier.doubleValue();
|
||||
} else if (oldValue instanceof Float || modifier instanceof Float) {
|
||||
} else if (oldValue instanceof Float) {
|
||||
return oldValue.floatValue() - modifier.floatValue();
|
||||
} else if (oldValue instanceof Long || modifier instanceof Long) {
|
||||
} else if (oldValue instanceof Long) {
|
||||
return oldValue.longValue() - modifier.longValue();
|
||||
} else if (oldValue instanceof Integer || modifier instanceof Integer) {
|
||||
} else if (oldValue instanceof Integer) {
|
||||
return oldValue.intValue() - modifier.intValue();
|
||||
}
|
||||
return 0;
|
||||
}), MULTIPLICATION((oldValue, modifier) -> {
|
||||
if (oldValue instanceof Double || modifier instanceof Double) {
|
||||
if (oldValue instanceof Double) {
|
||||
return oldValue.doubleValue() * modifier.doubleValue();
|
||||
} else if (oldValue instanceof Float || modifier instanceof Float) {
|
||||
} else if (oldValue instanceof Float) {
|
||||
return oldValue.floatValue() * modifier.floatValue();
|
||||
} else if (oldValue instanceof Long || modifier instanceof Long) {
|
||||
} else if (oldValue instanceof Long) {
|
||||
return oldValue.longValue() * modifier.longValue();
|
||||
} else if (oldValue instanceof Integer || modifier instanceof Integer) {
|
||||
} else if (oldValue instanceof Integer) {
|
||||
return oldValue.intValue() * modifier.intValue();
|
||||
}
|
||||
return 0;
|
||||
}), DIVISION((oldValue, modifier) -> {
|
||||
if (oldValue instanceof Double || modifier instanceof Double) {
|
||||
if (oldValue instanceof Double) {
|
||||
return oldValue.doubleValue() / modifier.doubleValue();
|
||||
} else if (oldValue instanceof Float || modifier instanceof Float) {
|
||||
} else if (oldValue instanceof Float) {
|
||||
return oldValue.floatValue() / modifier.floatValue();
|
||||
} else if (oldValue instanceof Long || modifier instanceof Long) {
|
||||
} else if (oldValue instanceof Long) {
|
||||
return oldValue.longValue() / modifier.longValue();
|
||||
} else if (oldValue instanceof Integer || modifier instanceof Integer) {
|
||||
} else if (oldValue instanceof Integer) {
|
||||
return oldValue.intValue() / modifier.intValue();
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -96,9 +96,11 @@ public class DisplayCommand extends PKCommand {
|
|||
}
|
||||
|
||||
final CoreAbility coreAbil = CoreAbility.getAbility(comboAbil);
|
||||
if (coreAbil != null) {
|
||||
comboColor = coreAbil.getElement().getColor();
|
||||
if (coreAbil == null || coreAbil.isHiddenAbility()) {
|
||||
continue;
|
||||
}
|
||||
comboColor = coreAbil.getElement().getColor();
|
||||
|
||||
String message = (comboColor + comboAbil);
|
||||
|
||||
if (coreAbil instanceof AddonAbility) {
|
||||
|
@ -127,9 +129,10 @@ public class DisplayCommand extends PKCommand {
|
|||
}
|
||||
|
||||
final CoreAbility coreAbil = CoreAbility.getAbility(comboMove);
|
||||
if (coreAbil != null) {
|
||||
comboColor = coreAbil.getElement().getColor();
|
||||
if (coreAbil == null || coreAbil.isHiddenAbility()) {
|
||||
continue;
|
||||
}
|
||||
comboColor = coreAbil.getElement().getColor();
|
||||
|
||||
String message = (comboColor + comboMove);
|
||||
|
||||
|
@ -157,9 +160,11 @@ public class DisplayCommand extends PKCommand {
|
|||
}
|
||||
|
||||
final CoreAbility coreAbil = CoreAbility.getAbility(passiveAbil);
|
||||
if (coreAbil != null) {
|
||||
passiveColor = coreAbil.getElement().getColor();
|
||||
if (coreAbil == null || coreAbil.isHiddenAbility()) {
|
||||
continue;
|
||||
}
|
||||
passiveColor = coreAbil.getElement().getColor();
|
||||
|
||||
String message = (passiveColor + passiveAbil);
|
||||
|
||||
if (coreAbil instanceof AddonAbility) {
|
||||
|
@ -188,9 +193,11 @@ public class DisplayCommand extends PKCommand {
|
|||
}
|
||||
|
||||
final CoreAbility coreAbil = CoreAbility.getAbility(passiveAbil);
|
||||
if (coreAbil != null) {
|
||||
passiveColor = coreAbil.getElement().getColor();
|
||||
if (coreAbil == null || coreAbil.isHiddenAbility()) {
|
||||
continue;
|
||||
}
|
||||
passiveColor = coreAbil.getElement().getColor();
|
||||
|
||||
sender.sendMessage(passiveColor + passiveAbil);
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -94,6 +94,10 @@ public class WhoCommand extends PKCommand {
|
|||
}
|
||||
final List<String> players = new ArrayList<String>();
|
||||
for (final Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (sender instanceof Player && !((Player) sender).canSee(player)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final String playerName = player.getName();
|
||||
String result = "";
|
||||
BendingPlayer bp = BendingPlayer.getBendingPlayer(playerName);
|
||||
|
@ -150,12 +154,13 @@ public class WhoCommand extends PKCommand {
|
|||
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + "Player not found!");
|
||||
return;
|
||||
}
|
||||
if (!player.isOnline() && !BendingPlayer.getPlayers().containsKey(player.getUniqueId())) {
|
||||
GeneralMethods.sendBrandingMessage(sender, ChatColor.GRAY + this.playerOffline.replace("{player}", ChatColor.WHITE + player.getName() + ChatColor.GRAY).replace("{target}", ChatColor.WHITE + player.getName() + ChatColor.GRAY));
|
||||
}
|
||||
|
||||
|
||||
final Player player_ = (Player) (player.isOnline() ? player : null);
|
||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||
|
||||
if ((!player.isOnline() && !BendingPlayer.getPlayers().containsKey(player.getUniqueId())) || (sender instanceof Player && player_ != null && !((Player) sender).canSee(player_))) {
|
||||
GeneralMethods.sendBrandingMessage(sender, ChatColor.GRAY + this.playerOffline.replace("{player}", ChatColor.WHITE + player.getName() + ChatColor.GRAY).replace("{target}", ChatColor.WHITE + player.getName() + ChatColor.GRAY));
|
||||
}
|
||||
|
||||
if (bPlayer == null) {
|
||||
GeneralMethods.createBendingPlayer(player.getUniqueId(), playerName);
|
||||
|
|
|
@ -1290,6 +1290,8 @@ public class ConfigManager {
|
|||
config.addDefault("Abilities.Earth.EarthSmash.Damage", 5);
|
||||
config.addDefault("Abilities.Earth.EarthSmash.Knockback", 3.5);
|
||||
config.addDefault("Abilities.Earth.EarthSmash.Knockup", 0.15);
|
||||
config.addDefault("Abilities.Earth.EarthSmash.Lift.Knockup", 1.1);
|
||||
config.addDefault("Abilities.Earth.EarthSmash.Lift.Range", 3.5);
|
||||
config.addDefault("Abilities.Earth.EarthSmash.Flight.Enabled", true);
|
||||
config.addDefault("Abilities.Earth.EarthSmash.Flight.Speed", 0.72);
|
||||
config.addDefault("Abilities.Earth.EarthSmash.Flight.Duration", 3000);
|
||||
|
|
|
@ -45,7 +45,7 @@ public class EarthArmor extends EarthAbility {
|
|||
private Location legsBlockLocation;
|
||||
private boolean active;
|
||||
private PotionEffect oldAbsorbtion = null;
|
||||
private float goldHearts;
|
||||
private double goldHearts;
|
||||
@Attribute("GoldHearts")
|
||||
private int maxGoldHearts;
|
||||
private TempArmor armor;
|
||||
|
@ -145,7 +145,7 @@ public class EarthArmor extends EarthAbility {
|
|||
this.player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, Integer.MAX_VALUE, level, true, false));
|
||||
|
||||
this.goldHearts = this.maxGoldHearts * 2;
|
||||
GeneralMethods.setAbsorbationHealth(this.player, this.goldHearts);
|
||||
this.player.setAbsorptionAmount(this.goldHearts);
|
||||
}
|
||||
|
||||
private boolean inPosition() {
|
||||
|
@ -249,7 +249,7 @@ public class EarthArmor extends EarthAbility {
|
|||
if (this.formed) {
|
||||
if (!this.player.hasPotionEffect(PotionEffectType.ABSORPTION)) {
|
||||
this.player.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, Integer.MAX_VALUE, 1, true, false));
|
||||
GeneralMethods.setAbsorbationHealth(this.player, this.goldHearts);
|
||||
this.player.setAbsorptionAmount(this.goldHearts);
|
||||
}
|
||||
|
||||
if (!this.active) {
|
||||
|
@ -301,7 +301,7 @@ public class EarthArmor extends EarthAbility {
|
|||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
abil.goldHearts = GeneralMethods.getAbsorbationHealth(EarthArmor.this.player);
|
||||
abil.goldHearts = EarthArmor.this.player.getAbsorptionAmount();
|
||||
if (abil.formed && abil.goldHearts < 0.9F) {
|
||||
abil.bPlayer.addCooldown(abil);
|
||||
|
||||
|
@ -601,7 +601,7 @@ public class EarthArmor extends EarthAbility {
|
|||
this.cooldown = cooldown;
|
||||
}
|
||||
|
||||
public float getGoldHearts() {
|
||||
public double getGoldHearts() {
|
||||
return this.goldHearts;
|
||||
}
|
||||
|
||||
|
@ -609,7 +609,7 @@ public class EarthArmor extends EarthAbility {
|
|||
return this.maxGoldHearts;
|
||||
}
|
||||
|
||||
public void setGoldHearts(final float goldHearts) {
|
||||
public void setGoldHearts(final double goldHearts) {
|
||||
this.goldHearts = goldHearts;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -371,7 +371,7 @@ public class WaterSpoutWave extends WaterAbility {
|
|||
final BukkitRunnable br = new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
WaterSpoutWave.this.createBlock(block, mat);
|
||||
WaterSpoutWave.this.createBlock(block, block.getLocation().distance(player.getLocation()) >= 1.6 ? mat : Material.WATER);
|
||||
}
|
||||
};
|
||||
br.runTaskLater(ProjectKorra.plugin, delay);
|
||||
|
|
|
@ -27,6 +27,10 @@ public class IceWave extends IceAbility implements ComboAbility {
|
|||
public IceWave(final Player player) {
|
||||
super(player);
|
||||
|
||||
if (!hasAbility(player, WaterSpoutWave.class)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.bPlayer.canBendIgnoreBindsCooldowns(this)) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue