Added EcoPlugin#mutateProps

This commit is contained in:
Auxilor
2022-02-03 17:49:26 +00:00
parent 19bb5f608c
commit 9bbf1cfe36

View File

@@ -292,7 +292,9 @@ public abstract class EcoPlugin extends JavaPlugin implements PluginLike {
assert Eco.getHandler() != null;
PluginProps props = Eco.getHandler().getProps(pluginProps, this.getClass());
PluginProps generatedProps = Eco.getHandler().getProps(pluginProps, this.getClass());
generatedProps.validate();
PluginProps props = this.mutateProps(generatedProps);
props.validate();
this.resourceId = props.getResourceId();
@@ -557,6 +559,21 @@ public abstract class EcoPlugin extends JavaPlugin implements PluginLike {
}
/**
* Mutate the plugin props.
* <p>
* Useful for eco-based plugin libraries to enforce certain properties, such as
* forcing extensions to be enabled.
* <p>
* Props are validated both before and after calling this method.
*
* @param props The props.
* @return The mutated props.
*/
protected PluginProps mutateProps(@NotNull final PluginProps props) {
return props;
}
/**
* The plugin-specific integrations to be tested and loaded.
*