-
Notifications
You must be signed in to change notification settings - Fork 10
Home
If you are using gradle or maven you can use JitPack to add BlueMapAPI to your project.
Otherwise you can download the version you want from the releases and include that into your build-path, you will then also need to add the dependency com.flowpowered/flow-math/1.0.3 to your build-path.
Javadoc: https://bluecolored.de/bluemapapi/latest/
The BlueMapAPI
class has some static methods that will be your entry-point into the API:
// Directly getting the api (wrapped in an Optional)
Optional<BlueMapAPI> optionalApi = BlueMapAPI.getInstance();
// Directly using the API if it is enabled
BlueMapAPI.getInstance().ifPresent(api -> {
//code executed when the api is enabled (skipped if the api is not enabled)
});
// Using a listener to do something as soon as the API is available
BlueMapAPI.onEnable(api -> {
//code executed when the api got enabled
});
BlueMapAPI.onDisable(api -> {
//code executed right before the api gets disabled
});
Don't save the API instance or any other object created by the instance (MarkerAPI, MarkerSet) to a variable or so for later use!
Always use the above methods to get the current valid API-Instance, and do everything in one go.
If you need to access the API later again, e.g. on a command or an event, use BlueMapAPI.getInstance()
to always have the current valid API instance!
If you want to use the MarkerAPI, you start by loading a MakerAPI
instance:
MarkerAPI markerApi = api.getMarkerAPI();
You need to understand that each time you are calling getMarkerAPI()
a new MarkerAPI
instance is created and loaded!
So only do this once and use this instance to create all you markers.
After creating all the markers you need to call
markerApi.save();
to save your changes to the markers.json
.