diff --git a/Plan/src/main/java/com/djrapitops/plan/Log.java b/Plan/src/main/java/com/djrapitops/plan/Log.java index fbb00c77d..e218366f9 100644 --- a/Plan/src/main/java/com/djrapitops/plan/Log.java +++ b/Plan/src/main/java/com/djrapitops/plan/Log.java @@ -58,16 +58,32 @@ public class Log { Plan.getInstance().getPluginLogger().debug(message); } + /** * Used for logging larger debug complexes. * * @param task complex this debug message is a part of. - * @param message message + * @param message Single message to add to the debug log. * @return full debug complex so far. */ public static DebugInfo debug(String task, String message) { + return getDebug(task).addLine(message, MiscUtils.getTime()); + } + + /** + * Used for logging larger debug complexes. + * + * @param task complex this debug message is a part of. + * @param messages All messages to add to the debug log. + * @return full debug complex so far. + */ + @SafeVarargs + public static DebugInfo debug(String task, String... messages) { DebugInfo debug = getDebug(task); - debug.addLine(message, MiscUtils.getTime()); + long time = MiscUtils.getTime(); + for (String message : messages) { + debug.addLine(message, time); + } return debug; } diff --git a/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLDB.java b/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLDB.java index 53f50f191..c71b9da96 100644 --- a/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLDB.java +++ b/Plan/src/main/java/com/djrapitops/plan/database/databases/SQLDB.java @@ -410,16 +410,18 @@ public abstract class SQLDB extends Database { Map> gmTimes = gmTimesTable.getGMTimes(ids); Map> worldTimes = worldTimesTable.getWorldTimes(ids); - Log.debug("Database", "Data found for:"); - Log.debug("Database", " UUIDs: " + uuids.size()); - Log.debug("Database", " IDs: " + userIds.size()); - Log.debug("Database", " UserData: " + data.size()); - Log.debug("Database", " Nicknames: " + nicknames.size()); - Log.debug("Database", " IPs: " + ipList.size()); - Log.debug("Database", " Kills: " + playerKills.size()); - Log.debug("Database", " Sessions: " + sessionData.size()); - Log.debug("Database", " GM Times: " + gmTimes.size()); - Log.debug("Database", " World Times: " + worldTimes.size()); + Log.debug("Database", + "Data found for:", + " UUIDs: " + uuids.size(), + " IDs: " + userIds.size(), + " UserData: " + data.size(), + " Nicknames: " + nicknames.size(), + " IPs: " + ipList.size(), + " Kills: " + playerKills.size(), + " Sessions: " + sessionData.size(), + " GM Times: " + gmTimes.size(), + " World Times: " + worldTimes.size() + ); for (UserData uData : data) { UUID uuid = uData.getUuid(); diff --git a/Plan/test/test/java/main/java/com/djrapitops/plan/utilities/PassEncryptTest.java b/Plan/test/test/java/main/java/com/djrapitops/plan/utilities/PassEncryptTest.java index 3995e614e..1f6d42a01 100644 --- a/Plan/test/test/java/main/java/com/djrapitops/plan/utilities/PassEncryptTest.java +++ b/Plan/test/test/java/main/java/com/djrapitops/plan/utilities/PassEncryptTest.java @@ -5,11 +5,8 @@ import org.junit.Before; import org.junit.Test; import test.java.utils.RandomData; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; -import java.util.stream.IntStream; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -19,16 +16,14 @@ import static org.junit.Assert.assertTrue; */ public class PassEncryptTest { - private final List PASSWORDS = new ArrayList<>(); private final Map PASSWORD_MAP = new HashMap<>(); @Before public void setUp() throws Exception { - IntStream.range(0, 50).forEach(i -> PASSWORDS.add(RandomData.randomString(RandomData.randomInt(1, 100)))); - - for (String password : PASSWORDS) { + for (int i = 0; i < 20; i++) { + String password = RandomData.randomString(RandomData.randomInt(1, 50)); PASSWORD_MAP.put(password, PassEncryptUtil.createHash(password)); - } + }; } @Test @@ -38,7 +33,7 @@ public class PassEncryptTest { String hash = entry.getValue(); assertTrue(PassEncryptUtil.verifyPassword(password, hash)); - assertFalse(PassEncryptUtil.verifyPassword(RandomData.randomString(RandomData.randomInt(1, 100)), hash)); + assertFalse(PassEncryptUtil.verifyPassword("WrongPassword", hash)); } } }