andrei923 / LeafSK

LeafSK is just a mix of skript addons.
8 stars 1 forks source link

NBT error #12

Open KickHolse opened 2 years ago

KickHolse commented 2 years ago

Hello! Could you update the NBT Api within the plugin? when I try to use it says it needs to update and I can't :(

andrei923 commented 2 years ago

LeafSK-2.3.8-SNAPSHOT.zip

KickHolse commented 2 years ago

constructor NBTContainer# called with ({Unbreakable:1,HideFlags:4,SkullOwner:{Id:"a0fd7e20-22e1-4426-bbbe-1848931f9948",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWM3Nzg1NThiM2U4NThhOTJlM2EzMTk3MWQ5NWViNDMxNmZiODY4OTgyYzBmMzgwYWFhMzhiNjkwY2M0MWNlOCJ9fX0="}]}}} (String)) threw a NbtApiException: [?]The object 'class java.lang.String' is not a valid NBT-Object!

[Skript] method NBTItem#mergeCompound called with (null (Null)) threw a NullPointerException: null

KickHolse commented 2 years ago

?

andrei923 commented 2 years ago

No idea why, probably can be solved from the script file,

[Skript] method NBTItem#mergeCompound called with (null (Null)) threw a NullPointerException: null

KickHolse commented 2 years ago

how do you work?

KickHolse commented 2 years ago

I took a look and apparently the problem is with %string%, it must not be accepting strings, do you have any idea how to solve it?

expression %item% with [custom] nbt %string%:
    return type: item
    get:
        if expr-1 = air:
            return
        set {_nbti} to new NBTItem(expr-1)
        {_nbti}.mergeCompound(new NBTContainer(expr-2))
        return {_nbti}.getItem()

https://github.com/tr7zw/Item-NBT-API/blob/master/item-nbt-api/src/main/java/de/tr7zw/changeme/nbtapi/NBTContainer.java

public NBTContainer(Object nbt) {
    super(null, null);
    if (nbt == null) {
        throw new NullPointerException("The NBT-Object can't be null!");
    }
    if (!ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz().isAssignableFrom(nbt.getClass())) {
        throw new NbtApiException("The object '" + nbt.getClass() + "' is not a valid NBT-Object!");
    }
    this.nbt = nbt;
}