Skip to content
CreepsterLGC edited this page Sep 19, 2015 · 8 revisions

In order to use Core's API you first have to add the Core.jar file to your external .jar files. Then you got to grab an instance of the CoreAPI by adding the following code:

    @Listener
    public void onServerStarting(GameStartingServerEvent event) {
    	
        CoreAPI api;

    	Optional<CoreAPI> optional = game.getServiceManager().provide(CoreAPI.class);
    	if(optional.isPresent()) api = optional.get();

    }

Don't forget to add Core as a depency: dependencies = "required-after:Core"

@Plugin(id = "Example", name = "Example Plugin", dependencies = "required-after:Core")

Thats it! You can find all the API functions here

Clone this wiki locally