Thatsmusic99 / HeadsPlus-Archived

A Minecraft heads plugin with many different features that make it unique in multiple ways.
https://www.spigotmc.org/resources/headsplus-1-8-x-1-12-x.40265/
MIT License
11 stars 6 forks source link

"Material cannot be null" exception on login #8

Closed steve4744 closed 6 years ago

steve4744 commented 6 years ago

Short summary of issue

IllegalArgumentException on first login after server restart. Plugin seems to work fine, and subsequent re-logins don't produce the exception (until server is restarted, and then it re-occurs on first login).

Server version

CraftBukkit version git-Spigot-f6a273b-8ab46ff (MC: 1.13.1)

HeadsPlus version

5.1.1

Detailed description (how you found it, what you were doing at the time)

First login to server after server restart, exception on console.


java.lang.IllegalArgumentException: Material cannot be null
        at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:69) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:57) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:45) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:35) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at org.bukkit.craftbukkit.v1_13_R2.inventory.CraftRecipe.lambda$0(CraftRecipe.java:16) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[?:1.8.0_181]
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_181]
        at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_181]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_181]
        at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_181]
        at java.util.stream.AbstractPipeline.evaluateToArrayNode(Unknown Source) ~[?:1.8.0_181]
        at java.util.stream.ReferencePipeline.toArray(Unknown Source) ~[?:1.8.0_181]
        at net.minecraft.server.v1_13_R2.RecipeItemStack.<init>(SourceFile:42) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at org.bukkit.craftbukkit.v1_13_R2.inventory.CraftRecipe.toNMS(CraftRecipe.java:16) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at org.bukkit.craftbukkit.v1_13_R2.inventory.CraftShapelessRecipe.addToCraftingManager(CraftShapelessRecipe.java:45) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at org.bukkit.craftbukkit.v1_13_R2.CraftServer.addRecipe(CraftServer.java:1152) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at org.bukkit.Bukkit.addRecipe(Bukkit.java:629) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at io.github.thatsmusic99.headsplus.crafting.RecipeEnumUser.addEnumToConfig(RecipeEnumUser.java:76) ~[?:?]
        at io.github.thatsmusic99.headsplus.crafting.RecipeEnumUser.<init>(RecipeEnumUser.java:23) ~[?:?]
        at io.github.thatsmusic99.headsplus.events.JoinEvent$2.run(JoinEvent.java:58) ~[?:?]
        at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftTask.run(CraftTask.java:76) ~[spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) [spigot-1.13.1.jar:git-Spigot-f6a273b-8ab46ff]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_181]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_181]
        at java.lang.Thread.run(Unknown Source) [?:1.8.0_181]```

### Expected behaviour
No exception on login.

### Actual behaviour
Above exception on console

### Steps to reproduce
Start server, log in.

### Any last notes?
Tried with no items in my inventory, and get the same result.
Thatsmusic99 commented 6 years ago

The reason why it only happens when the first player logs on is so that the plugin can load the crafting recipes (if it does this when the plugin starts up, the textures in the crafting table won’t load). However, noting your server version as well... did you recently update from an older version, and can you also show me your crafting.yml file?

This can be caused by old item names that have changed since 1.12.2 and older versions. However this has been reported before from a server of the same version as yours, and I never received any further feedback or notice on it.

steve4744 commented 6 years ago

Hi, this happens with a new 1.13.1 server I've made for testing plugins. I've just downloaded 5.1.1 for the first time (never used it before), have no other plugins installed, and I've not made any changes to 'crafting.yml' so its as its created by the plugin.

https://hastebin.com/rarigajeri.makefile

I'm not sure if the crafting is supposed to work on 1.13 yet, but I can only craft the first 3 (blaze, cave_spider and chicken), and that's using the 'player_head' not a skull as that is now 'skeleton_skull' in 1.13.1.

Hope that helps....let me know if you need any more info. The plugin looks really good so I'm hoping to use it on 1.13.1 once my live server is updated. Thanks.

Thatsmusic99 commented 6 years ago

Okay I’m not sure what on Earth I was thinking when I managed to get away with this:

cowI:

Remove the “Material.” bit and perhaps that may fix it.

There’s no other bits in the file that look dodgy so from there you should be fine. And huh, looks like I forgot about the old data values too... since that’s something I have to fix as well. Cheers for the notices on these and I’ll try and get them fixed by tomorrow - I’m currently unable to get on my laptop.

steve4744 commented 6 years ago

Yeah, that fixed both the exception and not being able to craft most of the heads.Thanks for the quick response.

jaketoolson commented 6 years ago

This is also happening to me - 5.1.3

Removing Material from Material.LEATHER in crafting.yml fixed it.