Conversion to .toString() and String.valueOf()

Add mockHTTPServer() for future HTTP Server Tests
This commit is contained in:
Fuzzlemann 2017-07-30 20:11:52 +02:00
parent afaf240cdc
commit 0dc8e972c4
13 changed files with 71 additions and 71 deletions

View File

@ -22,7 +22,7 @@ public enum Phrase {
PREFIX("[Plan] "), PREFIX("[Plan] "),
ENABLED("Player Analytics Enabled."), ENABLED("Player Analytics Enabled."),
DISABLED("Player Analytics Disabled."), DISABLED("Player Analytics Disabled."),
RELOAD_COMPLETE(ChatColor.GREEN + "" + PREFIX + "Reload complete."), RELOAD_COMPLETE(ChatColor.GREEN.toString() + PREFIX + "Reload complete."),
CACHE_SAVE("Saving cached data.."), CACHE_SAVE("Saving cached data.."),
CACHE_ADD("Added REPLACE0 to Cache."), CACHE_ADD("Added REPLACE0 to Cache."),
CACHE_REMOVE("Cleared REPLACE0 from Cache."), CACHE_REMOVE("Cleared REPLACE0 from Cache."),
@ -35,7 +35,7 @@ public enum Phrase {
DB_ESTABLISHED(REPLACE0 + "-database connection established."), DB_ESTABLISHED(REPLACE0 + "-database connection established."),
DB_TYPE_DOES_NOT_EXIST("That database type doesn't exist."), DB_TYPE_DOES_NOT_EXIST("That database type doesn't exist."),
DB_FAILURE_DISABLE("Database initialization has failed, disabling Plan."), DB_FAILURE_DISABLE("Database initialization has failed, disabling Plan."),
NOTIFY_EMPTY_IP(ChatColor.YELLOW + "" + PREFIX + "IP in server.properties is empty & AlternativeServerIP is not used, incorrect links will be given!"), NOTIFY_EMPTY_IP(ChatColor.YELLOW.toString() + PREFIX + "IP in server.properties is empty & AlternativeServerIP is not used, incorrect links will be given!"),
NOTIFY_DISABLED_CHATLISTENER(ChatColor.YELLOW + "Chat listener disabled, nickname info inaccurate."), NOTIFY_DISABLED_CHATLISTENER(ChatColor.YELLOW + "Chat listener disabled, nickname info inaccurate."),
NOTIFY_DISABLED_GMLISTENER(ChatColor.YELLOW + "Gamemode change listener disabled, Gm times info inaccurate."), NOTIFY_DISABLED_GMLISTENER(ChatColor.YELLOW + "Gamemode change listener disabled, Gm times info inaccurate."),
NOTIFY_DISABLED_COMMANDLISTENER(ChatColor.YELLOW + "Command usage listener disabled."), NOTIFY_DISABLED_COMMANDLISTENER(ChatColor.YELLOW + "Command usage listener disabled."),
@ -50,9 +50,9 @@ public enum Phrase {
VERSION_CHECK_ERROR("Failed to compare versions."), VERSION_CHECK_ERROR("Failed to compare versions."),
VERSION_FAIL("Failed to get newest version number."), VERSION_FAIL("Failed to get newest version number."),
// //
USERNAME_NOT_VALID(ChatColor.RED + "" + PREFIX + "This Player doesn't exist."), USERNAME_NOT_VALID(ChatColor.RED.toString() + PREFIX + "This Player doesn't exist."),
USERNAME_NOT_SEEN(ChatColor.RED + "" + PREFIX + "This Player has not played on this server."), USERNAME_NOT_SEEN(ChatColor.RED.toString() + PREFIX + "This Player has not played on this server."),
USERNAME_NOT_KNOWN(ChatColor.RED + "" + PREFIX + "Player not found from the database."), USERNAME_NOT_KNOWN(ChatColor.RED.toString() + PREFIX + "Player not found from the database."),
// //
COLOR_MAIN(ChatColor.getByChar(Settings.COLOR_MAIN.toString().charAt(1))), COLOR_MAIN(ChatColor.getByChar(Settings.COLOR_MAIN.toString().charAt(1))),
COLOR_SEC(ChatColor.getByChar(Settings.COLOR_SEC.toString().charAt(1))), COLOR_SEC(ChatColor.getByChar(Settings.COLOR_SEC.toString().charAt(1))),
@ -60,14 +60,14 @@ public enum Phrase {
// //
ARROWS_RIGHT("»"), ARROWS_RIGHT("»"),
BALL(""), BALL(""),
GRABBING_DATA_MESSAGE(COLOR_TER + "" + ARROWS_RIGHT + COLOR_MAIN.color() + " Fetching data to cache.."), GRABBING_DATA_MESSAGE(COLOR_TER.toString() + ARROWS_RIGHT + COLOR_MAIN.color() + " Fetching data to cache.."),
// //
DEM_UNKNOWN("Not Known"), DEM_UNKNOWN("Not Known"),
NOT_IN_TOWN("Not in a town"), NOT_IN_TOWN("Not in a town"),
NOT_IN_FAC("Not in a faction"), NOT_IN_FAC("Not in a faction"),
// //
ANALYSIS("Analysis | "), ANALYSIS("Analysis | "),
COMMAND_TIMEOUT(ChatColor.RED + "" + PREFIX + "REPLACE0 Command timed out! Check '/plan status' & console."), COMMAND_TIMEOUT(ChatColor.RED.toString() + PREFIX + "REPLACE0 Command timed out! Check '/plan status' & console."),
ANALYSIS_START(ANALYSIS + "Beginning analysis of user data.."), ANALYSIS_START(ANALYSIS + "Beginning analysis of user data.."),
ANALYSIS_BOOT_NOTIFY(ANALYSIS + "Boot analysis in 30 seconds.."), ANALYSIS_BOOT_NOTIFY(ANALYSIS + "Boot analysis in 30 seconds.."),
ANALYSIS_BOOT(ANALYSIS + "Starting Boot Analysis.."), ANALYSIS_BOOT(ANALYSIS + "Starting Boot Analysis.."),
@ -89,39 +89,39 @@ public enum Phrase {
ERROR_ANALYSIS_FETCH_FAIL("Failed to fetch data for Analysis, Exception occurred."), ERROR_ANALYSIS_FETCH_FAIL("Failed to fetch data for Analysis, Exception occurred."),
ERROR_ANALYSIS_DISABLED_TEMPORARILY(ChatColor.YELLOW + "Analysis has been temporarily disabled due to expensive task, use /plan status for info."), ERROR_ANALYSIS_DISABLED_TEMPORARILY(ChatColor.YELLOW + "Analysis has been temporarily disabled due to expensive task, use /plan status for info."),
// //
CMD_FOOTER(COLOR_TER.color() + "" + ARROWS_RIGHT), CMD_FOOTER(COLOR_TER.color().toString() + ARROWS_RIGHT),
MANAGE_ERROR_INCORRECT_PLUGIN(ChatColor.RED + "" + PREFIX + "Plugin not supported: "), MANAGE_ERROR_INCORRECT_PLUGIN(ChatColor.RED.toString() + PREFIX + "Plugin not supported: "),
MANAGE_PROCESS_START(ARROWS_RIGHT + "" + COLOR_SEC.color() + " Processing data.."), MANAGE_PROCESS_START(ARROWS_RIGHT.toString() + COLOR_SEC.color() + " Processing data.."),
MANAGE_ERROR_PLUGIN_NOT_ENABLED(ChatColor.RED + "" + PREFIX + "Plugin is not enabled: "), MANAGE_ERROR_PLUGIN_NOT_ENABLED(ChatColor.RED.toString() + PREFIX + "Plugin is not enabled: "),
MANAGE_ERROR_INCORRECT_DB(ChatColor.RED + "" + PREFIX + "Incorrect database! (sqlite/mysql accepted): "), MANAGE_ERROR_INCORRECT_DB(ChatColor.RED.toString() + PREFIX + "Incorrect database! (sqlite/mysql accepted): "),
MANAGE_ERROR_SAME_DB(ChatColor.RED + "" + PREFIX + "Can't move to the same database!"), MANAGE_ERROR_SAME_DB(ChatColor.RED.toString() + PREFIX + "Can't move to the same database!"),
MANAGE_DATABASE_FAILURE(ChatColor.RED + "" + PREFIX + "One of the databases was not initialized properly."), MANAGE_DATABASE_FAILURE(ChatColor.RED.toString() + 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_DB_CONFIG_REMINDER(ChatColor.YELLOW.toString() + 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_NO_PLAYERS(ChatColor.RED.toString() + PREFIX + "Database has no player data!"),
MANAGE_ERROR_BACKUP_FILE_NOT_FOUND(ChatColor.RED + "" + PREFIX + "Backup file doesn't exist!"), MANAGE_ERROR_BACKUP_FILE_NOT_FOUND(ChatColor.RED.toString() + PREFIX + "Backup file doesn't exist!"),
MANAGE_MOVE_SUCCESS(ChatColor.GREEN + "" + PREFIX + "All data moved successfully!"), MANAGE_MOVE_SUCCESS(ChatColor.GREEN.toString() + PREFIX + "All data moved successfully!"),
MANAGE_COPY_SUCCESS(ChatColor.GREEN + "" + PREFIX + "All data copied successfully!"), MANAGE_COPY_SUCCESS(ChatColor.GREEN.toString() + PREFIX + "All data copied successfully!"),
MANAGE_PROCESS_FAIL(ChatColor.RED + "" + PREFIX + "Something went wrong while processing the data!"), MANAGE_PROCESS_FAIL(ChatColor.RED.toString() + PREFIX + "Something went wrong while processing the data!"),
MANAGE_CLEAR_SUCCESS(ChatColor.GREEN + "" + PREFIX + "All data cleared successfully!"), MANAGE_CLEAR_SUCCESS(ChatColor.GREEN.toString() + PREFIX + "All data cleared successfully!"),
MANAGE_REMOVE_SUCCESS(CMD_FOOTER + " " + COLOR_MAIN.color() + "Data of " + COLOR_TER.color() + "REPLACE0" + COLOR_MAIN.color() + " was removed from Database " + COLOR_TER.color() + "REPLACE1" + COLOR_MAIN.color() + "."), MANAGE_REMOVE_SUCCESS(CMD_FOOTER + " " + COLOR_MAIN.color() + "Data of " + COLOR_TER.color() + "REPLACE0" + COLOR_MAIN.color() + " was removed from Database " + COLOR_TER.color() + "REPLACE1" + COLOR_MAIN.color() + "."),
MANAGE_IMPORTING(CMD_FOOTER + " " + COLOR_MAIN.color() + " Importing Data.."), MANAGE_IMPORTING(CMD_FOOTER + " " + COLOR_MAIN.color() + " Importing Data.."),
MANAGE_SUCCESS(CMD_FOOTER + " " + COLOR_MAIN.color() + " Success!"), MANAGE_SUCCESS(CMD_FOOTER + " " + COLOR_MAIN.color() + " Success!"),
// //
CMD_BALL(COLOR_SEC.color() + " " + Phrase.BALL.toString() + COLOR_MAIN.color()), CMD_BALL(COLOR_SEC.color() + " " + Phrase.BALL.toString() + COLOR_MAIN.color()),
CMD_ANALYZE_HEADER(CMD_FOOTER + "" + COLOR_MAIN.color() + " Player Analytics - Analysis results"), CMD_ANALYZE_HEADER(CMD_FOOTER.toString() + COLOR_MAIN.color() + " Player Analytics - Analysis results"),
CMD_INSPECT_HEADER(CMD_FOOTER + "" + COLOR_MAIN.color() + " Player Analytics - Inspect results: "), CMD_INSPECT_HEADER(CMD_FOOTER.toString() + COLOR_MAIN.color() + " Player Analytics - Inspect results: "),
CMD_INFO_HEADER(CMD_FOOTER + "" + COLOR_MAIN.color() + " Player Analytics - Info"), CMD_INFO_HEADER(CMD_FOOTER.toString() + COLOR_MAIN.color() + " Player Analytics - Info"),
CMD_INFO_VERSION(CMD_BALL + "" + COLOR_MAIN.color() + " Version: " + COLOR_SEC.color() + REPLACE0), CMD_INFO_VERSION(CMD_BALL.toString() + COLOR_MAIN.color() + " Version: " + COLOR_SEC.color() + REPLACE0),
CMD_SEARCH_HEADER(CMD_FOOTER + "" + COLOR_MAIN.color() + " Player Analytics - Search results for: "), CMD_SEARCH_HEADER(CMD_FOOTER.toString() + COLOR_MAIN.color() + " Player Analytics - Search results for: "),
CMD_SEARCH_SEARCHING(CMD_FOOTER + "" + COLOR_MAIN.color() + " Searching.."), CMD_SEARCH_SEARCHING(CMD_FOOTER.toString() + COLOR_MAIN.color() + " Searching.."),
CMD_HELP_HEADER(CMD_FOOTER + "" + COLOR_MAIN.color() + " Player Analytics - Help"), CMD_HELP_HEADER(CMD_FOOTER.toString() + COLOR_MAIN.color() + " Player Analytics - Help"),
CMD_MANAGE_HELP_HEADER(CMD_FOOTER + "" + COLOR_MAIN.color() + " Player Analytics - Managment Help"), CMD_MANAGE_HELP_HEADER(CMD_FOOTER.toString() + COLOR_MAIN.color() + " Player Analytics - Managment Help"),
CMD_MANAGE_STATUS_HEADER(CMD_FOOTER + "" + COLOR_MAIN.color() + " Player Analytics - Database status"), CMD_MANAGE_STATUS_HEADER(CMD_FOOTER.toString() + COLOR_MAIN.color() + " Player Analytics - Database status"),
CMD_MANAGE_STATUS_ACTIVE_DB(CMD_BALL + "" + COLOR_MAIN.color() + " Active Database: " + COLOR_SEC.color() + "REPLACE0"), CMD_MANAGE_STATUS_ACTIVE_DB(CMD_BALL.toString() + COLOR_MAIN.color() + " Active Database: " + COLOR_SEC.color() + "REPLACE0"),
CMD_MANAGE_STATUS_QUEUE_SAVE(CMD_BALL + "" + COLOR_MAIN.color() + " Save Queue Size: " + COLOR_SEC.color() + "REPLACE0/" + Settings.PROCESS_SAVE_LIMIT.getNumber()), CMD_MANAGE_STATUS_QUEUE_SAVE(CMD_BALL.toString() + COLOR_MAIN.color() + " Save Queue Size: " + COLOR_SEC.color() + "REPLACE0/" + Settings.PROCESS_SAVE_LIMIT.getNumber()),
CMD_MANAGE_STATUS_QUEUE_GET(CMD_BALL + "" + COLOR_MAIN.color() + " Get Queue Size: " + COLOR_SEC.color() + "REPLACE0/" + Settings.PROCESS_GET_LIMIT.getNumber()), CMD_MANAGE_STATUS_QUEUE_GET(CMD_BALL.toString() + COLOR_MAIN.color() + " Get Queue Size: " + COLOR_SEC.color() + "REPLACE0/" + Settings.PROCESS_GET_LIMIT.getNumber()),
CMD_MANAGE_STATUS_QUEUE_CLEAR(CMD_BALL + "" + COLOR_MAIN.color() + " Clear Queue Size: " + COLOR_SEC.color() + "REPLACE0/" + Settings.PROCESS_CLEAR_LIMIT.getNumber()), CMD_MANAGE_STATUS_QUEUE_CLEAR(CMD_BALL.toString() + COLOR_MAIN.color() + " Clear Queue Size: " + COLOR_SEC.color() + "REPLACE0/" + Settings.PROCESS_CLEAR_LIMIT.getNumber()),
CMD_MANAGE_STATUS_QUEUE_PROCESS(CMD_BALL + "" + COLOR_MAIN.color() + " Process Queue Size: " + COLOR_SEC.color() + "REPLACE0/20000"), CMD_MANAGE_STATUS_QUEUE_PROCESS(CMD_BALL.toString() + COLOR_MAIN.color() + " Process Queue Size: " + COLOR_SEC.color() + "REPLACE0/20000"),
CMD_CLICK_ME("Click Me"), CMD_CLICK_ME("Click Me"),
CMD_LINK(COLOR_SEC.color() + " " + BALL + COLOR_MAIN.color() + " Link: " + COLOR_TER.color()), CMD_LINK(COLOR_SEC.color() + " " + BALL + COLOR_MAIN.color() + " Link: " + COLOR_TER.color()),
CMD_PASS_PLANLITE("UNUSED"), CMD_PASS_PLANLITE("UNUSED"),
@ -168,11 +168,11 @@ public enum Phrase {
WARN_OVERWRITE_SOME("Some data in REPLACE0-database will be overwritten!"), WARN_OVERWRITE_SOME("Some data in REPLACE0-database will be overwritten!"),
WARN_REMOVE("Data in REPLACE0-database will be removed!"), WARN_REMOVE("Data in REPLACE0-database will be removed!"),
// //
COMMAND_SENDER_NOT_PLAYER(ChatColor.RED + "" + PREFIX + "This command can be only used as a player."), COMMAND_SENDER_NOT_PLAYER(ChatColor.RED.toString() + PREFIX + "This command can be only used as a player."),
COMMAND_REQUIRES_ARGUMENTS(ChatColor.RED + "" + PREFIX + "Command requires arguments. REPLACE0"), COMMAND_REQUIRES_ARGUMENTS(ChatColor.RED.toString() + PREFIX + "Command requires arguments. REPLACE0"),
COMMAND_ADD_CONFIRMATION_ARGUMENT(ChatColor.RED + "" + PREFIX + "Add -a to confirm execution! REPLACE0"), COMMAND_ADD_CONFIRMATION_ARGUMENT(ChatColor.RED.toString() + PREFIX + "Add -a to confirm execution! REPLACE0"),
COMMAND_REQUIRES_ARGUMENTS_ONE(ChatColor.RED + "" + PREFIX + "Command requires one argument."), COMMAND_REQUIRES_ARGUMENTS_ONE(ChatColor.RED.toString() + PREFIX + "Command requires one argument."),
COMMAND_NO_PERMISSION(ChatColor.RED + "" + PREFIX + "You do not have the required permission."), COMMAND_NO_PERMISSION(ChatColor.RED.toString() + PREFIX + "You do not have the required permission."),
ERROR_TOO_SMALL_QUEUE("Queue size is too small! (REPLACE0), change the setting to a higher number! (Currently REPLACE1)"); ERROR_TOO_SMALL_QUEUE("Queue size is too small! (REPLACE0), change the setting to a higher number! (Currently REPLACE1)");
private String text; private String text;

View File

@ -89,7 +89,7 @@ public class InspectCommand extends SubCommand {
if (!Check.isTrue(plugin.getDB().wasSeenBefore(uuid), Phrase.USERNAME_NOT_KNOWN.toString(), sender)) { if (!Check.isTrue(plugin.getDB().wasSeenBefore(uuid), Phrase.USERNAME_NOT_KNOWN.toString(), sender)) {
return; return;
} }
sender.sendMessage(Phrase.GRABBING_DATA_MESSAGE + ""); sender.sendMessage(Phrase.GRABBING_DATA_MESSAGE.toString());
if (CommandUtils.isPlayer(sender) && plugin.getUiServer().isAuthRequired()) { if (CommandUtils.isPlayer(sender) && plugin.getUiServer().isAuthRequired()) {
boolean senderHasWebUser = plugin.getDB().getSecurityTable().userExists(sender.getName()); boolean senderHasWebUser = plugin.getDB().getSecurityTable().userExists(sender.getName());
if (!senderHasWebUser) { if (!senderHasWebUser) {
@ -140,7 +140,7 @@ public class InspectCommand extends SubCommand {
} else { } else {
// Link // Link
String url = HtmlUtils.getInspectUrlWithProtocol(playerName); String url = HtmlUtils.getInspectUrlWithProtocol(playerName);
String message = Phrase.CMD_LINK + ""; String message = Phrase.CMD_LINK.toString();
boolean console = !CommandUtils.isPlayer(sender); boolean console = !CommandUtils.isPlayer(sender);
if (console) { if (console) {
sender.sendMessage(message + url); sender.sendMessage(message + url);
@ -150,6 +150,6 @@ public class InspectCommand extends SubCommand {
} }
} }
sender.sendMessage(Phrase.CMD_FOOTER + ""); sender.sendMessage(Phrase.CMD_FOOTER.toString());
} }
} }

View File

@ -31,7 +31,7 @@ public class SearchCommand extends SubCommand {
* @param plugin Current instance of Plan * @param plugin Current instance of Plan
*/ */
public SearchCommand(Plan plugin) { public SearchCommand(Plan plugin) {
super("search", CommandType.CONSOLE_WITH_ARGUMENTS, Permissions.SEARCH.getPermission(), Phrase.CMD_USG_SEARCH + "", Phrase.ARG_SEARCH + ""); super("search", CommandType.CONSOLE_WITH_ARGUMENTS, Permissions.SEARCH.getPermission(), Phrase.CMD_USG_SEARCH.toString(), Phrase.ARG_SEARCH.toString());
this.plugin = plugin; this.plugin = plugin;
setHelp(plugin); setHelp(plugin);
} }
@ -57,7 +57,7 @@ public class SearchCommand extends SubCommand {
if (!Check.isTrue(args.length >= 1, Phrase.COMMAND_REQUIRES_ARGUMENTS_ONE.toString(), sender)) { if (!Check.isTrue(args.length >= 1, Phrase.COMMAND_REQUIRES_ARGUMENTS_ONE.toString(), sender)) {
return true; return true;
} }
sender.sendMessage(Phrase.CMD_SEARCH_SEARCHING + ""); sender.sendMessage(Phrase.CMD_SEARCH_SEARCHING.toString());
runSearchTask(args, sender); runSearchTask(args, sender);
return true; return true;
@ -74,8 +74,9 @@ public class SearchCommand extends SubCommand {
if (names.isEmpty()) { if (names.isEmpty()) {
sender.sendMessage(Phrase.CMD_NO_RESULTS.parse(Arrays.toString(args))); sender.sendMessage(Phrase.CMD_NO_RESULTS.parse(Arrays.toString(args)));
} else { } else {
sender.sendMessage(Phrase.CMD_MATCH + "" + FormattingUtils.collectionToStringNoBrackets(names)); sender.sendMessage(Phrase.CMD_MATCH.toString() + FormattingUtils.collectionToStringNoBrackets(names));
} }
sender.sendMessage(Phrase.CMD_FOOTER.toString()); sender.sendMessage(Phrase.CMD_FOOTER.toString());
} finally { } finally {
this.cancel(); this.cancel();

View File

@ -64,7 +64,7 @@ public class ManageHotswapCommand extends SubCommand {
return true; return true;
} }
if (Check.isTrue(dbName.equals(plugin.getDB().getConfigName()), Phrase.MANAGE_ERROR_SAME_DB + "", sender)) { if (Check.isTrue(dbName.equals(plugin.getDB().getConfigName()), Phrase.MANAGE_ERROR_SAME_DB.toString(), sender)) {
return true; return true;
} }

View File

@ -98,7 +98,7 @@ public class ManageMoveCommand extends SubCommand {
sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse()); sender.sendMessage(Phrase.MANAGE_PROCESS_START.parse());
if (ManageUtils.clearAndCopy(toDatabase, fromDatabase, uuids)) { if (ManageUtils.clearAndCopy(toDatabase, fromDatabase, uuids)) {
sender.sendMessage(Phrase.MANAGE_MOVE_SUCCESS + ""); sender.sendMessage(Phrase.MANAGE_MOVE_SUCCESS.toString());
boolean movedToCurrentDatabase = Verify.equalsIgnoreCase(toDatabase.getConfigName(), plugin.getDB().getConfigName()); boolean movedToCurrentDatabase = Verify.equalsIgnoreCase(toDatabase.getConfigName(), plugin.getDB().getConfigName());
Check.isTrue(!movedToCurrentDatabase, Phrase.MANAGE_DB_CONFIG_REMINDER.toString(), sender); Check.isTrue(!movedToCurrentDatabase, Phrase.MANAGE_DB_CONFIG_REMINDER.toString(), sender);

View File

@ -89,10 +89,10 @@ public class ActivityPart extends RawData {
private void activityPiechart() { private void activityPiechart() {
int[] counts = new int[]{active.size(), inactive.size(), joinedOnce.size(), bans.size()}; int[] counts = new int[]{active.size(), inactive.size(), joinedOnce.size(), bans.size()};
final String colAct = Settings.HCOLOR_ACTP_ACT + ""; final String colAct = Settings.HCOLOR_ACTP_ACT.toString();
final String colIna = Settings.HCOLOR_ACTP_INA + ""; final String colIna = Settings.HCOLOR_ACTP_INA.toString();
final String colJoi = Settings.HCOLOR_ACTP_JON + ""; final String colJoi = Settings.HCOLOR_ACTP_JON.toString();
final String colBan = Settings.HCOLOR_ACTP_BAN + ""; final String colBan = Settings.HCOLOR_ACTP_BAN.toString();
addValue("%activecol%", colAct); addValue("%activecol%", colAct);
addValue("%inactivecol%", colIna); addValue("%inactivecol%", colIna);

View File

@ -14,6 +14,7 @@ import main.java.com.djrapitops.plan.ui.webserver.response.Response;
* This cache uses the Google Guava {@link Cache}. * This cache uses the Google Guava {@link Cache}.
* *
* @author Fuzzlemann * @author Fuzzlemann
* @since 3.6.0
*/ */
public class PageCacheHandler { public class PageCacheHandler {

View File

@ -6,6 +6,7 @@ import main.java.com.djrapitops.plan.ui.webserver.response.Response;
* This interface is used for providing the method to load the page. * This interface is used for providing the method to load the page.
* *
* @author Fuzzlemann * @author Fuzzlemann
* @since 3.6.0
*/ */
public interface PageLoader { public interface PageLoader {

View File

@ -69,9 +69,9 @@ public class PlaceholderUtils {
HashMap<String, String> replaceMap = new HashMap<>(); HashMap<String, String> replaceMap = new HashMap<>();
boolean showIPandUUID = Settings.SECURITY_IP_UUID.isTrue(); boolean showIPandUUID = Settings.SECURITY_IP_UUID.isTrue();
UUID uuid = data.getUuid(); UUID uuid = data.getUuid();
replaceMap.put("%uuid%", (showIPandUUID ? "" + uuid : Html.HIDDEN.parse())); replaceMap.put("%uuid%", (showIPandUUID ? String.valueOf(uuid) : Html.HIDDEN.parse()));
replaceMap.put("%lastseen%", FormatUtils.formatTimeStampYear(data.getLastPlayed())); replaceMap.put("%lastseen%", FormatUtils.formatTimeStampYear(data.getLastPlayed()));
replaceMap.put("%logintimes%", "" + data.getLoginTimes()); replaceMap.put("%logintimes%", String.valueOf(data.getLoginTimes()));
replaceMap.put("%geoloc%", data.getGeolocation()); replaceMap.put("%geoloc%", data.getGeolocation());
long now = MiscUtils.getTime(); long now = MiscUtils.getTime();
boolean isActive = AnalysisUtils.isActive(now, data.getLastPlayed(), data.getPlayTime(), data.getLoginTimes()); boolean isActive = AnalysisUtils.isActive(now, data.getLastPlayed(), data.getPlayTime(), data.getLoginTimes());

View File

@ -1,13 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package test.java.main.java.com.djrapitops.plan.data;
/**
* @author ristolah
*/
public class Tep {
}

View File

@ -149,7 +149,7 @@ public class UserDataTest {
public void testSetGMTime() { public void testSetGMTime() {
test.setGMTime("SURVIVAL", 1L); test.setGMTime("SURVIVAL", 1L);
final Long result = test.getGmTimes().get("SURVIVAL"); final Long result = test.getGmTimes().get("SURVIVAL");
assertTrue("" + result, result == 1L); assertTrue(String.valueOf(result), result == 1L);
} }
/** /**
@ -161,7 +161,7 @@ public class UserDataTest {
String gm = "SURVIVAL"; String gm = "SURVIVAL";
test.setGMTime(gm, 1L); test.setGMTime(gm, 1L);
final Long result = test.getGmTimes().get(gm); final Long result = test.getGmTimes().get(gm);
assertTrue("" + result, result == 1L); assertTrue(String.valueOf(result), result == 1L);
} }
/** /**

View File

@ -2,6 +2,7 @@ package test.java.utils;
import com.djrapitops.plugin.utilities.player.Fetch; import com.djrapitops.plugin.utilities.player.Fetch;
import com.djrapitops.plugin.utilities.player.IPlayer; import com.djrapitops.plugin.utilities.player.IPlayer;
import com.sun.net.httpserver.HttpServer;
import main.java.com.djrapitops.plan.data.KillData; import main.java.com.djrapitops.plan.data.KillData;
import main.java.com.djrapitops.plan.data.SessionData; import main.java.com.djrapitops.plan.data.SessionData;
import main.java.com.djrapitops.plan.data.UserData; import main.java.com.djrapitops.plan.data.UserData;
@ -15,6 +16,8 @@ import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito; import org.powermock.api.mockito.PowerMockito;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.UUID; import java.util.UUID;
import static org.powermock.api.mockito.PowerMockito.when; import static org.powermock.api.mockito.PowerMockito.when;
@ -139,4 +142,11 @@ public class MockUtils {
public static CommandSender mockConsoleSender() { public static CommandSender mockConsoleSender() {
return PowerMockito.mock(CommandSender.class); return PowerMockito.mock(CommandSender.class);
} }
public static HttpServer mockHTTPServer() throws UnknownHostException {
HttpServer httpServer = PowerMockito.mock(HttpServer.class);
when(httpServer.getAddress()).thenReturn(InetSocketAddress.createUnresolved("127.0.0.1", 80));
when(httpServer.getExecutor()).thenReturn(command -> System.out.println("HTTP Server command received"));
return httpServer;
}
} }

View File

@ -105,9 +105,9 @@ public class TestInit {
} }
private YamlConfiguration mockConfig() throws IOException, InvalidConfigurationException { private YamlConfiguration mockConfig() throws IOException, InvalidConfigurationException {
File configfile = new File(getClass().getResource("/config.yml").getPath()); File configFile = new File(getClass().getResource("/config.yml").getPath());
YamlConfiguration configuration = new YamlConfiguration(); YamlConfiguration configuration = new YamlConfiguration();
configuration.load(configfile.getAbsolutePath()); configuration.load(configFile.getAbsolutePath());
return configuration; return configuration;
} }