Skip to content

Commit

Permalink
Update spigot-api to 1.21.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Archy-X committed Nov 1, 2024
1 parent 6fab6db commit 7663e2c
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 43 deletions.
2 changes: 1 addition & 1 deletion api-bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies {
}
// api(files("../../Slate/build/libs/Slate-1.1.8-all.jar"))
compileOnly("org.jetbrains:annotations:24.1.0")
compileOnly("org.spigotmc:spigot-api:1.21.1-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.21.3-R0.1-SNAPSHOT")
}

tasks.withType<JavaCompile> {
Expand Down
2 changes: 1 addition & 1 deletion bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {
implementation("net.kyori:adventure-text-minimessage:4.16.0")
implementation("net.kyori:adventure-platform-bukkit:4.3.3")
compileOnly("org.jetbrains:annotations:24.1.0")
compileOnly("org.spigotmc:spigot-api:1.21.1-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.21.3-R0.1-SNAPSHOT")
compileOnly("me.clip:placeholderapi:2.11.6")
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.5") {
exclude("org.spigotmc", "spigot-api")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import dev.aurelium.auraskills.api.util.NumberUtil;
import dev.aurelium.auraskills.bukkit.AuraSkills;
import dev.aurelium.auraskills.bukkit.menus.shared.SkillItem;
import dev.aurelium.auraskills.bukkit.util.AttributeCompat;
import dev.aurelium.auraskills.common.leaderboard.SkillValue;
import dev.aurelium.auraskills.common.ui.ActionBarType;
import dev.aurelium.auraskills.common.user.User;
Expand All @@ -20,7 +21,6 @@
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -104,7 +104,7 @@ public String onPlaceholderRequest(Player player, String identifier) {

//Gets max hp
if (identifier.equals("hp_max")) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute != null) {
return String.valueOf(Math.round(attribute.getValue() * Traits.HP.optionDouble("action_bar_scaling")));
} else {
Expand All @@ -119,7 +119,7 @@ public String onPlaceholderRequest(Player player, String identifier) {

//Gets HP Percent as an integer
if (identifier.equals("hp_percent")) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute != null) {
return String.valueOf(Math.round(player.getHealth() / attribute.getValue()));
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.aurelium.auraskills.bukkit.loot.entity;

import dev.aurelium.auraskills.bukkit.AuraSkills;
import dev.aurelium.auraskills.bukkit.util.AttributeCompat;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
Expand Down Expand Up @@ -32,14 +32,14 @@ public Entity spawnEntity(AuraSkills plugin, Location location) {

if (entity instanceof LivingEntity livingEntity) {
if (getEntityProperties().health() != null) {
AttributeInstance attribute = livingEntity.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = livingEntity.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute != null) {
attribute.setBaseValue(getEntityProperties().health());
livingEntity.setHealth(Math.min(getEntityProperties().health(), attribute.getValue()));
}
}
if (properties.damage() != null) {
AttributeInstance attribute = livingEntity.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE);
AttributeInstance attribute = livingEntity.getAttribute(AttributeCompat.ATTACK_DAMAGE);
if (attribute != null) {
attribute.setBaseValue(getEntityProperties().damage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import dev.aurelium.auraskills.bukkit.AuraSkills;
import dev.aurelium.auraskills.bukkit.ability.AbilityImpl;
import dev.aurelium.auraskills.bukkit.item.BukkitPotionType;
import dev.aurelium.auraskills.bukkit.util.AttributeCompat;
import dev.aurelium.auraskills.bukkit.util.CompatUtil;
import dev.aurelium.auraskills.bukkit.util.PotionUtil;
import dev.aurelium.auraskills.common.message.type.AbilityMessage;
Expand All @@ -17,7 +18,6 @@
import dev.aurelium.auraskills.common.util.text.TextUtil;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
Expand Down Expand Up @@ -167,7 +167,7 @@ public void fleeting(EntityDamageEvent event, User user, Player player) {
if (isDisabled(ability)) return;
if (failsChecks(player, ability)) return;

AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute == null) return;

double maxHealth = attribute.getValue();
Expand Down Expand Up @@ -196,7 +196,7 @@ public void run() {
}

public void removeFleeting(Player player) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);

if (attribute == null) return;

Expand Down Expand Up @@ -227,7 +227,7 @@ private void fleetingRemove(Player player, double amountRegenerated) {

if (failsChecks(player, ability)) return;

AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute == null) return;

double maxHealth = attribute.getValue();
Expand Down Expand Up @@ -265,7 +265,7 @@ public void fleetingJoin(UserLoadEvent event) {

if (failsChecks(player, ability)) return;

AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute == null) return;

if (player.getHealth() < getFleetingHealthRequired() * attribute.getValue()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import dev.aurelium.auraskills.bukkit.ability.AbilityImpl;
import dev.aurelium.auraskills.bukkit.item.BukkitPotionType;
import dev.aurelium.auraskills.bukkit.skills.agility.AgilityAbilities;
import dev.aurelium.auraskills.bukkit.util.AttributeCompat;
import dev.aurelium.auraskills.bukkit.util.CompatUtil;
import dev.aurelium.auraskills.bukkit.util.PotionUtil;
import dev.aurelium.auraskills.common.message.type.AbilityMessage;
Expand All @@ -19,7 +20,6 @@
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.OfflinePlayer;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -367,15 +367,15 @@ public void lifeSteal(EntityDeathEvent event) {

User user = plugin.getUser(player);

AttributeInstance entityAttribute = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance entityAttribute = entity.getAttribute(AttributeCompat.MAX_HEALTH);
if (entityAttribute == null) return;

// Get the health to regen from a percent of the mob's health
double maxHealth = entityAttribute.getValue();
double percent = getValue(ability, user) / 100;
double healthRegen = maxHealth * percent;

AttributeInstance playerAttribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance playerAttribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (playerAttribute == null) return;

player.setHealth(player.getHealth() + Math.min(healthRegen, playerAttribute.getValue() - player.getHealth()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import dev.aurelium.auraskills.api.util.NumberUtil;
import dev.aurelium.auraskills.bukkit.AuraSkills;
import dev.aurelium.auraskills.bukkit.ability.AbilityImpl;
import dev.aurelium.auraskills.bukkit.util.AttributeCompat;
import dev.aurelium.auraskills.bukkit.util.CompatUtil;
import dev.aurelium.auraskills.bukkit.util.VersionUtils;
import dev.aurelium.auraskills.common.user.User;
import dev.aurelium.auraskills.common.util.text.TextUtil;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.attribute.AttributeModifier.Operation;
Expand Down Expand Up @@ -106,7 +106,7 @@ public void stun(Player player, User user, LivingEntity entity) {
if (failsChecks(player, ability)) return;

if (rand.nextDouble() < (getValue(ability, user) / 100)) {
AttributeInstance speed = entity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
AttributeInstance speed = entity.getAttribute(AttributeCompat.MOVEMENT_SPEED);
if (speed == null) return;
// Check if there already is a stun modifier
for (AttributeModifier existingModifier : speed.getModifiers()) {
Expand Down Expand Up @@ -139,7 +139,7 @@ public void stun(Player player, User user, LivingEntity entity) {

private void scheduleStunRemoval(LivingEntity entity) {
plugin.getScheduler().scheduleSync(() -> {
AttributeInstance newSpeed = entity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
AttributeInstance newSpeed = entity.getAttribute(AttributeCompat.MOVEMENT_SPEED);
if (newSpeed == null) return;
for (AttributeModifier attributeModifier : newSpeed.getModifiers()) {
if (isStunModifier(attributeModifier)) {
Expand All @@ -152,7 +152,7 @@ private void scheduleStunRemoval(LivingEntity entity) {
@EventHandler
public void removeStun(PlayerQuitEvent event) {
// Removes stun on logout
AttributeInstance speed = event.getPlayer().getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
AttributeInstance speed = event.getPlayer().getAttribute(AttributeCompat.MOVEMENT_SPEED);
if (speed == null) return;

for (AttributeModifier attributeModifier : speed.getModifiers()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import dev.aurelium.auraskills.bukkit.AuraSkills;
import dev.aurelium.auraskills.bukkit.ability.AbilityImpl;
import dev.aurelium.auraskills.bukkit.user.BukkitUser;
import dev.aurelium.auraskills.bukkit.util.AttributeCompat;
import dev.aurelium.auraskills.common.user.User;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -64,7 +64,7 @@ else if (event.getRegainReason().equals(EntityRegainHealthEvent.RegainReason.SAT
if (isDisabled(ability)) return;
if (failsChecks(player, ability)) return;
// Gets health
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute == null) return;

double currentHealth = player.getHealth();
Expand All @@ -89,7 +89,7 @@ public void recoveryCustom(CustomRegenEvent event) {

User user = plugin.getUser(player);
// Gets health
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute == null) return;

double currentHealth = player.getHealth();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import dev.aurelium.auraskills.api.mana.ManaAbilities;
import dev.aurelium.auraskills.bukkit.AuraSkills;
import dev.aurelium.auraskills.bukkit.mana.ReadiedManaAbility;
import dev.aurelium.auraskills.bukkit.util.AttributeCompat;
import dev.aurelium.auraskills.bukkit.util.VersionUtils;
import dev.aurelium.auraskills.common.message.type.ManaAbilityMessage;
import dev.aurelium.auraskills.common.user.User;
import org.bukkit.NamespacedKey;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.attribute.AttributeModifier.Operation;
Expand Down Expand Up @@ -38,7 +38,7 @@ public LightningBlade(AuraSkills plugin) {
@Override
@SuppressWarnings("removal")
public void onActivate(Player player, User user) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
AttributeInstance attribute = player.getAttribute(AttributeCompat.ATTACK_SPEED);
if (attribute == null) return;

// Remove existing modifier if exists
Expand All @@ -61,7 +61,7 @@ public void onActivate(Player player, User user) {

@Override
public void onStop(Player player, User user) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
AttributeInstance attribute = player.getAttribute(AttributeCompat.ATTACK_SPEED);
if (attribute == null) return;

for (AttributeModifier modifier : attribute.getModifiers()) {
Expand Down Expand Up @@ -125,7 +125,7 @@ public void lightningBladeJoin(PlayerJoinEvent event) {
return;
}
// Remove attack speed attribute modifier
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
AttributeInstance attribute = player.getAttribute(AttributeCompat.ATTACK_SPEED);
if (attribute == null) return;
for (AttributeModifier modifier : attribute.getModifiers()) {
if (modifier.getName().equals("AureliumSkills-LightningBlade")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
import dev.aurelium.auraskills.bukkit.AuraSkills;
import dev.aurelium.auraskills.bukkit.hooks.mythicmobs.MythicMobsHook;
import dev.aurelium.auraskills.bukkit.skills.fighting.FightingAbilities;
import dev.aurelium.auraskills.bukkit.util.AttributeCompat;
import dev.aurelium.auraskills.common.config.Option;
import dev.aurelium.auraskills.common.source.SourceTypes;
import dev.aurelium.auraskills.common.user.User;
import dev.aurelium.auraskills.common.util.data.Pair;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -317,7 +317,7 @@ private Player getBleedDamager(Entity entity) {
private double getDamageMultiplier(LivingEntity entity, EntityXpSource source, EntityDamageEvent event) {
double damageDealt = Math.min(entity.getHealth(), event.getFinalDamage());
if (source.scaleXpWithHealth()) {
AttributeInstance healthAttribute = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance healthAttribute = entity.getAttribute(AttributeCompat.MAX_HEALTH);
if (healthAttribute != null) {
double maxHealth = healthAttribute.getValue();
return damageDealt / maxHealth; // XP gain is damage/maxHealth * sourceXp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import dev.aurelium.auraskills.api.trait.Traits;
import dev.aurelium.auraskills.api.util.NumberUtil;
import dev.aurelium.auraskills.bukkit.AuraSkills;
import dev.aurelium.auraskills.bukkit.util.AttributeCompat;
import dev.aurelium.auraskills.common.scheduler.TaskRunnable;
import dev.aurelium.auraskills.common.user.User;
import org.bukkit.Bukkit;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand Down Expand Up @@ -110,7 +110,7 @@ private void handleCustomRegen(Player player, Trait trait, Function<Player, Bool

if (player.isDead()) return;

AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute == null) return;

if (!(player.getHealth() < attribute.getValue())) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import dev.aurelium.auraskills.api.util.NumberUtil;
import dev.aurelium.auraskills.bukkit.AuraSkills;
import dev.aurelium.auraskills.bukkit.skills.agility.AgilityAbilities;
import dev.aurelium.auraskills.bukkit.util.AttributeCompat;
import dev.aurelium.auraskills.bukkit.util.VersionUtils;
import dev.aurelium.auraskills.common.user.User;
import dev.aurelium.auraskills.common.util.data.DataUtil;
import org.bukkit.NamespacedKey;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.attribute.AttributeModifier.Operation;
Expand Down Expand Up @@ -53,7 +53,7 @@ public class HpTrait extends TraitImpl {

@Override
public double getBaseLevel(Player player, Trait trait) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute == null) return 0.0;
double current = attribute.getValue();
// Subtract skills attribute value
Expand Down Expand Up @@ -112,7 +112,7 @@ private void setWorldChange(PlayerChangedWorldEvent event, Player player, User u
return;
}

var attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
var attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
double maxHealth = attribute == null ? 20.0 : attribute.getValue();

double newHealth = worldChangeHealth.get(playerID);
Expand All @@ -129,7 +129,7 @@ private void setHealth(Player player, User user) {
Trait trait = Traits.HP;

double modifier = user.getBonusTraitLevel(trait);
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute == null) return;
double originalMaxHealth = attribute.getValue();
boolean hasChange = true;
Expand Down Expand Up @@ -206,7 +206,7 @@ private boolean isSkillsHealthModifier(AttributeModifier am) {
}

private void applyScaling(Player player) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
AttributeInstance attribute = player.getAttribute(AttributeCompat.MAX_HEALTH);
if (attribute == null) return;

if (Traits.HP.isEnabled() && Traits.HP.optionBoolean("health_scaling", true)) {
Expand Down
Loading

0 comments on commit 7663e2c

Please sign in to comment.