[SPIGOT-5045] ChunkUnloadEvent can no longer be cancelled Created: 08/Jun/19 Updated: 02/Sep/19 Resolved: 02/Sep/19 |
|
| Status: | Resolved |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Irmo van den Berge | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | 1.14, 1.14.1, 1.14.2, ChunkUnloadEvent, api, can, cancel, removed | ||
| Environment: |
Windows 7 64 Bit Java 8 |
||
| Version: | This server is running CraftBukkit version git-Spigot-baafee9-043d31d (MC: 1.14.2) (Implementing API version 1.14.2-R0.1-SNAPSHOT) |
| Plugin: | Traincarts, Light Cleaner |
| Guidelines Read: | Yes |
| Description |
|
Since MC 1.14 the ChunkUnloadEvent setCancelled method has disappeared. This is breaking a number of plugins of mine, most importantly Traincarts' keep chunks loaded logic for minecarts. Will this feature return? If not, what will replace it so I can stop chunks from unloading when they must stay loaded? I have not seen an official update explaining this. I'm well-aware that the asynchronous-driven chunk loading system broke a lot of stuff. I need to know whether I need to mess with NMS myself to emulate this feature or that developers are actively working on fixing this. [17:45:04 ERROR]: Could not pass event ChunkUnloadEvent to Train_Carts v1.14.2-v1-SNAPSHOT java.lang.NoSuchMethodError: org.bukkit.event.world.ChunkUnloadEvent.setCancelled(Z)V > at com.bergerkiller.bukkit.tc.TCListener.onChunkUnloadLow(TCListener.java:148) ~[?:?] |
| Comments |
| Comment by Irmo van den Berge [ 02/Sep/19 ] |
|
I noticed that when that feature went into beta. BKCommonLib uses the plugin chunk ticket system when available, on older versions it falls back to the forced chunk api. I really appreciate the chunk ticket system as this fixes the issue of one plugin negatively influencing another. |
| Comment by md_5 [ 02/Sep/19 ] |
|
There is also the enhanced plugin ticket API now as well |
| Comment by Irmo van den Berge [ 09/Jun/19 ] |
|
Based on the ForcedChunk logic I've successfully implemented alternative logic for traincarts and light cleaner, and I no longer require setCancelled as a result. |
| Comment by Irmo van den Berge [ 08/Jun/19 ] |
|
Thanks! Good to know there's a replacement API. Only unfortunate that you need to cancel the force-loaded yourself, as that could potentially cause the chunk to unload even though another plugin also marked one as such. I'll add something to BKCommonLib that takes that into account. There is no event that fires when the 'force loaded' state of a chunk is changed? |
| Comment by Black Hole [ 08/Jun/19 ] |
|
Since 1.13 Minecraft offers a feature called forced chunks: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#setChunkForceLoaded-int-int-boolean- |