Clear and remove command no longer clear session cache

This commit is contained in:
Rsl1122 2018-04-11 11:36:24 +03:00
parent 4b4594d9b8
commit 9d8abc11e8
6 changed files with 17 additions and 24 deletions

View File

@ -1,6 +1,6 @@
package com.djrapitops.plan.command;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.command.commands.*;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.system.settings.Settings;
@ -21,7 +21,7 @@ import com.djrapitops.plugin.command.defaultcmds.StatusCommand;
*/
public class PlanCommand extends TreeCmdNode {
public PlanCommand(Plan plugin) {
public PlanCommand(PlanPlugin plugin) {
super("plan", "", CommandType.CONSOLE, null);
super.setDefaultCommand("inspect");
super.setColorScheme(plugin.getColorScheme());

View File

@ -1,6 +1,6 @@
package com.djrapitops.plan.command.commands;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.system.settings.locale.Locale;
@ -19,9 +19,9 @@ import com.djrapitops.plugin.settings.ColorScheme;
*/
public class InfoCommand extends CommandNode {
private final Plan plugin;
private final PlanPlugin plugin;
public InfoCommand(Plan plugin) {
public InfoCommand(PlanPlugin plugin) {
super("info", Permissions.INFO.getPermission(), CommandType.CONSOLE);
setShortHelp(Locale.get(Msg.CMD_USG_INFO).toString());
this.plugin = plugin;
@ -38,7 +38,7 @@ public class InfoCommand extends CommandNode {
String upToDate = VersionCheckSystem.isNewVersionAvailable() ? "Update Available" : "Up to date";
String[] messages = {
Locale.get(Msg.CMD_HEADER_INFO).toString(),
ball + mColor + " Version: " + sColor + plugin.getDescription().getVersion(),
ball + mColor + " Version: " + sColor + plugin.getVersion(),
ball + mColor + " Up to date: " + sColor + upToDate,
ball + mColor + " Active Database: " + tColor + Database.getActive().getConfigName(),
Locale.get(Msg.CMD_CONSTANT_FOOTER).toString()

View File

@ -1,6 +1,6 @@
package com.djrapitops.plan.command.commands;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.command.commands.manage.*;
import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.system.settings.locale.Locale;
@ -17,7 +17,7 @@ import com.djrapitops.plugin.command.TreeCmdNode;
*/
public class ManageCommand extends TreeCmdNode {
public ManageCommand(Plan plugin, CommandNode parent) {
public ManageCommand(PlanPlugin plugin, CommandNode parent) {
super("manage|m", Permissions.MANAGE.getPermission(), CommandType.CONSOLE, parent);
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE).toString());
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE).toArray());

View File

@ -1,11 +1,9 @@
package com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.api.exceptions.database.DBException;
import com.djrapitops.plan.api.exceptions.database.DBInitException;
import com.djrapitops.plan.api.exceptions.database.FatalDBException;
import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.system.cache.SessionCache;
import com.djrapitops.plan.system.database.DBSystem;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.settings.Permissions;
@ -29,9 +27,9 @@ import com.djrapitops.plugin.utilities.Verify;
*/
public class ManageClearCommand extends CommandNode {
private final Plan plugin;
private final PlanPlugin plugin;
public ManageClearCommand(Plan plugin) {
public ManageClearCommand(PlanPlugin plugin) {
super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_CLEAR).toString());
setArguments("<DB>", "[-a]");
@ -75,11 +73,6 @@ public class ManageClearCommand extends CommandNode {
database.remove().everything();
long now = MiscUtils.getTime();
SessionCache.clear();
plugin.getServer().getOnlinePlayers().forEach(
player -> SessionCache.getInstance().cacheSession(player.getUniqueId(),
new Session(now, player.getWorld().getName(), player.getGameMode().name()))
);
sender.sendMessage(Locale.get(Msg.MANAGE_INFO_CLEAR_SUCCESS).toString());
} catch (FatalDBException e) {
sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).toString()

View File

@ -1,6 +1,6 @@
package com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.system.database.DBSystem;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.settings.Permissions;
@ -23,9 +23,9 @@ import com.djrapitops.plugin.utilities.Verify;
*/
public class ManageHotSwapCommand extends CommandNode {
private final Plan plugin;
private final PlanPlugin plugin;
public ManageHotSwapCommand(Plan plugin) {
public ManageHotSwapCommand(PlanPlugin plugin) {
super("hotswap", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_HOTSWAP).toString());
setArguments("<DB>");

View File

@ -1,6 +1,6 @@
package com.djrapitops.plan.command.commands.manage;
import com.djrapitops.plan.Plan;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.system.database.DBSystem;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.database.databases.sql.SQLiteDB;
@ -28,9 +28,9 @@ import java.util.Arrays;
*/
public class ManageRestoreCommand extends CommandNode {
private final Plan plugin;
private final PlanPlugin plugin;
public ManageRestoreCommand(Plan plugin) {
public ManageRestoreCommand(PlanPlugin plugin) {
super("restore", Permissions.MANAGE.getPermission(), CommandType.CONSOLE);
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_RESTORE).toString());
setArguments("<Filename.db>", "<dbTo>", "[-a]");