mirror of
https://github.com/Crazy-Crew/CrazyAuctions.git
synced 2024-11-22 11:55:12 +01:00
Add reload command
This commit is contained in:
parent
e9fe8d97f6
commit
a66c036289
@ -20,7 +20,7 @@ public class ApiManager {
|
||||
private static SettingsManager config;
|
||||
private static SettingsManager pluginConfig;
|
||||
|
||||
public ApiManager load() {
|
||||
public void load() {
|
||||
File pluginConfigFile = new File(this.path.toFile(), "plugin-config.yml");
|
||||
|
||||
pluginConfig = SettingsManagerBuilder
|
||||
@ -49,11 +49,23 @@ public class ApiManager {
|
||||
.configurationData(ConfigBuilder.buildConfig())
|
||||
.create();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
// Reload configs.
|
||||
pluginConfig.reload();
|
||||
config.reload();
|
||||
|
||||
locale.reload();
|
||||
|
||||
File localeDir = new File(this.path.toFile(), "locale");
|
||||
File localeFile = new File(localeDir, pluginConfig.getProperty(PluginConfig.LOCALE_FILE) + ".yml");
|
||||
|
||||
locale = SettingsManagerBuilder
|
||||
.withYamlFile(localeFile)
|
||||
.useDefaultMigrationService()
|
||||
.configurationData(ConfigBuilder.buildLocale())
|
||||
.create();
|
||||
}
|
||||
|
||||
public static SettingsManager getPluginConfig() {
|
||||
|
@ -9,5 +9,19 @@ public class CrazyManager {
|
||||
|
||||
public void load() {
|
||||
|
||||
// Used for user data.
|
||||
init();
|
||||
}
|
||||
|
||||
public void reload(boolean serverStop) {
|
||||
|
||||
if (!serverStop) {
|
||||
// Used for user data.
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.badbones69.crazyauctions.commands.admin;
|
||||
|
||||
import com.badbones69.crazyauctions.CrazyAuctions;
|
||||
import com.badbones69.crazyauctions.api.frame.command.CommandContext;
|
||||
import com.badbones69.crazyauctions.api.frame.command.CommandEngine;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import java.util.Collections;
|
||||
|
||||
public class CommandReload extends CommandEngine {
|
||||
|
||||
private final CrazyAuctions plugin = JavaPlugin.getPlugin(CrazyAuctions.class);
|
||||
|
||||
public CommandReload() {
|
||||
super("reload", "Reloads the plugin.", "/crazyauctions:reload", Collections.emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void perform(CommandContext context, String[] args) {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user