mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-24 16:14:26 +08:00
Updated APF & changed reloading
Reloads are now done with a separate Thread instead of a task to avoid exceptions if the reload task is cancelled while the plugin is being reloaded. Affects issues: - Close #1125
This commit is contained in:
parent
a129c24e7a
commit
24831c7246
@ -56,7 +56,7 @@ subprojects {
|
||||
ext.daggerVersion = "2.24"
|
||||
ext.daggerCompilerVersion = "2.24"
|
||||
|
||||
ext.abstractPluginFrameworkVersion = "3.4.1"
|
||||
ext.abstractPluginFrameworkVersion = "3.4.2"
|
||||
ext.planPluginBridgeVersion = "4.9.0-R0.3"
|
||||
|
||||
ext.bukkitVersion = "1.12.2-R0.1-SNAPSHOT"
|
||||
|
@ -27,7 +27,6 @@ import com.djrapitops.plugin.command.CommandType;
|
||||
import com.djrapitops.plugin.command.Sender;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -59,17 +58,17 @@ public class ReloadCommand extends CommandNode {
|
||||
|
||||
@Override
|
||||
public void onCommand(Sender sender, String commandLabel, String[] args) {
|
||||
runnableFactory.create("Reload task", new AbsRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
plugin.reloadPlugin(true);
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.CRITICAL, this.getClass(), e);
|
||||
sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED));
|
||||
}
|
||||
new Thread(() -> {
|
||||
try {
|
||||
plugin.reloadPlugin(true);
|
||||
sender.sendMessage(locale.getString(CommandLang.RELOAD_COMPLETE));
|
||||
} catch (Exception e) {
|
||||
errorHandler.log(L.CRITICAL, this.getClass(), e);
|
||||
sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED));
|
||||
} finally {
|
||||
Thread thread = Thread.currentThread();
|
||||
thread.interrupt();
|
||||
}
|
||||
}).runTaskAsynchronously();
|
||||
}, "Plan Reload Thread").start();
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ public abstract class ConfigSystem implements SubSystem {
|
||||
setDebugMode();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
errorHandler.log(L.ERROR, this.getClass(), e);
|
||||
throw new EnableException("Failed to save default config: " + e.getMessage(), e);
|
||||
}
|
||||
theme.enable();
|
||||
|
Loading…
Reference in New Issue
Block a user