Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7759

Chunk not there when requested in ChunkUnloadEvent


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • None
    • Mac OS 11.7.0

      Java 22

    • CraftBukkit version 4212-Spigot-146439e-2828725 (MC: 1.21)
    • Yes

      When trying to access the chunk in the Chunk Unload event an error is thrown:

      java.lang.IllegalStateException: Chunk not there when requested: Unloaded chunk

      This happens specifically for my plugin when trying to get the entities in the chunk, though can be reproduced with a basic plugin with the following code:

          @EventHandler(priority = EventPriority.NORMAL)
          public void onChunkUnload(ChunkUnloadEvent event) {
              for (Entity d : event.getChunk().getEntities()) {
                  getLogger().log(Level.INFO, d.getType().toString());
      {{        }}}
      {{    }}}

      No other plugins present except the test plugin with the above code.

            md_5 md_5
            eccentric Eccentric Devotion
            0 Vote for this issue
            2 Start watching this issue