mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-07 11:20:11 +01:00
Reload plugin after db clear to avoid some issues
This commit is contained in:
parent
08ce920727
commit
962fe89c01
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.djrapitops.plan.command.commands.manage;
|
package com.djrapitops.plan.command.commands.manage;
|
||||||
|
|
||||||
|
import com.djrapitops.plan.PlanPlugin;
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
import com.djrapitops.plan.api.exceptions.database.DBInitException;
|
||||||
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
import com.djrapitops.plan.api.exceptions.database.DBOpException;
|
||||||
import com.djrapitops.plan.db.DBType;
|
import com.djrapitops.plan.db.DBType;
|
||||||
@ -50,6 +51,7 @@ import java.util.concurrent.ExecutionException;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class ManageClearCommand extends CommandNode {
|
public class ManageClearCommand extends CommandNode {
|
||||||
|
|
||||||
|
private final PlanPlugin plugin;
|
||||||
private final Locale locale;
|
private final Locale locale;
|
||||||
private final Processing processing;
|
private final Processing processing;
|
||||||
private final DBSystem dbSystem;
|
private final DBSystem dbSystem;
|
||||||
@ -58,6 +60,7 @@ public class ManageClearCommand extends CommandNode {
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ManageClearCommand(
|
public ManageClearCommand(
|
||||||
|
PlanPlugin plugin,
|
||||||
Locale locale,
|
Locale locale,
|
||||||
Processing processing,
|
Processing processing,
|
||||||
DBSystem dbSystem,
|
DBSystem dbSystem,
|
||||||
@ -65,6 +68,7 @@ public class ManageClearCommand extends CommandNode {
|
|||||||
ErrorHandler errorHandler
|
ErrorHandler errorHandler
|
||||||
) {
|
) {
|
||||||
super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
|
super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
|
||||||
|
this.plugin = plugin;
|
||||||
|
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
this.processing = processing;
|
this.processing = processing;
|
||||||
@ -110,6 +114,7 @@ public class ManageClearCommand extends CommandNode {
|
|||||||
.get(); // Wait for completion
|
.get(); // Wait for completion
|
||||||
queryService.dataCleared();
|
queryService.dataCleared();
|
||||||
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
sender.sendMessage(locale.getString(ManageLang.PROGRESS_SUCCESS));
|
||||||
|
reloadPlugin(sender);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
} catch (DBOpException | ExecutionException e) {
|
} catch (DBOpException | ExecutionException e) {
|
||||||
@ -118,4 +123,14 @@ public class ManageClearCommand extends CommandNode {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void reloadPlugin(Sender sender) {
|
||||||
|
try {
|
||||||
|
plugin.reloadPlugin(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
errorHandler.log(L.CRITICAL, this.getClass(), e);
|
||||||
|
sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED));
|
||||||
|
}
|
||||||
|
sender.sendMessage(locale.getString(CommandLang.RELOAD_COMPLETE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user