mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-23 00:21:43 +01:00
Manage Backup feature, fixes to messages
- "Online" now green in inspect window - Manage Process start msgs - Possibility to backup db to a sqlite file and restore.
This commit is contained in:
parent
3ab8f89852
commit
0b26ea5530
@ -69,13 +69,16 @@ public enum Phrase {
|
||||
ERROR_WEBSERVER_OFF_INSPECT(ChatColor.YELLOW + "" + PREFIX + "This command can be only used if webserver/planlite is enabled on this server."),
|
||||
//
|
||||
MANAGE_ERROR_INCORRECT_PLUGIN(ChatColor.RED + "" + PREFIX + "Plugin not supported: "),
|
||||
MANAGE_PROCESS_START(ARROWS_RIGHT +""+COLOR_SEC.color() +" Processing data.."),
|
||||
MANAGE_ERROR_PLUGIN_NOT_ENABLED(ChatColor.RED + "" + PREFIX + "Plugin is not enabled: "),
|
||||
MANAGE_ERROR_INCORRECT_DB(ChatColor.RED + "" + PREFIX + "Incorrect database! (sqlite/mysql accepted): "),
|
||||
MANAGE_ERROR_SAME_DB(ChatColor.RED + "" + PREFIX + "Can't move to the same database!"),
|
||||
MANAGE_DATABASE_FAILURE(ChatColor.RED + "" + PREFIX + "One of the databases was not initialized properly."),
|
||||
MANAGE_DB_CONFIG_REMINDER(ChatColor.YELLOW + "" + PREFIX + "Remember to swap to the new database and reload plugin"),
|
||||
MANAGE_ERROR_NO_PLAYERS(ChatColor.RED + "" + PREFIX + "Database has no player data!"),
|
||||
MANAGE_ERROR_BACKUP_FILE_NOT_FOUND(ChatColor.RED + "" + PREFIX + "Backup file doesn't exist!"),
|
||||
MANAGE_MOVE_SUCCESS(ChatColor.GREEN + "" + PREFIX + "All data moved successfully!"),
|
||||
MANAGE_COPY_SUCCESS(ChatColor.GREEN + "" + PREFIX + "All data copied successfully!"),
|
||||
MANAGE_CLEAR_SUCCESS(ChatColor.GREEN + "" + PREFIX + "All data cleared successfully!"),
|
||||
//
|
||||
CMD_FOOTER(COLOR_TER.color() + "" + ARROWS_RIGHT),
|
||||
@ -114,6 +117,10 @@ public enum Phrase {
|
||||
return text;
|
||||
}
|
||||
|
||||
public String parse() {
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
public String parse(String... p) {
|
||||
String returnValue = this.toString();
|
||||
for (int i = 0; i < p.length; i++) {
|
||||
@ -128,4 +135,12 @@ public enum Phrase {
|
||||
public ChatColor color() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public void setColor(String colorCode) {
|
||||
this.color = ChatColor.getByChar(colorCode);
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ public class ManageCommand extends SubCommand {
|
||||
commands.add(new ManageMoveCommand(plugin));
|
||||
commands.add(new ManageCombineCommand(plugin));
|
||||
commands.add(new ManageHotswapCommand(plugin));
|
||||
commands.add(new ManageBackupCommand(plugin));
|
||||
commands.add(new ManageRestoreCommand(plugin));
|
||||
commands.add(new ManageStatusCommand(plugin));
|
||||
commands.add(new ManageImportCommand(plugin));
|
||||
commands.add(new ManageRemoveCommand(plugin));
|
||||
|
@ -0,0 +1,107 @@
|
||||
package main.java.com.djrapitops.plan.command.commands.manage;
|
||||
|
||||
import com.djrapitops.plan.Phrase;
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.command.CommandType;
|
||||
import com.djrapitops.plan.command.SubCommand;
|
||||
import com.djrapitops.plan.data.ServerData;
|
||||
import com.djrapitops.plan.database.Database;
|
||||
import com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import com.djrapitops.plan.utilities.FormatUtils;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.utilities.DataCombineUtils;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class ManageBackupCommand extends SubCommand {
|
||||
|
||||
private Plan plugin;
|
||||
|
||||
/**
|
||||
* Class Constructor.
|
||||
*
|
||||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public ManageBackupCommand(Plan plugin) {
|
||||
super("backup", "plan.manage", "Backup a database to .db file", CommandType.CONSOLE, "<DB>");
|
||||
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subcommand Manage backup.
|
||||
*
|
||||
* @param sender
|
||||
* @param cmd
|
||||
* @param commandLabel
|
||||
* @param args Player's name or nothing - if empty sender's name is used.
|
||||
* @return true in all cases.
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||
try {
|
||||
if (args.length < 1) {
|
||||
sender.sendMessage(Phrase.COMMAND_REQUIRES_ARGUMENTS.toString() + " Use /plan manage backup <DB>");
|
||||
return true;
|
||||
}
|
||||
String db = args[0].toLowerCase();
|
||||
if (!db.equals("mysql") && !db.equals("sqlite")) {
|
||||
sender.sendMessage(Phrase.MANAGE_ERROR_INCORRECT_DB + db);
|
||||
return true;
|
||||
}
|
||||
Database database = null;
|
||||
for (Database sqldb : plugin.getDatabases()) {
|
||||
if (db.equalsIgnoreCase(sqldb.getConfigName())) {
|
||||
database = sqldb;
|
||||
if (!database.init()) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (database == null) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
plugin.logError(db + " was null!");
|
||||
return true;
|
||||
}
|
||||
final Database copyfromDB = database;
|
||||
(new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Date now = new Date();
|
||||
SQLiteDB backupDB = new SQLiteDB(plugin,
|
||||
"backup-"+now.toString().substring(4, 10).replaceAll(" ", "-").replaceAll(":", "-"));
|
||||
|
||||
if (!backupDB.init()) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
this.cancel();
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse());
|
||||
backupDB.removeAllData();
|
||||
Set<UUID> uuids = copyfromDB.getSavedUUIDs();
|
||||
for (UUID uuid : uuids) {
|
||||
backupDB.saveUserData(uuid, copyfromDB.getUserData(uuid));
|
||||
}
|
||||
HashMap<Long, ServerData> serverDataHashMap = copyfromDB.getServerDataHashMap();
|
||||
backupDB.saveServerDataHashMap(serverDataHashMap);
|
||||
backupDB.saveCommandUse(DataCombineUtils.getCommandUse(serverDataHashMap));
|
||||
sender.sendMessage(Phrase.MANAGE_COPY_SUCCESS.toString());
|
||||
this.cancel();
|
||||
}
|
||||
}).runTaskAsynchronously(plugin);
|
||||
} catch (NullPointerException e) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -76,6 +76,7 @@ public class ManageClearCommand extends SubCommand {
|
||||
(new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse());
|
||||
clearThisDB.removeAllData();
|
||||
sender.sendMessage(Phrase.MANAGE_CLEAR_SUCCESS+"");
|
||||
this.cancel();
|
||||
|
@ -8,7 +8,6 @@ import com.djrapitops.plan.data.ServerData;
|
||||
import com.djrapitops.plan.data.UserData;
|
||||
|
||||
import com.djrapitops.plan.database.Database;
|
||||
import com.djrapitops.plan.utilities.MiscUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@ -111,7 +110,8 @@ public class ManageCombineCommand extends SubCommand {
|
||||
}
|
||||
final List<UUID> fromUUIDS = new ArrayList<>();
|
||||
final List<UUID> toUUIDS = new ArrayList<>();
|
||||
try {for (OfflinePlayer p : offlinePlayers) {
|
||||
try {
|
||||
for (OfflinePlayer p : offlinePlayers) {
|
||||
UUID uuid = p.getUniqueId();
|
||||
if (fromDatabase.wasSeenBefore(uuid)) {
|
||||
fromUUIDS.add(uuid);
|
||||
@ -130,6 +130,7 @@ public class ManageCombineCommand extends SubCommand {
|
||||
(new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse());
|
||||
HashMap<UUID, UserData> allFromUserData = new HashMap<>();
|
||||
HashMap<UUID, UserData> allToUserData = new HashMap<>();
|
||||
for (UUID uuid : fromUUIDS) {
|
||||
@ -148,7 +149,7 @@ public class ManageCombineCommand extends SubCommand {
|
||||
HashMap<Long, ServerData> toServerData = moveToDB.getServerDataHashMap();
|
||||
HashMap<Long, ServerData> combinedServerData = DataCombineUtils.combineServerDatas(fromServerData, toServerData);
|
||||
|
||||
HashMap<String, Integer> commandUse = DataCombineUtils.combineCommandUses(getCommandUse(fromServerData), getCommandUse(toServerData));
|
||||
HashMap<String, Integer> commandUse = DataCombineUtils.combineCommandUses(DataCombineUtils.getCommandUse(fromServerData), DataCombineUtils.getCommandUse(toServerData));
|
||||
|
||||
moveToDB.removeAllData();
|
||||
|
||||
@ -163,22 +164,12 @@ public class ManageCombineCommand extends SubCommand {
|
||||
this.cancel();
|
||||
}
|
||||
|
||||
public HashMap<String, Integer> getCommandUse(HashMap<Long, ServerData> fromServerData) {
|
||||
ServerData sData = null;
|
||||
for (long sDataKey : fromServerData.keySet()) {
|
||||
sData = fromServerData.get(sDataKey);
|
||||
break;
|
||||
}
|
||||
HashMap<String, Integer> fromCommandUse = null;
|
||||
if (sData != null) {
|
||||
fromCommandUse = sData.getCommandUsage();
|
||||
}
|
||||
return fromCommandUse;
|
||||
}
|
||||
}).runTaskAsynchronously(plugin);
|
||||
|
||||
} catch (NullPointerException e) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.data.importing.Importer;
|
||||
import main.java.com.djrapitops.plan.data.importing.OnTimeImporter;
|
||||
import org.bukkit.Bukkit;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
@ -24,12 +23,6 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -124,6 +124,7 @@ public class ManageMoveCommand extends SubCommand {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse());
|
||||
moveToDB.removeAllData();
|
||||
List<UserData> allUserData = new ArrayList<>();
|
||||
for (UUID uuid : uuids) {
|
||||
|
@ -16,13 +16,6 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
import static org.bukkit.Bukkit.getOfflinePlayer;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -95,6 +88,7 @@ public class ManageRemoveCommand extends SubCommand {
|
||||
(new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse());
|
||||
plugin.getDB().removeAccount(uuid.toString());
|
||||
sender.sendMessage(hColor+""+Phrase.ARROWS_RIGHT+" "+oColor+"Data of "+hColor+playerName+oColor+" was removed from Database "+hColor+plugin.getDB().getConfigName()+oColor+".");
|
||||
this.cancel();
|
||||
|
@ -0,0 +1,119 @@
|
||||
package main.java.com.djrapitops.plan.command.commands.manage;
|
||||
|
||||
import com.djrapitops.plan.Phrase;
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.command.CommandType;
|
||||
import com.djrapitops.plan.command.SubCommand;
|
||||
import com.djrapitops.plan.data.ServerData;
|
||||
import com.djrapitops.plan.database.Database;
|
||||
import com.djrapitops.plan.database.databases.SQLiteDB;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.utilities.DataCombineUtils;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class ManageRestoreCommand extends SubCommand {
|
||||
|
||||
private Plan plugin;
|
||||
|
||||
/**
|
||||
* Class Constructor.
|
||||
*
|
||||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public ManageRestoreCommand(Plan plugin) {
|
||||
super("restore", "plan.restore", "Restore a database from a backup file", CommandType.CONSOLE, "<Filename.db> <dbTo> [-a]");
|
||||
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Subcommand Manage backup.
|
||||
*
|
||||
* @param sender
|
||||
* @param cmd
|
||||
* @param commandLabel
|
||||
* @param args Player's name or nothing - if empty sender's name is used.
|
||||
* @return true in all cases.
|
||||
*/
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||
try {
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage(Phrase.COMMAND_REQUIRES_ARGUMENTS.toString() + " Use /plan manage restore <Filename.db> <dbTo> [-a]");
|
||||
return true;
|
||||
}
|
||||
String db = args[1].toLowerCase();
|
||||
if (!db.equals("mysql") && !db.equals("sqlite")) {
|
||||
sender.sendMessage(Phrase.MANAGE_ERROR_INCORRECT_DB + db);
|
||||
return true;
|
||||
}
|
||||
if (!Arrays.asList(args).contains("-a")) {
|
||||
sender.sendMessage(Phrase.COMMAND_ADD_CONFIRMATION_ARGUMENT.toString() + " Data in " + args[1] + "-database will be rewritten!");
|
||||
return true;
|
||||
}
|
||||
Database database = null;
|
||||
for (Database sqldb : plugin.getDatabases()) {
|
||||
if (db.equalsIgnoreCase(sqldb.getConfigName())) {
|
||||
database = sqldb;
|
||||
if (!database.init()) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (database == null) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
plugin.logError(db + " was null!");
|
||||
return true;
|
||||
}
|
||||
final Database copyToDB = database;
|
||||
(new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String backupDBName = args[0];
|
||||
|
||||
File backupDBFile = new File(plugin.getDataFolder(), backupDBName + (backupDBName.contains(".db") ? "" : ".db"));
|
||||
if (!backupDBFile.exists()) {
|
||||
sender.sendMessage(Phrase.MANAGE_ERROR_BACKUP_FILE_NOT_FOUND + " "+args[0]);
|
||||
this.cancel();
|
||||
return;
|
||||
}
|
||||
if (backupDBName.contains(".db")) {
|
||||
backupDBName = backupDBName.replace(".db", "");
|
||||
}
|
||||
SQLiteDB backupDB = new SQLiteDB(plugin, backupDBName);
|
||||
if (!backupDB.init()) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
this.cancel();
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse());
|
||||
copyToDB.removeAllData();
|
||||
Set<UUID> uuids = backupDB.getSavedUUIDs();
|
||||
for (UUID uuid : uuids) {
|
||||
copyToDB.saveUserData(uuid, backupDB.getUserData(uuid));
|
||||
}
|
||||
HashMap<Long, ServerData> serverDataHashMap = backupDB.getServerDataHashMap();
|
||||
copyToDB.saveServerDataHashMap(serverDataHashMap);
|
||||
copyToDB.saveCommandUse(DataCombineUtils.getCommandUse(serverDataHashMap));
|
||||
sender.sendMessage(Phrase.MANAGE_COPY_SUCCESS.toString());
|
||||
this.cancel();
|
||||
}
|
||||
}).runTaskAsynchronously(plugin);
|
||||
} catch (NullPointerException e) {
|
||||
sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE + "");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -144,4 +144,5 @@ public abstract class Database {
|
||||
public abstract void removeAllData();
|
||||
public abstract void saveServerDataHashMap(HashMap<Long, ServerData> serverData);
|
||||
public abstract void saveCommandUse(HashMap<String, Integer> data);
|
||||
public abstract Set<UUID> getSavedUUIDs();
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@ -308,6 +309,22 @@ public abstract class SQLDB extends Database {
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> getSavedUUIDs() {
|
||||
Set<UUID> uuids = new HashSet<>();
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement("SELECT " + userColumnUUID + " FROM " + userName);
|
||||
ResultSet set = statement.executeQuery();
|
||||
while (set.next()) {
|
||||
uuids.add(UUID.fromString(set.getString(userColumnUUID)));
|
||||
}
|
||||
set.close();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return uuids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<Long, ServerData> getServerDataHashMap() {
|
||||
HashMap<String, Integer> commandUse = getCommandUse();
|
||||
@ -423,6 +440,7 @@ public abstract class SQLDB extends Database {
|
||||
+ commanduseColumnTimesUsed
|
||||
+ ") VALUES (?, ?)");
|
||||
boolean commitRequired = false;
|
||||
if (!data.isEmpty()) {
|
||||
for (String key : data.keySet()) {
|
||||
statement.setString(1, key);
|
||||
statement.setInt(2, data.get(key));
|
||||
@ -433,6 +451,7 @@ public abstract class SQLDB extends Database {
|
||||
if (commitRequired) {
|
||||
connection.commit();
|
||||
}
|
||||
}
|
||||
statement.close();
|
||||
connection.setAutoCommit(true);
|
||||
|
||||
|
@ -15,6 +15,7 @@ import java.sql.SQLException;
|
||||
public class SQLiteDB extends SQLDB {
|
||||
|
||||
private final Plan plugin;
|
||||
private final String dbName;
|
||||
|
||||
/**
|
||||
* Class Constructor.
|
||||
@ -22,9 +23,14 @@ public class SQLiteDB extends SQLDB {
|
||||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public SQLiteDB(Plan plugin) {
|
||||
this(plugin, "database");
|
||||
}
|
||||
|
||||
public SQLiteDB(Plan plugin, String dbName) {
|
||||
super(plugin, false);
|
||||
|
||||
this.plugin = plugin;
|
||||
this.dbName = dbName;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -34,10 +40,14 @@ public class SQLiteDB extends SQLDB {
|
||||
*/
|
||||
@Override
|
||||
public Connection getNewConnection() {
|
||||
return getNewConnection(dbName);
|
||||
}
|
||||
|
||||
public Connection getNewConnection(String dbName) {
|
||||
try {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
|
||||
return DriverManager.getConnection("jdbc:sqlite:" + new File(plugin.getDataFolder(), "database.db").getAbsolutePath());
|
||||
return DriverManager.getConnection("jdbc:sqlite:" + new File(plugin.getDataFolder(), dbName+".db").getAbsolutePath());
|
||||
} catch (ClassNotFoundException | SQLException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public enum Html {
|
||||
BANNED("| "+SPAN.parse(COLOR_4.parse()+"Banned")),
|
||||
OPERATOR(", Operator (Op)"),
|
||||
ONLINE("| "+SPAN.parse(COLOR_2.parse()+"Online")),
|
||||
OFFLINE("| "+SPAN.parse(COLOR_4.parse()+"Online")),
|
||||
OFFLINE("| "+SPAN.parse(COLOR_4.parse()+"Offline")),
|
||||
ACTIVE("| Player is Active"),
|
||||
INACTIVE("| Player is inactive"),
|
||||
ERROR_LIST("Error Creating List</p>"),
|
||||
|
@ -142,4 +142,17 @@ public class DataCombineUtils {
|
||||
return combinedData;
|
||||
}
|
||||
|
||||
public static HashMap<String, Integer> getCommandUse(HashMap<Long, ServerData> fromServerData) {
|
||||
ServerData sData = null;
|
||||
for (long sDataKey : fromServerData.keySet()) {
|
||||
sData = fromServerData.get(sDataKey);
|
||||
break;
|
||||
}
|
||||
HashMap<String, Integer> fromCommandUse = null;
|
||||
if (sData != null) {
|
||||
fromCommandUse = sData.getCommandUsage();
|
||||
}
|
||||
return fromCommandUse;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user