[SPIGOT-7759] Chunk not there when requested in ChunkUnloadEvent Created: 15/Jun/24  Updated: 25/Dec/24  Resolved: 15/Jun/24

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

Type: Bug Priority: Minor
Reporter: Eccentric Devotion Assignee: md_5
Resolution: Fixed Votes: 0
Labels: None
Environment:

Mac OS 11.7.0

Java 22


Attachments: Text File latest.log    
Version: CraftBukkit version 4212-Spigot-146439e-2828725 (MC: 1.21)
Guidelines Read: Yes

 Description   

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.



 Comments   
Comment by md_5 [ 19/Jun/24 ]

Any ideas would be welcome too, I think you fixed some previous bugs there

Comment by Irmo van den Berge [ 19/Jun/24 ]

Thank you, I'll be monitoring the new issue ticket.

Comment by md_5 [ 19/Jun/24 ]

See SPIGOT-7780

Comment by Irmo van den Berge [ 19/Jun/24 ]

this issue is not actually resolved on 1.21 yet. When I call getTileEntities() inside the chunk unload event, I still get the error in the OP. Tested just now with a newly built 1.21 spigot.

Comment by md_5 [ 15/Jun/24 ]

1.20.6?

Generated at Sat Dec 13 18:56:59 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.