• CraftBukkit version 4477-Spigot-e339edc-ba251cc (MC: 1.21.5) (Implementing API version 1.21.5-R0.1-SNAPSHOT)
    • Yes

      What happens

      Attempting to increment Statistic.USE_ITEM for Material.CARROTS (and other crop blocks) in 1.21.5 causes /save-all to fail (no error in console), and causes the next auto save to crash the server.

       

      What I expect to happen

      I expect either of these options:

      1. The behavior returns to silently failing without errors or crashing like in 1.21.4
      2. The server throws a useful stacktrace immediately when trying to increment a stat for Materials that aren't supposed to have that stat.

       

      Workarounds

      1. Attempt to figure out what plugin is causing it, then fix the plugin by using a 'valid' Material.
      2. Disable statistic saving in spigot.yml by setting stats.disable-saving to true.

       

      Example plugin (TestStatisticCrash.jar)

      This line is the cause of the crash:

      event.getPlayer().incrementStatistic(Statistic.USE_ITEM, Material.CARROTS); 

       

      Step-by-step instructions{}

      1. Create a new 1.21.5 spigot server (do not use an old world)
      2. Add the test plugin to the plugins folder
      3. Start the server
      4. Join the server with your game client
      5. Run save-all in the console to verify that it works (or op yourself and run /save-all in game)
      6. Left-click to punch any block near your player (you'll see text in the chat when you do)
      7. Run save-all again (it should still say that it "Saved the game")
      8. Right-click any block near your player (you'll see text in the chat when you do)
      9. Notice that the text says CARROTS with an S this time instead of CARROT (CARROT is the item in your inventory, and CARROTS is the crop block. The game uses CARROT when you plant carrots normally)
      10. Run save-all again (it will say "An unexpected error occurred trying to execute that command")
      11. Wait a few minutes for the server to run an auto save (or have your player log off). The server will crash with the error java.lang.IllegalStateException: Unregistered holder in ResourceKey[minecraft:root / minecraft:item]: Direct{null}

      (All of the save-all steps are optional and they don't affect whether or not the server crashes.)

       

      Server log: 2025-04-03-1.log

      Crash log: crash-2025-04-03_22.11.07-server.txt

      Video showing that 1.21.5 has the issue and 1.21.4 doesn't: spigot_stat_test5.mp4

       

      Extra notes:

      • I have no idea how this would be tested in vanilla.
      • I didn't test non-crop materials.
      • Using a 1.21.4 world on a 1.21.5 server doesn't seem to have this issue.
      • The text in the test plugin was slightly modified after the video was recorded.
      • You won't know exactly which action is triggering the crash during normal gameplay because it happens X minutes later during an auto save.
      • The error text and crash log won't tell you which plugin caused the crash. The only clue to tracking it down is "ServerStatisticManager".

            Assignee:
            Unassigned
            Reporter:
            iPyronic
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: