[SPIGOT-7944] MC 1.21.3: Null pointer in deprecated ItemMeta#setFireResistance Created: 03/Nov/24  Updated: 25/Dec/24  Resolved: 05/Nov/24

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: blablubbabc Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: 1.21.3, damage, resistance

Version: This server is running CraftBukkit version 4369-Spigot-e65d67a-285df6e (MC: 1.21.3) (Implementing API version 1.21.3-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

Plugin is built against an earlier Bukkit version.

Seems like the backwards compatibility mapping to the new setDamageResistant(DamageTypeTags.IS_FIRE); is not working.

java.lang.ExceptionInInitializerError: null
        at org.bukkit.craftbukkit.v1_21_R2.inventory.CraftMetaItem.setFireResistant(CraftMetaItem.java:1417) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4369-Spigot-e65d67a-285df6e]
        at com.nisovin.shopkeepers.compat.ServerAssumptionsTest.createComplexItemStack(ServerAssumptionsTest.java:185) ~[?:?]
        at com.nisovin.shopkeepers.compat.ServerAssumptionsTest.<init>(ServerAssumptionsTest.java:158) ~[?:?]
        at com.nisovin.shopkeepers.compat.ServerAssumptionsTest.run(ServerAssumptionsTest.java:69) ~[?:?]
        at com.nisovin.shopkeepers.SKShopkeepersPlugin.onEnable(SKShopkeepersPlugin.java:326) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:267) ~[spigot-api-1.21.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:342) ~[spigot-api-1.21.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:492) ~[spigot-api-1.21.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_21_R2.CraftServer.enablePlugin(CraftServer.java:579) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4369-Spigot-e65d67a-285df6e]
        at org.bukkit.craftbukkit.v1_21_R2.CraftServer.enablePlugins(CraftServer.java:493) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4369-Spigot-e65d67a-285df6e]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:656) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4369-Spigot-e65d67a-285df6e]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:441) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4369-Spigot-e65d67a-285df6e]
        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:268) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4369-Spigot-e65d67a-285df6e]
        at net.minecraft.server.MinecraftServer.y(MinecraftServer.java:1032) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4369-Spigot-e65d67a-285df6e]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:329) ~[spigot-1.21.3-R0.1-SNAPSHOT.jar:4369-Spigot-e65d67a-285df6e]
        at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]
Caused by: java.lang.NullPointerException
        at java.base/java.util.Objects.requireNonNull(Objects.java:233) ~[?:?]
        at org.bukkit.tag.DamageTypeTags.getTag(DamageTypeTags.java:163) ~[spigot-api-1.21.3-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.tag.DamageTypeTags.<clinit>(DamageTypeTags.java:36) ~[spigot-api-1.21.3-R0.1-SNAPSHOT.jar:?]
        ... 16 more


 Comments   
Comment by Doc [ 03/Nov/24 ]

PR created with a hotfix for just avoid DamageTypeTags can contain that nullable field https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/1077/overview

but if datapacks can just make another tags empty like BYPASSES_COOLDOWN then a proper solution need to be in the future.

Comment by Doc [ 03/Nov/24 ]

Okay the issue is how DamageTypeTags expects all the tags like NotNull but DamageTypeTags.BYPASSES_COOLDOWN just return null because vanilla declare the tag but not has values...

Generated at Mon Mar 24 19:11:51 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.