Description
Objective
Develop a new, purpose-built API for ProtocolLib that ensures compatibility with past, current, and future versions of Minecraft. This new API aims to streamline the codebase by distinguishing between public-facing components for plugins and internal components, facilitating easier and quicker future updates.
Goals
-
Backward Compatibility: Maintain support for existing plugins by deprecating the current API and delegating its functionality to the new one. This will provide ample time for plugin developers to transition without disrupting their workflows.
-
Codebase Segmentation: Clearly separate the public API components from internal ones. This separation will help in simplifying maintenance, reducing the risk of accidental changes to the API, and making it easier for developers to understand and use the API correctly.
-
Abstraction and Decoupling: Abstract, decouple, and generalize most parts of the code to be more self-contained. This will enhance modularity, making the system more robust and adaptable to future changes. Self-contained modules will also make it easier to test, debug, and extend functionality without unintended side effects.
Implementation Steps
- Document the components of the current API and how they are utilized.
- Design the new API structure, focusing on modularity, clarity, and abstraction.
- Implement the new API, ensuring it can delegate to the old API for backward compatibility.
- Deprecate the current API and provide migration guides for plugin developers.
This approach will help us overcome the limitations of the nearly 12-year-old API, setting the stage for a more flexible and maintainable future for ProtocolLib.
1. Current API
- sync/async packet listener
- priority
- opt-in event-loop process
- read only listeners (monitor)
- async timeout listener
- packet event
- post send/process callback
- scheduled packet (related to post send callback)
- clone?
- packet container
- read/write from/to buffer
- clone
- wrapper access
- wire packet
- id + buffer
- protocol/packet type constants/registry
- utility
- minecraft version
- buffer helper with wrapper support
- wrappers