Skip to content

Commit

Permalink
Fix IncompatibleClassChangeError by reverting spigot-api to 1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Archy-X committed Nov 5, 2024
1 parent 23d82cc commit 7226d7e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 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.3-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.21.1-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.3-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
@@ -1,7 +1,7 @@
package dev.aurelium.auraskills.bukkit.storage;

import de.tr7zw.changeme.nbtapi.NBTCompoundList;
import de.tr7zw.changeme.nbtapi.NBTFile;
import de.tr7zw.changeme.nbtapi.NBT;
import de.tr7zw.changeme.nbtapi.iface.NBTFileHandle;
import de.tr7zw.changeme.nbtapi.iface.ReadWriteNBT;
import de.tr7zw.changeme.nbtapi.iface.ReadWriteNBTCompoundList;
import dev.aurelium.auraskills.bukkit.util.VersionUtils;
Expand All @@ -26,7 +26,7 @@ public void removeAttributes(CommandSender sender) {
File playerFile = new File(playerDataFolder, player.getUniqueId() + ".dat");
if (playerFile.exists() && playerFile.canWrite()) {
try {
NBTFile nbtFile = new NBTFile(playerFile);
NBTFileHandle nbtFile = NBT.getFileHandle(playerFile);
if (VersionUtils.isAtLeastVersion(21)) {
if (removePlayer(nbtFile)) {
successful++;
Expand All @@ -45,8 +45,8 @@ public void removeAttributes(CommandSender sender) {
sender.sendMessage("Searched " + total + " offline players. Successfully removed attributes from " + successful + " players. Failed to remove on " + error + " players.");
}

private boolean removePlayer(NBTFile nbtFile) throws IOException {
NBTCompoundList compoundList = nbtFile.getCompoundList("attributes");
private boolean removePlayer(NBTFileHandle nbtFile) throws IOException {
ReadWriteNBTCompoundList compoundList = nbtFile.getCompoundList("attributes");
if (compoundList == null) {
return false;
}
Expand Down Expand Up @@ -75,8 +75,8 @@ private boolean removePlayer(NBTFile nbtFile) throws IOException {
return false;
}

private boolean removeLegacyPlayer(NBTFile nbtFile) throws IOException {
NBTCompoundList compoundList = nbtFile.getCompoundList("Attributes");
private boolean removeLegacyPlayer(NBTFileHandle nbtFile) throws IOException {
ReadWriteNBTCompoundList compoundList = nbtFile.getCompoundList("Attributes");
if (compoundList == null) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ public class AttributeCompat {
public static Attribute LUCK;

static {
/*
Saved for updating to spigot-api 1.21.3+
if (VersionUtils.isAtLeastVersion(21, 2)) {
MAX_HEALTH = Attribute.MAX_HEALTH;
MOVEMENT_SPEED = Attribute.MOVEMENT_SPEED;
ATTACK_DAMAGE = Attribute.ATTACK_DAMAGE;
ATTACK_SPEED = Attribute.ATTACK_SPEED;
LUCK = Attribute.LUCK;
} else {
MAX_HEALTH = fromRegistry("generic.max_health");
MOVEMENT_SPEED = fromRegistry("generic.movement_speed");
ATTACK_DAMAGE = fromRegistry("generic.attack_damage");
ATTACK_SPEED = fromRegistry("generic.attack_speed");
LUCK = fromRegistry("generic.luck");
}
*/
MAX_HEALTH = fromRegistry("generic.max_health");
MOVEMENT_SPEED = fromRegistry("generic.movement_speed");
ATTACK_DAMAGE = fromRegistry("generic.attack_damage");
ATTACK_SPEED = fromRegistry("generic.attack_speed");
LUCK = fromRegistry("generic.luck");
}

private static Attribute fromRegistry(String key) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.aurelium.auraskills.bukkit.util;

import de.tr7zw.changeme.nbtapi.NBT;
import de.tr7zw.changeme.nbtapi.NBTContainer;
import de.tr7zw.changeme.nbtapi.iface.ReadWriteNBT;
import dev.aurelium.auraskills.api.item.ItemContext;
import dev.aurelium.auraskills.api.registry.NamespacedId;
Expand Down Expand Up @@ -382,7 +381,7 @@ private void applyMapToNBT(ReadWriteNBT item, Map<Object, ? extends Configuratio
}

private void parseNBTString(ItemStack item, String nbtString) {
NBTContainer container = new NBTContainer(nbtString);
ReadWriteNBT container = NBT.parseNBT(nbtString);
NBT.modify(item, nbt -> {
nbt.mergeCompound(container);
});
Expand Down

0 comments on commit 7226d7e

Please sign in to comment.