Creating expansions
Here you can view examples and details on how the expansion system works in Player Warps.
In Player Warps you can create expansions that will hook into the plugin to either add more functionality or to modify how the plugin works.
Registering Expansions
There are two types of ways how you can register the expansions, you can either have it external or internal.
External
Internal expansion is where you register the expansion in a plugin of your own. You can extend the necessary expansion type in a class and then using the ExpansionRegistry to register your expansion.
Here is an example to register your expansion internally, instance is your expansions' instance.
Integrated
External expansions is where you can create a jar file that contains a class extending a necessary expansion type and the plugin will automatically find it as long as you put it into the expansions folder of the plugin. Make sure you do not have any constructors.
Examples
Here is an example of an expansion class, this is a plain expansion and will do nothing in functionality unless you program it to. If you wish to add actual functionality within the plugin that's already been programmed then you can look at next expansions type.
You will need to make sure that you provide an expansion name, this isn't really used much anywhere apart from just a unique identifier and used in console.
If isEnabled returns false then the onLoad method will not be called and the expansion will not be loaded into memory.
The expansion class actually contains a view public fields that you can use:
plugin
- This is the instance of the PlayerWarps plugin, this may be used to register events etc.api
- This is the API instance of Player Warps.registry
- This is the Expansion Registry instance of Player Warps.expansionConfig
- This is the expansion configuration that you can use to grab options from theexpansions.yml
.config
- This is the main configuration that you can also use to grab options from theconfig.yml
Last updated