BetterGUI-MC / Issue-Tracker

The issue tracker for BetterGUI
0 stars 0 forks source link

[FEATURE] Drop support for Base64 value in Skull Modifier #13

Closed HSGamer closed 11 months ago

HSGamer commented 11 months ago

Type

Plugin

Specific

Skull Modifier

Content

It piqued my interest that an exception happens in recent versions when we use URL or Base64 as values in skull or head.

The exception (turns out it was a Spigot bug):

Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.profile.PlayerProfile.getTextures()" because "ownerProfile" is null
    at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaSkull.applyToItem(CraftMetaSkull.java:148) ~[paper-1.20.2.jar:git-Paper-249]
    at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack.setItemMeta(CraftItemStack.java:659) ~[paper-1.20.2.jar:git-Paper-249]
    at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftItemStack.asNMSCopy(CraftItemStack.java:60) ~[paper-1.20.2.jar:git-Paper-249]
    at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftInventory.setItem(CraftInventory.java:99) ~[paper-1.20.2.jar:git-Paper-249]
    at me.hsgamer.bettergui.lib.core.bukkit.gui.BukkitGUIDisplay.setButton(BukkitGUIDisplay.java:56) ~[bettergui-8.8-shaded.jar:?]
    at me.hsgamer.bettergui.lib.core.minecraft.gui.InventoryGUIDisplay.lambda$update$0(InventoryGUIDisplay.java:80) ~[bettergui-8.8-shaded.jar:?]
    at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
    at me.hsgamer.bettergui.lib.core.minecraft.gui.InventoryGUIDisplay.lambda$update$1(InventoryGUIDisplay.java:75) ~[bettergui-8.8-shaded.jar:?]
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) ~[?:?]
    at me.hsgamer.bettergui.lib.core.minecraft.gui.InventoryGUIDisplay.update(InventoryGUIDisplay.java:70) ~[bettergui-8.8-shaded.jar:?]
    at me.hsgamer.bettergui.lib.core.minecraft.gui.InventoryGUIDisplay.init(InventoryGUIDisplay.java:55) ~[bettergui-8.8-shaded.jar:?]
    at me.hsgamer.bettergui.lib.core.ui.BaseHolder.lambda$createDisplay$0(BaseHolder.java:42) ~[bettergui-8.8-shaded.jar:?]
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) ~[?:?]
    at me.hsgamer.bettergui.lib.core.ui.BaseHolder.createDisplay(BaseHolder.java:40) ~[bettergui-8.8-shaded.jar:?]
    at me.hsgamer.bettergui.menu.BaseInventoryMenu.create(BaseInventoryMenu.java:285) ~[bettergui-8.8-shaded.jar:?]
    at me.hsgamer.bettergui.manager.MenuCommandManager$1.execute(MenuCommandManager.java:40) ~[bettergui-8.8-shaded.jar:?]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.20.2-R0.1-SNAPSHOT.jar:?]
    ... 22 more

Upon investigation, I found out about the new Profile API, and people keep recommending it instead of the old Reflection method.

It does things easier, but there is no method for Base64.

As we know, the Base64 value of the skull is just a "messy wrapper" of the URL of it.

Therefore, I don't think it's necessary to handle Base64 while keeping the modifier working in the latest versions.

So, I planned to remove it, as we support only Name, UUID and URL officially.

Alternative

No response

Screenshots & Links

No response

HSGamer commented 11 months ago

The exception was a Spigot bug. https://github.com/PaperMC/Paper/issues/9875

They will fix it eventually.

Still, I'll drop Base64 and use the new Profile API as it's cleaner and more future-proof.

HSGamer commented 11 months ago

Finished