Merge pull request #243 from Fuzzlemann/master

PR for 3.6.3 (Fuzzlemann) (2)
This commit is contained in:
Rsl1122 2017-08-12 16:08:57 +03:00 committed by GitHub
commit d4cd53cd07
23 changed files with 172 additions and 180 deletions

View File

@ -32,14 +32,17 @@ public class WebLevelCommand extends SubCommand {
ColorScheme cs = plugin.getColorScheme();
String sCol = cs.getSecondaryColor();
String cmdBall = Locale.get(Msg.CMD_CONSTANT_LIST_BALL).parse();
String cmdFooter = Locale.get(Msg.CMD_CONSTANT_FOOTER).parse();
String[] messages = new String[]{
Locale.get(Msg.CMD_CONSTANT_FOOTER).parse(),
cmdBall + sCol + "0: Access all pages",
cmdBall + sCol + "1: Access '/players' and all inspect pages",
cmdBall + sCol + "2: Access inspect page with the same username as the webuser",
cmdBall + sCol + "3+: No permissions",
Locale.get(Msg.CMD_CONSTANT_FOOTER).parse()
cmdFooter,
cmdBall + sCol + "0: Access all pages",
cmdBall + sCol + "1: Access '/players' and all inspect pages",
cmdBall + sCol + "2: Access inspect page with the same username as the webuser",
cmdBall + sCol + "3+: No permissions",
cmdFooter
};
sender.sendMessage(messages);
return true;
}

View File

@ -484,14 +484,6 @@ public class UserData {
return gmTimes;
}
public void setGmTimes(Map<String, Long> times) {
if (Verify.notNull(times)) {
for (Map.Entry<String, Long> entry : times.entrySet()) {
gmTimes.setTime(entry.getKey(), entry.getValue());
}
}
}
/**
* Set the GM Times object containing playtime in each gamemode.
*
@ -503,6 +495,14 @@ public class UserData {
}
}
public void setGmTimes(Map<String, Long> times) {
if (Verify.notNull(times)) {
for (Map.Entry<String, Long> entry : times.entrySet()) {
gmTimes.setTime(entry.getKey(), entry.getValue());
}
}
}
/**
* Is the user Operator?
*

View File

@ -64,7 +64,7 @@ public class AnalysisCacheHandler {
}
/**
* @return
* @return if currently an analysis is being run
*/
public boolean isAnalysisBeingRun() {
return analysis.isAnalysisBeingRun();

View File

@ -516,28 +516,28 @@ public class DataCacheHandler extends SessionCache {
}
/**
* @return
* @return The SaveTask
*/
public DataCacheSaveQueue getSaveTask() {
return saveTask;
}
/**
* @return
* @return The ClearTask
*/
public DataCacheClearQueue getClearTask() {
return clearTask;
}
/**
* @return
* @return The ProcessTask
*/
public DataCacheProcessQueue getProcessTask() {
return processTask;
}
/**
* @return
* @return The GetTask
*/
public DataCacheGetQueue getGetTask() {
return getTask;

View File

@ -33,9 +33,8 @@ public class DBUtils {
* BATCH_SIZE.
*
* @param <T> Object type
* @param objects Collection of the objects. // * @return Lists with max
* size of BATCH_SIZE.
* @return
* @param objects Collection of the objects
* @return Lists with max size of BATCH_SIZE
*/
public static <T> List<List<T>> splitIntoBatches(Collection<T> objects) {
List<List<T>> batches = new ArrayList<>();
@ -57,9 +56,9 @@ public class DBUtils {
}
/**
* @param <T>
* @param objects
* @return
* @param <T> Object type
* @param objects Collection of the objects
* @return Lists with max size of BATCH_SIZE
*/
public static <T> List<List<Container<T>>> splitIntoBatchesId(Map<Integer, List<T>> objects) {
List<List<Container<T>>> wrappedBatches = new ArrayList<>();
@ -83,6 +82,11 @@ public class DBUtils {
return wrappedBatches;
}
/**
* @param <T> Object type
* @param objects Collection of the objects
* @return Lists with max size of BATCH_SIZE
*/
public static <T> List<List<Container<T>>> splitIntoBatchesWithID(Map<Integer, T> objects) {
List<List<Container<T>>> wrappedBatches = new ArrayList<>();

View File

@ -306,7 +306,7 @@ public abstract class SQLDB extends Database {
int userId = usersTable.getUserId(uuid);
boolean success = userId != -1
&& locationsTable.removeUserLocations(userId)
&& ipsTable.removeUserIps(userId)
&& ipsTable.removeUserIPs(userId)
&& nicknamesTable.removeUserNicknames(userId)
&& gmTimesTable.removeUserGMTimes(userId)
&& sessionsTable.removeUserSessions(userId)

View File

@ -1,5 +1,6 @@
package main.java.com.djrapitops.plan.database.tables;
import com.djrapitops.plugin.utilities.Verify;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import main.java.com.djrapitops.plan.utilities.Benchmark;
@ -20,8 +21,8 @@ public class IPsTable extends Table {
private final String columnIP;
/**
* @param db
* @param usingMySQL
* @param db The database
* @param usingMySQL if the server is using MySQL
*/
public IPsTable(SQLDB db, boolean usingMySQL) {
super("plan_ips", db, usingMySQL);
@ -30,7 +31,7 @@ public class IPsTable extends Table {
}
/**
* @return
* @return if the table was created successfully
*/
@Override
public boolean createTable() {
@ -50,10 +51,10 @@ public class IPsTable extends Table {
}
/**
* @param userId
* @return
* @param userId The User ID from which the IPs should be removed from
* @return if the IPs were removed successfully
*/
public boolean removeUserIps(int userId) {
public boolean removeUserIPs(int userId) {
PreparedStatement statement = null;
try {
statement = prepareStatement("DELETE FROM " + tableName + " WHERE (" + columnUserID + "=?)");
@ -69,18 +70,19 @@ public class IPsTable extends Table {
}
/**
* @param userId
* @return
* @throws SQLException
* @param userId The User ID from which the IPs should be retrieved from
* @return The retrieved IPs
* @throws SQLException when an error at retrieval happens
*/
public List<InetAddress> getIPAddresses(int userId) throws SQLException {
PreparedStatement statement = null;
ResultSet set = null;
try {
List<InetAddress> ips = new ArrayList<>();
statement = prepareStatement("SELECT * FROM " + tableName + " WHERE UPPER(" + columnUserID + ") LIKE UPPER(?)");
statement.setInt(1, userId);
set = statement.executeQuery();
List<InetAddress> ips = new ArrayList<>();
while (set.next()) {
String ipAddressName = set.getString(columnIP);
try {
@ -92,15 +94,14 @@ public class IPsTable extends Table {
return ips;
} finally {
close(set);
close(statement);
close(set, statement);
}
}
/**
* @param userId
* @param ips
* @throws SQLException
* @param userId The User ID for which the IPs should be saved for
* @param ips The IPs
* @throws SQLException when an error at saving happens
*/
public void saveIPList(int userId, Set<InetAddress> ips) throws SQLException {
if (ips == null) {
@ -120,8 +121,8 @@ public class IPsTable extends Table {
+ columnIP
+ ") VALUES (?, ?)");
boolean commitRequired = false;
for (InetAddress ip : ips) {
for (InetAddress ip : ips) {
if (ip == null) {
continue;
}
@ -142,12 +143,12 @@ public class IPsTable extends Table {
}
/**
* @param ids
* @return
* @throws SQLException
* @param ids The User IDs for which the IPs should be retrieved for
* @return The User IDs corresponding with their used IPs
* @throws SQLException when an error at retrieval happens
*/
public Map<Integer, Set<InetAddress>> getIPList(Collection<Integer> ids) throws SQLException {
if (ids == null || ids.isEmpty()) {
if (Verify.isEmpty(ids)) {
return new HashMap<>();
}
@ -182,22 +183,23 @@ public class IPsTable extends Table {
return ips;
} finally {
close(set);
close(statement);
close(set, statement);
Benchmark.stop("Database", "Get Ips Multiple");
}
}
/**
* @param ips
* @throws SQLException
* @param ips The User IDs corresponding to their IPs used
* @throws SQLException when an error at saving happens
*/
public void saveIPList(Map<Integer, Set<InetAddress>> ips) throws SQLException {
if (ips == null || ips.isEmpty()) {
if (Verify.isEmpty(ips)) {
return;
}
Benchmark.start("Save Ips Multiple");
Map<Integer, Set<InetAddress>> saved = getIPList(ips.keySet());
PreparedStatement statement = null;
try {
statement = prepareStatement("INSERT INTO " + tableName + " ("
@ -205,7 +207,7 @@ public class IPsTable extends Table {
+ columnIP
+ ") VALUES (?, ?)");
boolean commitRequired = false;
int batchSize = 0;
for (Map.Entry<Integer, Set<InetAddress>> entrySet : ips.entrySet()) {
Integer id = entrySet.getKey();
Set<InetAddress> ipAddresses = entrySet.getValue();
@ -229,7 +231,6 @@ public class IPsTable extends Table {
statement.setString(2, ip.getHostAddress());
statement.addBatch();
commitRequired = true;
batchSize++;
}
}

View File

@ -1,5 +1,6 @@
package main.java.com.djrapitops.plan.database.tables;
import com.djrapitops.plugin.utilities.Verify;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import main.java.com.djrapitops.plan.utilities.Benchmark;
@ -19,8 +20,8 @@ public class NicknamesTable extends Table {
private final String columnCurrent;
/**
* @param db
* @param usingMySQL
* @param db The database
* @param usingMySQL if the server is using MySQL
*/
public NicknamesTable(SQLDB db, boolean usingMySQL) {
super("plan_nicknames", db, usingMySQL);
@ -30,7 +31,7 @@ public class NicknamesTable extends Table {
}
/**
* @return
* @return if the table was created successfully
*/
@Override
public boolean createTable() {
@ -43,6 +44,7 @@ public class NicknamesTable extends Table {
+ "FOREIGN KEY(" + columnUserID + ") REFERENCES " + usersTable.getTableName() + "(" + usersTable.getColumnID() + ")"
+ ")"
);
if (getVersion() < 3) {
alterTablesV3();
}
@ -58,8 +60,8 @@ public class NicknamesTable extends Table {
}
/**
* @param userId
* @return
* @param userId The User ID from which the nicknames should be removed from
* @return if the removal was successful
*/
public boolean removeUserNicknames(int userId) {
PreparedStatement statement = null;
@ -77,9 +79,9 @@ public class NicknamesTable extends Table {
}
/**
* @param userId
* @return
* @throws SQLException
* @param userId The User ID from which the nicknames should be retrieved from
* @return The nicknames of the User
* @throws SQLException when an error at retrieval happens
*/
public List<String> getNicknames(int userId) throws SQLException {
PreparedStatement statement = null;
@ -88,6 +90,7 @@ public class NicknamesTable extends Table {
statement = prepareStatement("SELECT * FROM " + tableName + " WHERE (" + columnUserID + "=?)");
statement.setInt(1, userId);
set = statement.executeQuery();
List<String> nicknames = new ArrayList<>();
String lastNick = "";
while (set.next()) {
@ -95,36 +98,39 @@ public class NicknamesTable extends Table {
if (nickname.isEmpty()) {
continue;
}
nicknames.add(nickname);
if (set.getBoolean(columnCurrent)) {
lastNick = nickname;
}
}
if (!lastNick.isEmpty()) {
nicknames.remove(lastNick);
nicknames.add(lastNick);
nicknames.set(nicknames.size() - 1, lastNick);
}
return nicknames;
} finally {
close(set);
close(statement);
close(set, statement);
}
}
/**
* @param userId
* @param names
* @param lastNick
* @throws SQLException
* @param userId The User ID for which the nicknames should be saved for
* @param names The nicknames
* @param lastNick The latest nickname
* @throws SQLException when an error at saving happens
*/
public void saveNickList(int userId, Set<String> names, String lastNick) throws SQLException {
if (names == null || names.isEmpty()) {
if (Verify.isEmpty(names)) {
return;
}
names.removeAll(getNicknames(userId));
if (names.isEmpty()) {
return;
}
PreparedStatement statement = null;
try {
statement = prepareStatement("INSERT INTO " + tableName + " ("
@ -132,53 +138,55 @@ public class NicknamesTable extends Table {
+ columnCurrent + ", "
+ columnNick
+ ") VALUES (?, ?, ?)");
boolean commitRequired = false;
for (String name : names) {
statement.setInt(1, userId);
statement.setInt(2, (name.equals(lastNick)) ? 1 : 0);
statement.setInt(2, name.equals(lastNick) ? 1 : 0);
statement.setString(3, name);
statement.addBatch();
commitRequired = true;
}
if (commitRequired) {
statement.executeBatch();
}
statement.executeBatch();
} finally {
close(statement);
}
}
/**
* @param ids
* @return
* @throws SQLException
* @param ids The User IDs for which the nicknames should be retrieved for
* @return The User ID corresponding with the nicknames
* @throws SQLException when an error at retrieval happens
*/
public Map<Integer, List<String>> getNicknames(Collection<Integer> ids) throws SQLException {
if (ids == null || ids.isEmpty()) {
if (Verify.isEmpty(ids)) {
return new HashMap<>();
}
Benchmark.start("Get Nicknames Multiple");
PreparedStatement statement = null;
ResultSet set = null;
try {
Map<Integer, List<String>> nicks = new HashMap<>();
Map<Integer, String> lastNicks = new HashMap<>();
for (Integer id : ids) {
nicks.put(id, new ArrayList<>());
}
statement = prepareStatement("SELECT * FROM " + tableName);
set = statement.executeQuery();
while (set.next()) {
Integer id = set.getInt(columnUserID);
if (!ids.contains(id)) {
continue;
}
String nickname = set.getString(columnNick);
if (nickname.isEmpty()) {
continue;
}
nicks.get(id).add(nickname);
if (set.getBoolean(columnCurrent)) {
lastNicks.put(id, nickname);
@ -199,19 +207,18 @@ public class NicknamesTable extends Table {
return nicks;
} finally {
close(set);
close(statement);
close(set, statement);
Benchmark.stop("Database", "Get Nicknames Multiple");
}
}
/**
* @param nicknames
* @param lastNicks
* @throws SQLException
* @param nicknames The User ID corresponding to the nicknames
* @param lastNicks The User ID corresponding with the last nick they inherited
* @throws SQLException when an error at saving happens
*/
public void saveNickLists(Map<Integer, Set<String>> nicknames, Map<Integer, String> lastNicks) throws SQLException {
if (nicknames == null || nicknames.isEmpty()) {
if (Verify.isEmpty(nicknames)) {
return;
}

View File

@ -44,6 +44,21 @@ public class Locale implements Closeable {
messages = new HashMap<>();
}
public static void unload() {
Locale locale = LocaleHolder.getLocale();
if (locale != null) {
locale.close();
}
}
public static Message get(Msg msg) {
Locale locale = LocaleHolder.getLocale();
if (locale == null) {
throw new IllegalStateException("Locale has not been initialized.");
}
return locale.getMessage(msg);
}
public void loadLocale() {
String locale = Settings.LOCALE.toString().toUpperCase();
Benchmark.start("Initializing locale");
@ -325,31 +340,16 @@ public class Locale implements Closeable {
LocaleHolder.locale = null;
}
public static void unload() {
Locale locale = LocaleHolder.getLocale();
if (locale != null) {
locale.close();
}
}
public static Message get(Msg msg) {
Locale locale = LocaleHolder.getLocale();
if (locale == null) {
throw new IllegalStateException("Locale has not been initialized.");
}
return locale.getMessage(msg);
}
private static class LocaleHolder {
private static Locale locale;
public static void setLocale(Locale locale) {
LocaleHolder.locale = locale;
}
public static Locale getLocale() {
return locale;
}
public static void setLocale(Locale locale) {
LocaleHolder.locale = locale;
}
}
}

View File

@ -147,11 +147,11 @@ public enum Msg {
this.identifier = identifier;
}
public String getIdentifier() {
return identifier;
}
public static Map<String, Msg> getIdentifiers() {
return Arrays.stream(values()).collect(Collectors.toMap(Msg::getIdentifier, Function.identity()));
}
public String getIdentifier() {
return identifier;
}
}

View File

@ -1,13 +1,6 @@
package main.java.com.djrapitops.plan.ui.html;
import com.djrapitops.plugin.utilities.Verify;
import main.java.com.djrapitops.plan.Log;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* @author Rsl1122
@ -60,8 +53,7 @@ public enum Html {
TABLELINE_3_CUSTOMKEY("<tr><td sorttable_customkey=\"REPLACE0\">REPLACE1</td><td sorttable_customkey=\"REPLACE2\">REPLACE3</td><td sorttable_customkey=\"REPLACE4\">REPLACE5</td></tr>"),
TABLELINE_3_CUSTOMKEY_1("<tr><td sorttable_customkey=\"REPLACE0\">REPLACE1</td><td>REPLACE2</td><td>REPLACE3</td></tr>"),
ERROR_TABLE_2(TABLELINE_2.parse("No data", "No data")),
TABLE_END("</tbody></table>"), // KILLDATA_NONE("No Kills"),
;
TABLE_END("</tbody></table>"); // KILLDATA_NONE("No Kills"),
private String html;
@ -70,50 +62,15 @@ public enum Html {
}
/**
* @param localeFile
*/
public static void loadLocale(File localeFile) {
try (Scanner localeScanner = new Scanner(localeFile, "UTF-8")) {
List<String> localeRows = new ArrayList<>();
boolean html = false;
while (localeScanner.hasNextLine()) {
String line = localeScanner.nextLine();
if (line.equals("<<<<<<HTML>>>>>>")) {
html = true;
continue;
}
if (!html) {
continue;
}
localeRows.add(line);
}
for (String localeRow : localeRows) {
try {
String[] split = localeRow.split(" <> ");
Html.valueOf(split[0]).setHtml(split[1]);
} catch (IllegalArgumentException e) {
Log.error("There is a miswritten lines in locale on lines " + localeRows.indexOf(localeRow));
}
}
} catch (IOException e) {
Log.error("Something went wrong at loading locale " + localeFile.getAbsoluteFile() + ": " + e.getCause());
}
}
/**
* @return
* @return The HTML String
*/
public String parse() {
return html;
}
/**
* @param p
* @return
* @param p The replacement Strings
* @return The parsed HTML String
*/
public String parse(String... p) {
Verify.nullCheck(p);
@ -125,7 +82,7 @@ public enum Html {
}
/**
* @param html
* @param html Sets the HTML String
*/
public void setHtml(String html) {
this.html = html;

View File

@ -14,8 +14,8 @@ public class WorldMapCreator {
/**
* Creates a data series with iso-a3 specification of Country codes.
*
* @param geoCodeCounts
* @return
* @param geoCodeCounts The country codes and the amount of players located in the country
* @return The created data series
*/
public static String createDataSeries(Map<String, Integer> geoCodeCounts) {
StringBuilder arrayBuilder = new StringBuilder("[");
@ -25,16 +25,17 @@ public class WorldMapCreator {
for (Map.Entry<String, Integer> entry : geoCodeCounts.entrySet()) {
String geoCode = entry.getKey();
Integer players = entry.getValue();
if (players != 0) {
arrayBuilder.append("{'code':'").append(geoCode).append("','value':").append(players).append("}");
if (i < size - 1) {
arrayBuilder.append(",");
}
}
i++;
}
arrayBuilder.append("]");
return arrayBuilder.toString();
}

View File

@ -21,11 +21,12 @@ public class CommandUseTableCreator {
}
/**
* @param commandUse
* @return
* @param commandUse The commands and the amount of times casted
* @return The created command use table
*/
public static String createSortedCommandUseTable(Map<String, Integer> commandUse) {
List<String[]> sorted = MapComparator.sortByValue(commandUse);
StringBuilder html = new StringBuilder();
if (sorted.isEmpty()) {
html.append(Html.ERROR_TABLE_2.parse());
@ -47,6 +48,7 @@ public class CommandUseTableCreator {
i++;
}
}
return html.toString();
}
}

View File

@ -26,8 +26,8 @@ public class KillsTableCreator {
}
/**
* @param killData
* @return
* @param killData The list of the {@link KillData} Objects from which the kill table should be created
* @return The created kills table
*/
public static String createKillsTable(List<KillData> killData) {
StringBuilder html = new StringBuilder(Html.TABLE_KILLS_START.parse());
@ -35,16 +35,17 @@ public class KillsTableCreator {
if (killData.isEmpty()) {
html.append(Html.TABLELINE_3.parse(Locale.get(Msg.HTML_TABLE_NO_KILLS).parse(), "", ""));
} else {
int i = 0;
killData.sort(new KillDataComparator());
Collections.reverse(killData);
int i = 0;
for (KillData kill : killData) {
if (i >= 20) {
break;
}
long date = kill.getDate();
IOfflinePlayer victim = Fetch.getIOfflinePlayer(kill.getVictim());
String name = victim.getName();
html.append(Html.TABLELINE_3_CUSTOMKEY_1.parse(
@ -52,9 +53,11 @@ public class KillsTableCreator {
Html.LINK.parse(HtmlUtils.getInspectUrl(name), name),
kill.getWeapon()
));
i++;
}
}
html.append(Html.TABLE_END.parse());
return html.toString();

View File

@ -23,8 +23,8 @@ public class PlayersTableCreator {
}
/**
* @param data
* @return
* @param data The list of the {@link UserData} Objects from which the players table should be created
* @return The created players table
*/
public static String createSortablePlayersTable(List<UserData> data) {
StringBuilder html = new StringBuilder();
@ -37,6 +37,7 @@ public class PlayersTableCreator {
if (i >= 750) {
break;
}
try {
boolean isBanned = uData.isBanned();
boolean isUnknown = uData.getLoginTimes() == 1;
@ -59,7 +60,9 @@ public class PlayersTableCreator {
String.valueOf(uData.getGeolocation())
));
} catch (NullPointerException ignored) {
/* ignored */
}
i++;
}

View File

@ -29,15 +29,17 @@ public class TextUI {
}
/**
* @param uuid
* @return
* @param uuid The UUID for which the inspect messages should be get for
* @return The inspect messages
*/
public static String[] getInspectMessages(UUID uuid) {
InspectCacheHandler inspectCache = Plan.getInstance().getInspectCache();
long now = MiscUtils.getTime();
if (!inspectCache.isCached(uuid)) {
return new String[]{"Error has occurred, please retry."};
}
UserData d = inspectCache.getFromCache(uuid);
ColorScheme cs = Plan.getInstance().getColorScheme();
@ -49,6 +51,7 @@ public class TextUI {
boolean banned = d.isBanned();
boolean online = d.isOnline();
String ball = sec + " " + DefaultMessages.BALL + main;
return new String[]{
sec + " " + DefaultMessages.BALL + (banned ? ChatColor.DARK_RED + " Banned" : ter + (active ? " Active" : " Inactive")) + (online ? ChatColor.GREEN + " Online" : ChatColor.RED + " Offline"),
ball + " Registered: " + sec + FormatUtils.formatTimeStampYear(d.getRegistered()),
@ -62,26 +65,31 @@ public class TextUI {
}
/**
* @return
* Gets the analysis messages
*
* @return The analysis messages
*/
public static String[] getAnalysisMessages() {
AnalysisCacheHandler analysisCache = Plan.getInstance().getAnalysisCache();
if (!analysisCache.isCached()) {
return new String[]{"Error has occurred, please retry."};
}
AnalysisData d = analysisCache.getData();
ColorScheme cs = Plan.getInstance().getColorScheme();
String main = cs.getMainColor();
String sec = cs.getSecondaryColor();
String ball = sec + " " + DefaultMessages.BALL + main;
final ActivityPart activity = d.getActivityPart();
final JoinInfoPart join = d.getJoinInfoPart();
final KillPart kills = d.getKillPart();
final PlaytimePart playtime = d.getPlaytimePart();
final PlayerCountPart count = d.getPlayerCountPart();
final TPSPart tps = d.getTpsPart();
return new String[]{
ball + " Total Players: " + sec + count.getPlayerCount(),

View File

@ -103,7 +103,8 @@ public class Request implements Closeable {
if (reqLine.length >= 2) {
request = reqLine[0];
target = reqLine[1].replace("%20", " ")
.replace("%2E", ".");;
.replace("%2E", ".");
;
} else {
request = "GET";
target = "/";

View File

@ -350,7 +350,7 @@ public class WebServer {
}
/**
* @return
* @return if the WebServer is enabled
*/
public boolean isEnabled() {
return enabled;

View File

@ -29,6 +29,7 @@ public class PassEncryptUtil {
public static final int HASH_SIZE_INDEX = 2;
public static final int SALT_INDEX = 3;
public static final int PBKDF2_INDEX = 4;
/**
* Constructor used to hide the public constructor
*/

View File

@ -45,7 +45,7 @@ public class PlaceholderUtils {
replaceMap.put("%plugins%", data.replacePluginsTabLayout());
replaceMap.put("%refresh%", FormatUtils.formatTimeAmountDifference(data.getRefreshDate(), MiscUtils.getTime()));
replaceMap.put("%refreshlong%", data.getRefreshDate() + "");
replaceMap.put("%refreshlong%", String.valueOf(data.getRefreshDate()));
replaceMap.put("%servername%", Settings.SERVER_NAME.toString());
@ -94,7 +94,7 @@ public class PlaceholderUtils {
gmPart.analyse();
replaceMap.putAll(gmPart.getReplaceMap());
replaceMap.put("%ips%", (showIPandUUID ? data.getIps().toString() : "Hidden (Config)"));
replaceMap.put("%ips%", showIPandUUID ? data.getIps().toString() : "Hidden (Config)");
replaceMap.put("%nicknames%", HtmlUtils.removeXSS(HtmlUtils.swapColorsToSpan(data.getNicknames().toString())));
replaceMap.put("%name%", data.getName());
replaceMap.put("%registered%", FormatUtils.formatTimeStampYear(data.getRegistered()));
@ -102,7 +102,7 @@ public class PlaceholderUtils {
replaceMap.put("%playtime%", FormatUtils.formatTimeAmount(data.getPlayTime()));
replaceMap.put("%banned%", data.isBanned() ? Locale.get(Msg.HTML_BANNED).parse() : "");
replaceMap.put("%op%", data.isOp() ? Locale.get(Msg.HTML_OP).parse() : "");
replaceMap.put("%isonline%", (data.isOnline()) ? Locale.get(Msg.HTML_ONLINE).parse() : Locale.get(Msg.HTML_OFFLINE).parse());
replaceMap.put("%isonline%", data.isOnline() ? Locale.get(Msg.HTML_ONLINE).parse() : Locale.get(Msg.HTML_OFFLINE).parse());
replaceMap.put("%deaths%", data.getDeaths());
replaceMap.put("%playerkills%", data.getPlayerKills().size());
replaceMap.put("%mobkills%", data.getMobKills());

View File

@ -267,7 +267,7 @@ public class Analysis {
long now = MiscUtils.getTime();
Benchmark.start("Fill Dataset");
List<PluginData> banSources = plugin.getHookHandler().getAdditionalDataSources()
List<PluginData> banSources = plugin.getHookHandler().getAdditionalDataSources()
.stream().filter(PluginData::isBanData).collect(Collectors.toList());
rawData.forEach(uData -> {
uData.access();

View File

@ -13,6 +13,7 @@ public class MathUtils {
private static final DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(Locale.ENGLISH);
private static final DecimalFormat decimalFormat = new DecimalFormat("#.##", decimalFormatSymbols);
/**
* Constructor used to hide the public constructor
*/

View File

@ -10,8 +10,8 @@ import java.util.Map;
/**
* Compares Locale Map Entries and sorts them alphabetically according to the Enum Names.
*
* @since 3.6.2
* @author Rsl1122
* @since 3.6.2
*/
public class LocaleEntryComparator implements Comparator<Map.Entry<Msg, Message>> {