Skip to content

Plugin API: NamespacedKey based Chunk plugin tickets #4147

@Trigary

Description

@Trigary

Preamble: I am more than happy to implement this, I am just asking whether this is something that would get merged. I am not looking to waste my time as I did with #3139. I totally understand if stuff isn't deemed "worth to maintain".

The Chunk plugin ticket system currently uses Plugin instances, meaning a single plugin can only have a single ticket on a specific chunk. This means that if multiple separate components of a bigger plugin need to place tickets, then they can't, or the plugin author must resolve conflicts manually.

For plugin authors, a single counter is enough: increment the count when you need the chunk, decrement it when you no longer need it. If you incremented it from 0 to 1, then call the addPluginChunkTicket ticket and if you decremented it from 0 to 1 then remove the ticket. My proposal is to remove this boilerplate code and handle this internally using NamespacedKey based keys instead of Plugin instances.

(Why use NamespacedKey instead of a counter you ask? A counter is a fast, simple, crude method to solve this issue, but is hard to debug and not very extensible.)

This addition must keep Bukkit/Spigot compatibility, so the current system must be left untouched. The addition must also remove all tickets added by the plugin when the plugin gets disabled. Since plugins will either use the newly added or the old API, removePluginChunkTicket can just remove all tickets relating to the Plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedDisputed bug is accepted as valid or Feature accepted as desired to be added.type: featureRequest for a new Feature.
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions