mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-10 04:41:26 +01:00
Add some more JavaDocs
This commit is contained in:
parent
19ce7b5ed6
commit
559238c3da
@ -64,7 +64,7 @@ public class AnalysisCacheHandler {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return if currently an analysis is being run
|
||||
*/
|
||||
public boolean isAnalysisBeingRun() {
|
||||
return analysis.isAnalysisBeingRun();
|
||||
|
@ -521,28 +521,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;
|
||||
|
@ -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<>();
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -53,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;
|
||||
|
||||
@ -63,15 +62,15 @@ public enum Html {
|
||||
}
|
||||
|
||||
/**
|
||||
* @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);
|
||||
@ -83,7 +82,7 @@ public enum Html {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param html
|
||||
* @param html Sets the HTML String
|
||||
*/
|
||||
public void setHtml(String html) {
|
||||
this.html = html;
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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++;
|
||||
}
|
||||
|
||||
|
@ -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(),
|
||||
|
||||
|
@ -350,7 +350,7 @@ public class WebServer {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return if the WebServer is enabled
|
||||
*/
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
|
Loading…
Reference in New Issue
Block a user