Fixed config updater

This commit is contained in:
Auxilor 2020-12-25 20:47:41 +00:00
parent e5baa4f895
commit 69704c0550
3 changed files with 10 additions and 15 deletions

View File

@ -152,5 +152,6 @@ public abstract class AbstractCommand extends PluginDependent implements Command
* @param sender The sender of the command
* @param args The arguments of the command
*/
protected abstract void onExecute(CommandSender sender, List<String> args);
protected abstract void onExecute(CommandSender sender,
List<String> args);
}

View File

@ -36,7 +36,7 @@ public class ConfigHandler extends PluginDependent {
public void callUpdate() {
updatableClasses.forEach(clazz -> Arrays.stream(clazz.getDeclaredMethods()).forEach(method -> {
if (method.isAnnotationPresent(ConfigUpdater.class)) {
if (method.getParameterTypes().length == 0) {
if (method.getParameterTypes().length != 0) {
throw new InvalidUpdateMethodException("Update method must not have parameters.");
}
if (!Modifier.isStatic(method.getModifiers())) {

View File

@ -240,13 +240,18 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
}
});
updatableClasses.add(Configs.class);
updatableClasses.add(DropManager.class);
updatableClasses.addAll(this.getUpdatableClasses());
this.getListeners().forEach(listener -> this.getEventManager().registerListener(listener));
this.getCommands().forEach(AbstractCommand::register);
this.getScheduler().runLater(this::afterLoad, 1);
this.getUpdatableClasses().forEach(clazz -> this.getConfigHandler().registerUpdatableClass(clazz));
this.updatableClasses.forEach(clazz -> this.getConfigHandler().registerUpdatableClass(clazz));
this.enable();
}
@ -314,7 +319,7 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
this.getScheduler().cancelAll();
new FastCollatedDropQueue.CollatedRunnable(this);
this.reload();
this.onReload();
}
/**
@ -342,17 +347,6 @@ public abstract class AbstractEcoPlugin extends JavaPlugin {
return integrations;
}
/**
* Default updatable classes that exist within internal libraries.
*
* @return The default updatable classes.
*/
public final List<Class<? extends Updatable>> getDefaultUpdatableClasses() {
updatableClasses.add(Configs.class);
updatableClasses.add(DropManager.class);
return updatableClasses;
}
/**
* The plugin-specific code to be executed on enable.
*/