Skip to content

Commit

Permalink
Fix AnvilView version checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Archy-X committed Sep 21, 2024
1 parent 5265805 commit 88f352e
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.21.1-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 @@ -170,7 +170,7 @@ public void anvilMaster(InventoryOpenEvent event) {

int maxCost = (int) Math.round(getValue(ability, user));

if (VersionUtils.isAtLeastVersion(21)) {
if (VersionUtils.isAtLeastVersion(21, 1)) {
if (event.getView() instanceof AnvilView view) {
view.setMaximumRepairCost(maxCost);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public LightningBlade(AuraSkills plugin) {
}

@Override
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
public void onActivate(Player player, User user) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
if (attribute == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void onAnvilCombine(InventoryClickEvent event) {
@SuppressWarnings("removal")
private double getRepairCostMultiplier(AnvilXpSource source, AnvilInventory anvil, Skill skill, InventoryClickEvent event) {
int repairCost = 1;
if (VersionUtils.isAtLeastVersion(21)) {
if (VersionUtils.isAtLeastVersion(21, 1)) {
if (event.getView() instanceof AnvilView view) {
repairCost = view.getRepairCost();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void onAnvilPrepare(PrepareAnvilEvent event) {
}
if (user != null) {
double wisdom = user.getEffectiveTraitLevel(Traits.ANVIL_DISCOUNT);
if (VersionUtils.isAtLeastVersion(21)) {
if (VersionUtils.isAtLeastVersion(21, 1)) {
AnvilView view = event.getView();
int repairCost = view.getRepairCost();
int cost = (int) Math.round(repairCost * (1 - getDiscount(wisdom)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private void setWorldChange(PlayerChangedWorldEvent event, Player player, User u
worldChangeHealth.remove(playerID);
}

@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
private void setHealth(Player player, User user) {
Trait trait = Traits.HP;

Expand Down Expand Up @@ -187,9 +187,8 @@ private void setHealth(Player player, User user) {
applyScaling(player);
}

@SuppressWarnings("deprecation")
private boolean isSkillsHealthModifier(AttributeModifier am) {
if (am.getName().equals("skillsHealth") || am.getUniqueId().equals(ATTRIBUTE_ID)) {
if (am.getName().equals("skillsHealth")) {
return true;
}
if (VersionUtils.isAtLeastVersion(21)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void worldChange(PlayerChangedWorldEvent event) {
setLuck(event.getPlayer());
}

@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
private void setLuck(Player player) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_LUCK);
if (attribute == null) {
Expand Down

0 comments on commit 88f352e

Please sign in to comment.