From c6d4444bd63d68a740f5c2c0f1cd7e068d670306 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Thu, 27 Jul 2017 12:03:07 +0200 Subject: [PATCH 1/4] Fix MB conversion at RAM usage --- .../main/java/com/djrapitops/plan/ServerVariableHolder.java | 3 ++- .../com/djrapitops/plan/data/listeners/TPSCountTimer.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/ServerVariableHolder.java b/Plan/src/main/java/com/djrapitops/plan/ServerVariableHolder.java index f7bbbb6e1..46feb38ed 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ServerVariableHolder.java +++ b/Plan/src/main/java/com/djrapitops/plan/ServerVariableHolder.java @@ -25,7 +25,8 @@ public class ServerVariableHolder { ip = server.getIp(); String serverName = server.getName(); - usingPaper = serverName.equals("Paper") || serverName.equals("TacoSpigot"); + usingPaper = serverName.equals("Paper") + || serverName.equals("TacoSpigot"); //Fork of Paper } /** diff --git a/Plan/src/main/java/com/djrapitops/plan/data/listeners/TPSCountTimer.java b/Plan/src/main/java/com/djrapitops/plan/data/listeners/TPSCountTimer.java index 3802b6520..edc65d4e7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/listeners/TPSCountTimer.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/listeners/TPSCountTimer.java @@ -75,8 +75,8 @@ public class TPSCountTimer extends AbsRunnable { Runtime runtime = Runtime.getRuntime(); - long totalMemory = runtime.totalMemory() / 1024L; - long usedMemory = totalMemory - runtime.freeMemory() / 1024L; + long totalMemory = runtime.totalMemory(); + long usedMemory = (totalMemory - runtime.freeMemory()) / (1024L * 1024L); int playersOnline = plugin.getServer().getOnlinePlayers().size(); int loadedChunks = getLoadedChunks(); From 3c63fde839dc2c893d172bdcb209b00190000e76 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Thu, 27 Jul 2017 13:09:08 +0200 Subject: [PATCH 2/4] Light reformat, map now really scales (Wasn't pushed last time) --- ...itops_abstract_plugin_framework_2_0_1.xml} | 8 +- .../commands/manage/ManageCleanCommand.java | 1 + .../commands/manage/ManageImportCommand.java | 1 + .../commands/manage/ManageMoveCommand.java | 4 + .../commands/manage/ManageRemoveCommand.java | 3 + .../commands/manage/ManageRestoreCommand.java | 7 + .../commands/webuser/WebListUsersCommand.java | 1 - .../data/cache/GeolocationCacheHandler.java | 2 - Plan/src/main/resources/analysis.html | 1982 ++++++++--------- 9 files changed, 946 insertions(+), 1063 deletions(-) rename .idea/libraries/{Maven__com_djrapitops_abstract_plugin_framework_2_0_0.xml => Maven__com_djrapitops_abstract_plugin_framework_2_0_1.xml} (67%) diff --git a/.idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_0.xml b/.idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_1.xml similarity index 67% rename from .idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_0.xml rename to .idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_1.xml index e90b3b519..826d210d1 100644 --- a/.idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_0.xml +++ b/.idea/libraries/Maven__com_djrapitops_abstract_plugin_framework_2_0_1.xml @@ -1,13 +1,13 @@ - + - + - + - + \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageCleanCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageCleanCommand.java index 4da62da1a..d529912f8 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageCleanCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageCleanCommand.java @@ -39,6 +39,7 @@ public class ManageCleanCommand extends SubCommand { if (!Check.isTrue(args.length != 0, Phrase.COMMAND_REQUIRES_ARGUMENTS_ONE.toString(), sender)) { return true; } + String dbName = args[0].toLowerCase(); boolean isCorrectDB = "sqlite".equals(dbName) || "mysql".equals(dbName); diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java index c9dd9dadd..5ac186290 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageImportCommand.java @@ -58,6 +58,7 @@ public class ManageImportCommand extends SubCommand { if (!Check.isTrue(importPlugins.keySet().contains(importFromPlugin), Phrase.MANAGE_ERROR_INCORRECT_PLUGIN + importFromPlugin, sender)) { return true; } + if (!Check.isTrue(ImportUtils.isPluginEnabled(importFromPlugin), Phrase.MANAGE_ERROR_PLUGIN_NOT_ENABLED + importFromPlugin, sender)) { return true; } diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java index 45e4c7d9a..ffec8a003 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageMoveCommand.java @@ -58,9 +58,11 @@ public class ManageMoveCommand extends SubCommand { if (!Check.isTrue(isCorrectDB, Phrase.MANAGE_ERROR_INCORRECT_DB + toDB, sender)) { return true; } + if (!Check.isTrue(!Verify.equalsIgnoreCase(fromDB, toDB), Phrase.MANAGE_ERROR_SAME_DB.toString(), sender)) { return true; } + if (!Check.isTrue(Verify.contains("-a", args), Phrase.COMMAND_ADD_CONFIRMATION_ARGUMENT.parse(Phrase.WARN_REMOVE.parse(args[1])), sender)) { return true; } @@ -92,7 +94,9 @@ public class ManageMoveCommand extends SubCommand { if (Check.isTrue(Verify.isEmpty(uuids), Phrase.MANAGE_ERROR_NO_PLAYERS + " (" + fromDatabase.getName() + ")", sender)) { return; } + sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse()); + if (ManageUtils.clearAndCopy(toDatabase, fromDatabase, uuids)) { sender.sendMessage(Phrase.MANAGE_MOVE_SUCCESS + ""); boolean movedToCurrentDatabase = Verify.equalsIgnoreCase(toDatabase.getConfigName(), plugin.getDB().getConfigName()); diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java index a66b6cc52..e5796468e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRemoveCommand.java @@ -56,13 +56,16 @@ public class ManageRemoveCommand extends SubCommand { try { UUID uuid = UUIDUtility.getUUIDOf(playerName); String message = Phrase.USERNAME_NOT_VALID.toString(); + if (!Check.isTrue(Verify.notNull(uuid), message, sender)) { return; } + message = Phrase.USERNAME_NOT_KNOWN.toString(); if (!Check.isTrue(plugin.getDB().wasSeenBefore(uuid), message, sender)) { return; } + message = Phrase.COMMAND_ADD_CONFIRMATION_ARGUMENT.parse(Phrase.WARN_REMOVE.parse(plugin.getDB().getConfigName())); if (!Check.isTrue(Verify.contains("-a", args), message, sender)) { return; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java index 3ef71609f..671809b8f 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRestoreCommand.java @@ -44,12 +44,14 @@ public class ManageRestoreCommand extends SubCommand { if (!Check.isTrue(args.length >= 2, Phrase.COMMAND_REQUIRES_ARGUMENTS.parse(Phrase.USE_RESTORE.toString()), sender)) { return true; } + String db = args[1].toLowerCase(); boolean isCorrectDB = "sqlite".equals(db) || "mysql".equals(db); if (!Check.isTrue(isCorrectDB, Phrase.MANAGE_ERROR_INCORRECT_DB + db, sender)) { return true; } + if (!Check.isTrue(Verify.contains("-a", args), Phrase.COMMAND_ADD_CONFIRMATION_ARGUMENT.parse(Phrase.WARN_REWRITE.parse(args[1])), sender)) { return true; } @@ -81,20 +83,25 @@ public class ManageRestoreCommand extends SubCommand { if (containsDBFileExtension) { backupDBName = backupDBName.replace(".db", ""); } + SQLiteDB backupDB = new SQLiteDB(plugin, backupDBName); if (!backupDB.init()) { sender.sendMessage(Phrase.MANAGE_DATABASE_FAILURE.toString()); return; } + sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse()); + final Collection uuids = ManageUtils.getUUIDS(backupDB); if (!Check.isTrue(!Verify.isEmpty(uuids), Phrase.MANAGE_ERROR_NO_PLAYERS + " (" + backupDBName + ")", sender)) { return; } + if (ManageUtils.clearAndCopy(database, backupDB, uuids)) { if (database.getConfigName().equals(plugin.getDB().getConfigName())) { plugin.getHandler().getCommandUseFromDb(); } + sender.sendMessage(Phrase.MANAGE_COPY_SUCCESS.toString()); } else { sender.sendMessage(Phrase.MANAGE_PROCESS_FAIL.toString()); diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java index 1a2a98d60..c34f18b19 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/webuser/WebListUsersCommand.java @@ -37,7 +37,6 @@ public class WebListUsersCommand extends SubCommand { try { ColorScheme cs = plugin.getColorScheme(); String mCol = cs.getMainColor(); - String sCol = cs.getSecondaryColor(); List users = plugin.getDB().getSecurityTable().getUsers(); users.sort(new WebUserComparator()); sender.sendMessage(Phrase.CMD_FOOTER.parse() + mCol + " WebUsers (" + users.size() + ")"); diff --git a/Plan/src/main/java/com/djrapitops/plan/data/cache/GeolocationCacheHandler.java b/Plan/src/main/java/com/djrapitops/plan/data/cache/GeolocationCacheHandler.java index 1f9b5a453..f4a7fe0ce 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/cache/GeolocationCacheHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/cache/GeolocationCacheHandler.java @@ -87,7 +87,5 @@ public class GeolocationCacheHandler { } finally { Benchmark.stop("getUncachedCountry"); } - } - } diff --git a/Plan/src/main/resources/analysis.html b/Plan/src/main/resources/analysis.html index dccc7e5a7..3f4ed8e43 100644 --- a/Plan/src/main/resources/analysis.html +++ b/Plan/src/main/resources/analysis.html @@ -9,274 +9,274 @@ @@ -688,9 +688,6 @@ -
- -
@@ -715,10 +712,6 @@
-
- -

If CPU Graph displays '-1' CPU usage is not available for this platform.

-
@@ -832,50 +825,50 @@
- - - - - - - - + + + + + + - \ No newline at end of file + \ No newline at end of file From 2df8e7a4a2c661b65664fa7a976473c696b07d2d Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Thu, 27 Jul 2017 13:18:03 +0200 Subject: [PATCH 3/4] Adds the CPU box (Was removed because I took the 3.5.4 one by an accident --- Plan/src/main/resources/analysis.html | 134 +++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 1 deletion(-) diff --git a/Plan/src/main/resources/analysis.html b/Plan/src/main/resources/analysis.html index 3f4ed8e43..e085b0250 100644 --- a/Plan/src/main/resources/analysis.html +++ b/Plan/src/main/resources/analysis.html @@ -688,6 +688,9 @@ +
+ +
@@ -712,6 +715,10 @@
+
+ +
+

If CPU Graph displays '-1' CPU usage is not available for this platform.

@@ -1302,6 +1309,131 @@ }); + +