BentoBoxWorld / docs

Documentation
Other
1 stars 8 forks source link

More API Documentation for interacting with addons #17

Open Joshinn-io opened 3 years ago

Joshinn-io commented 3 years ago

The documentation for working with addons exists, but isn't perfect. The Addon Request API is a bit lacking, and threw me for a loop until I got it figured out. This is just a basic request to add this to the wiki to maybe give people another, more specific example for working with OneBlock. This function will return the phase a player is currently in, if you give the function the player UUID.

    public String getPhase(UUID uuid){
        AddonRequestBuilder builder = new AddonRequestBuilder();
        Map<String, String> map = (Map<String, String>) builder
                .addon("AOneBlock")
                .label("island-stats")
                .addMetaData("player", uuid)
                .request();
        return map.get("phase");
    }

The example on the wiki only has an example where the method is static, and that doesn't work for Oneblock, the example also provides a one value map, not a map with multiple options.

tastybento commented 3 years ago

Actually, we are moving to a new system called "Pladdons" that are Plugin-compatible Addons (Plugin + Addon). The code is active in 1.17.0-SNAPSHOT BentoBox and we are working on updating the addons. For users there will be no change - the addons will go to the addon folder and it's all backward compatible. For developers and API users the difference will be that you can access the API of addons directly because they are now loaded via the server class loader. So, you should be able to avoid having to use the Addon Request API in the future.