Removed references to MiscUtils#getTime, removed the method

This commit is contained in:
Rsl1122 2018-05-25 09:03:26 +03:00
parent 20eb3d8c3a
commit 1e75a665b9
36 changed files with 52 additions and 94 deletions

View File

@ -13,7 +13,6 @@ import com.djrapitops.plan.system.cache.CacheSystem;
import com.djrapitops.plan.system.cache.DataCache; import com.djrapitops.plan.system.cache.DataCache;
import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.cache.SessionCache;
import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import java.util.Map; import java.util.Map;
@ -53,7 +52,7 @@ public class ShutdownHook extends Thread {
Database db = null; Database db = null;
try { try {
Map<UUID, Session> activeSessions = SessionCache.getActiveSessions(); Map<UUID, Session> activeSessions = SessionCache.getActiveSessions();
long now = MiscUtils.getTime(); long now = System.currentTimeMillis();
db = Database.getActive(); db = Database.getActive();
saveFirstSessionInformation(db, now); saveFirstSessionInformation(db, now);
saveActiveSessions(db, activeSessions, now); saveActiveSessions(db, activeSessions, now);

View File

@ -71,7 +71,7 @@ public class QInspectCommand extends CommandNode {
PlayerProfile playerProfile = database.fetch().getPlayerProfile(uuid); PlayerProfile playerProfile = database.fetch().getPlayerProfile(uuid);
sendMsgs(sender, playerProfile); sendMessages(sender, playerProfile);
} catch (DBException ex) { } catch (DBException ex) {
Log.toLog(this.getClass(), ex); Log.toLog(this.getClass(), ex);
@ -82,8 +82,8 @@ public class QInspectCommand extends CommandNode {
}).runTaskAsynchronously(); }).runTaskAsynchronously();
} }
private void sendMsgs(ISender sender, PlayerProfile profile) { private void sendMessages(ISender sender, PlayerProfile profile) {
long now = MiscUtils.getTime(); long now = System.currentTimeMillis();
ColorScheme colorScheme = plugin.getColorScheme(); ColorScheme colorScheme = plugin.getColorScheme();

View File

@ -10,7 +10,6 @@ import com.djrapitops.plan.system.settings.Permissions;
import com.djrapitops.plan.system.settings.locale.Locale; import com.djrapitops.plan.system.settings.locale.Locale;
import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.system.settings.locale.Msg;
import com.djrapitops.plan.utilities.Condition; import com.djrapitops.plan.utilities.Condition;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.command.CommandNode; import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType; import com.djrapitops.plugin.command.CommandType;
@ -72,7 +71,6 @@ public class ManageClearCommand extends CommandNode {
database.remove().everything(); database.remove().everything();
long now = MiscUtils.getTime();
sender.sendMessage(Locale.get(Msg.MANAGE_INFO_CLEAR_SUCCESS).toString()); sender.sendMessage(Locale.get(Msg.MANAGE_INFO_CLEAR_SUCCESS).toString());
} catch (FatalDBException e) { } catch (FatalDBException e) {
sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).toString() sender.sendMessage(Locale.get(Msg.MANAGE_INFO_FAIL).toString()

View File

@ -11,7 +11,6 @@ import com.djrapitops.plan.data.container.PlayerKill;
import com.djrapitops.plan.data.container.Session; import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.data.time.WorldTimes; import com.djrapitops.plan.data.time.WorldTimes;
import com.djrapitops.plan.system.info.server.ServerInfo; import com.djrapitops.plan.system.info.server.ServerInfo;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.comparators.ActionComparator; import com.djrapitops.plan.utilities.comparators.ActionComparator;
import com.djrapitops.plan.utilities.comparators.GeoInfoComparator; import com.djrapitops.plan.utilities.comparators.GeoInfoComparator;
@ -177,7 +176,7 @@ public class PlayerProfile {
} }
public long getTotalPlaytime() { public long getTotalPlaytime() {
return getPlaytime(-1, MiscUtils.getTime() + 1L); return getPlaytime(-1, System.currentTimeMillis() + 1L);
} }
public long getPlaytime(long after, long before) { public long getPlaytime(long after, long before) {
@ -189,7 +188,7 @@ public class PlayerProfile {
} }
public long getLongestSession() { public long getLongestSession() {
return getLongestSession(-1, MiscUtils.getTime() + 1L); return getLongestSession(-1, System.currentTimeMillis() + 1L);
} }
public long getLongestSession(int after, long before) { public long getLongestSession(int after, long before) {
@ -201,7 +200,7 @@ public class PlayerProfile {
} }
public long getSessionMedian() { public long getSessionMedian() {
return getSessionMedian(-1, MiscUtils.getTime() + 1L); return getSessionMedian(-1, System.currentTimeMillis() + 1L);
} }
public long getSessionMedian(int after, long before) { public long getSessionMedian(int after, long before) {
@ -215,7 +214,7 @@ public class PlayerProfile {
// Special Getters // Special Getters
public long getSessionAverage() { public long getSessionAverage() {
return getSessionAverage(-1, MiscUtils.getTime() + 1L); return getSessionAverage(-1, System.currentTimeMillis() + 1L);
} }
public long getSessionAverage(int after, long before) { public long getSessionAverage(int after, long before) {
@ -241,7 +240,7 @@ public class PlayerProfile {
public GeoInfo getMostRecentGeoInfo() { public GeoInfo getMostRecentGeoInfo() {
if (geoInformation.isEmpty()) { if (geoInformation.isEmpty()) {
return new GeoInfo("-", "Not Known", MiscUtils.getTime(), ""); return new GeoInfo("-", "Not Known", System.currentTimeMillis(), "");
} }
geoInformation.sort(new GeoInfoComparator()); geoInformation.sort(new GeoInfoComparator());
return geoInformation.get(0); return geoInformation.get(0);

View File

@ -93,7 +93,7 @@ public class AnalysisData extends RawData {
} }
public void analyze(ServerProfile profile) { public void analyze(ServerProfile profile) {
long now = MiscUtils.getTime(); long now = System.currentTimeMillis();
refreshDate = now; refreshDate = now;
long dayAgo = now - TimeAmount.DAY.ms(); long dayAgo = now - TimeAmount.DAY.ms();
long weekAgo = now - TimeAmount.WEEK.ms(); long weekAgo = now - TimeAmount.WEEK.ms();

View File

@ -1,7 +1,6 @@
package com.djrapitops.plan.data.container; package com.djrapitops.plan.data.container;
import com.djrapitops.plan.data.time.WorldTimes; import com.djrapitops.plan.data.time.WorldTimes;
import com.djrapitops.plan.utilities.MiscUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -106,7 +105,7 @@ public class Session {
*/ */
public long getLength() { public long getLength() {
if (sessionEnd == -1) { if (sessionEnd == -1) {
return MiscUtils.getTime() - sessionStart; return System.currentTimeMillis() - sessionStart;
} }
return sessionEnd - sessionStart; return sessionEnd - sessionStart;
} }

View File

@ -1,7 +1,5 @@
package com.djrapitops.plan.data.time; package com.djrapitops.plan.data.time;
import com.djrapitops.plan.utilities.MiscUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
@ -28,7 +26,7 @@ public class WorldTimes {
worldTimes = new HashMap<>(); worldTimes = new HashMap<>();
currentWorld = startingWorld; currentWorld = startingWorld;
currentGamemode = startingGM; currentGamemode = startingGM;
addWorld(startingWorld, startingGM, MiscUtils.getTime()); addWorld(startingWorld, startingGM, System.currentTimeMillis());
} }
/** /**

View File

@ -4,7 +4,6 @@ import com.djrapitops.plan.api.exceptions.database.DBException;
import com.djrapitops.plan.data.container.Session; import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.system.PlanSystem; import com.djrapitops.plan.system.PlanSystem;
import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
@ -71,7 +70,7 @@ public class SessionCache {
public static void refreshActiveSessionsState() { public static void refreshActiveSessionsState() {
for (Session session : activeSessions.values()) { for (Session session : activeSessions.values()) {
session.getWorldTimes().updateState(MiscUtils.getTime()); session.getWorldTimes().updateState(System.currentTimeMillis());
} }
} }

View File

@ -8,7 +8,6 @@ import com.djrapitops.plan.data.container.*;
import com.djrapitops.plan.system.database.databases.operation.FetchOperations; import com.djrapitops.plan.system.database.databases.operation.FetchOperations;
import com.djrapitops.plan.system.database.databases.sql.SQLDB; import com.djrapitops.plan.system.database.databases.sql.SQLDB;
import com.djrapitops.plan.system.info.server.Server; import com.djrapitops.plan.system.info.server.Server;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import java.sql.SQLException; import java.sql.SQLException;
@ -32,7 +31,7 @@ public class SQLFetchOps extends SQLOps implements FetchOperations {
profile.setAllTimePeak(peak.getDate()); profile.setAllTimePeak(peak.getDate());
profile.setAllTimePeakPlayers(peak.getPlayers()); profile.setAllTimePeakPlayers(peak.getPlayers());
}); });
Optional<TPS> lastPeak = tpsTable.getPeakPlayerCount(serverUUID, MiscUtils.getTime() - (TimeAmount.DAY.ms() * 2L)); Optional<TPS> lastPeak = tpsTable.getPeakPlayerCount(serverUUID, System.currentTimeMillis() - (TimeAmount.DAY.ms() * 2L));
lastPeak.ifPresent(peak -> { lastPeak.ifPresent(peak -> {
profile.setLastPeakDate(peak.getDate()); profile.setLastPeakDate(peak.getDate());
profile.setLastPeakPlayers(peak.getPlayers()); profile.setLastPeakPlayers(peak.getPlayers());

View File

@ -11,7 +11,6 @@ import com.djrapitops.plan.system.database.databases.sql.statements.Select;
import com.djrapitops.plan.system.database.databases.sql.statements.Sql; import com.djrapitops.plan.system.database.databases.sql.statements.Sql;
import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser; import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser;
import com.djrapitops.plan.system.info.server.ServerInfo; import com.djrapitops.plan.system.info.server.ServerInfo;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
@ -619,7 +618,7 @@ public class SessionsTable extends UserIDTable {
return query(new QueryStatement<Map<UUID, Map<UUID, List<Session>>>>(sql, 20000) { return query(new QueryStatement<Map<UUID, Map<UUID, List<Session>>>>(sql, 20000) {
@Override @Override
public void prepare(PreparedStatement statement) throws SQLException { public void prepare(PreparedStatement statement) throws SQLException {
statement.setLong(1, MiscUtils.getTime() - TimeAmount.MONTH.ms()); statement.setLong(1, System.currentTimeMillis() - TimeAmount.MONTH.ms());
} }
@Override @Override

View File

@ -13,7 +13,6 @@ import com.djrapitops.plan.system.database.databases.sql.statements.Sql;
import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser; import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser;
import com.djrapitops.plan.system.info.server.Server; import com.djrapitops.plan.system.info.server.Server;
import com.djrapitops.plan.system.info.server.ServerInfo; import com.djrapitops.plan.system.info.server.ServerInfo;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
@ -133,7 +132,7 @@ public class TPSTable extends Table {
statement.setInt(1, pValue); statement.setInt(1, pValue);
// More than 2 Months ago. // More than 2 Months ago.
long fiveWeeks = TimeAmount.MONTH.ms() * 2L; long fiveWeeks = TimeAmount.MONTH.ms() * 2L;
statement.setLong(2, MiscUtils.getTime() - fiveWeeks); statement.setLong(2, System.currentTimeMillis() - fiveWeeks);
} }
}); });
} }

View File

@ -12,7 +12,6 @@ import com.djrapitops.plan.system.database.databases.sql.statements.Column;
import com.djrapitops.plan.system.database.databases.sql.statements.Sql; import com.djrapitops.plan.system.database.databases.sql.statements.Sql;
import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser; import com.djrapitops.plan.system.database.databases.sql.statements.TableSqlParser;
import com.djrapitops.plan.system.info.server.ServerInfo; import com.djrapitops.plan.system.info.server.ServerInfo;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@ -84,7 +83,7 @@ public class TransferTable extends Table {
execute(new ExecStatement(sql) { execute(new ExecStatement(sql) {
@Override @Override
public void prepare(PreparedStatement statement) throws SQLException { public void prepare(PreparedStatement statement) throws SQLException {
statement.setLong(1, MiscUtils.getTime()); statement.setLong(1, System.currentTimeMillis());
statement.setString(2, "onlineStatus"); statement.setString(2, "onlineStatus");
} }
}); });
@ -133,7 +132,7 @@ public class TransferTable extends Table {
@Override @Override
public void prepare(PreparedStatement statement) throws SQLException { public void prepare(PreparedStatement statement) throws SQLException {
statement.setString(1, ServerInfo.getServerUUID().toString()); statement.setString(1, ServerInfo.getServerUUID().toString());
statement.setLong(2, MiscUtils.getTime() + TimeAmount.HOUR.ms()); statement.setLong(2, System.currentTimeMillis() + TimeAmount.HOUR.ms());
statement.setString(3, "configSettings"); statement.setString(3, "configSettings");
statement.setString(4, null); statement.setString(4, null);
statement.setString(5, encodedSettingString); statement.setString(5, encodedSettingString);
@ -146,7 +145,7 @@ public class TransferTable extends Table {
@Override @Override
public void prepare(PreparedStatement statement) throws SQLException { public void prepare(PreparedStatement statement) throws SQLException {
statement.setString(1, "configSettings"); statement.setString(1, "configSettings");
statement.setLong(2, MiscUtils.getTime()); statement.setLong(2, System.currentTimeMillis());
} }
@Override @Override

View File

@ -10,7 +10,6 @@ import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.info.request.*; import com.djrapitops.plan.system.info.request.*;
import com.djrapitops.plan.system.info.server.Server; import com.djrapitops.plan.system.info.server.Server;
import com.djrapitops.plan.system.webserver.WebServerSystem; import com.djrapitops.plan.system.webserver.WebServerSystem;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
@ -32,10 +31,10 @@ public class BungeeConnectionSystem extends ConnectionSystem {
} }
private void refreshServerMap() { private void refreshServerMap() {
if (latestServerMapRefresh < MiscUtils.getTime() - TimeAmount.SECOND.ms() * 15L) { if (latestServerMapRefresh < System.currentTimeMillis() - TimeAmount.SECOND.ms() * 15L) {
try { try {
bukkitServers = Database.getActive().fetch().getBukkitServers(); bukkitServers = Database.getActive().fetch().getBukkitServers();
latestServerMapRefresh = MiscUtils.getTime(); latestServerMapRefresh = System.currentTimeMillis();
} catch (DBException e) { } catch (DBException e) {
Log.toLog(this.getClass(), e); Log.toLog(this.getClass(), e);
} }

View File

@ -6,7 +6,6 @@ package com.djrapitops.plan.system.info.connection;
import com.djrapitops.plan.system.info.request.InfoRequest; import com.djrapitops.plan.system.info.request.InfoRequest;
import com.djrapitops.plan.system.info.server.Server; import com.djrapitops.plan.system.info.server.Server;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import java.util.HashMap; import java.util.HashMap;
@ -49,7 +48,7 @@ public class ConnectionLog {
private static void logConnection(String address, String infoRequestName, int responseCode) { private static void logConnection(String address, String infoRequestName, int responseCode) {
Map<String, Map<String, Entry>> log = getInstance().log; Map<String, Map<String, Entry>> log = getInstance().log;
Map<String, Entry> requestMap = log.getOrDefault(address, new HashMap<>()); Map<String, Entry> requestMap = log.getOrDefault(address, new HashMap<>());
requestMap.put(infoRequestName, new Entry(responseCode, MiscUtils.getTime())); requestMap.put(infoRequestName, new Entry(responseCode, System.currentTimeMillis()));
log.put(address, requestMap); log.put(address, requestMap);
} }

View File

@ -16,7 +16,6 @@ import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.system.settings.locale.Locale; import com.djrapitops.plan.system.settings.locale.Locale;
import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.system.settings.locale.Msg;
import com.djrapitops.plan.system.webserver.WebServerSystem; import com.djrapitops.plan.system.webserver.WebServerSystem;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
@ -40,13 +39,13 @@ public class ServerConnectionSystem extends ConnectionSystem {
private void refreshServerMap() { private void refreshServerMap() {
Processing.submitNonCritical(() -> { Processing.submitNonCritical(() -> {
if (latestServerMapRefresh < MiscUtils.getTime() - TimeAmount.SECOND.ms() * 15L) { if (latestServerMapRefresh < System.currentTimeMillis() - TimeAmount.SECOND.ms() * 15L) {
try { try {
Database database = Database.getActive(); Database database = Database.getActive();
Optional<Server> bungeeInformation = database.fetch().getBungeeInformation(); Optional<Server> bungeeInformation = database.fetch().getBungeeInformation();
bungeeInformation.ifPresent(server -> mainServer = server); bungeeInformation.ifPresent(server -> mainServer = server);
bukkitServers = database.fetch().getBukkitServers(); bukkitServers = database.fetch().getBukkitServers();
latestServerMapRefresh = MiscUtils.getTime(); latestServerMapRefresh = System.currentTimeMillis();
} catch (DBException e) { } catch (DBException e) {
Log.toLog(this.getClass(), e); Log.toLog(this.getClass(), e);
} }

View File

@ -1,7 +1,6 @@
package com.djrapitops.plan.system.listeners.bukkit; package com.djrapitops.plan.system.listeners.bukkit;
import com.djrapitops.plan.system.afk.AFKTracker; import com.djrapitops.plan.system.afk.AFKTracker;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -29,7 +28,7 @@ public class AFKListener implements Listener {
private void event(PlayerEvent event) { private void event(PlayerEvent event) {
try { try {
UUID uuid = event.getPlayer().getUniqueId(); UUID uuid = event.getPlayer().getUniqueId();
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
AFK_TRACKER.performedAction(uuid, time); AFK_TRACKER.performedAction(uuid, time);
} catch (Exception e) { } catch (Exception e) {

View File

@ -4,7 +4,6 @@ import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.cache.SessionCache;
import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.processing.Processing;
import com.djrapitops.plan.system.processing.processors.player.KillProcessor; import com.djrapitops.plan.system.processing.processors.player.KillProcessor;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.utilities.Format; import com.djrapitops.plugin.utilities.Format;
import org.bukkit.Material; import org.bukkit.Material;
@ -32,7 +31,7 @@ public class DeathEventListener implements Listener {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onDeath(EntityDeathEvent event) { public void onDeath(EntityDeathEvent event) {
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
LivingEntity dead = event.getEntity(); LivingEntity dead = event.getEntity();
if (dead instanceof Player) { if (dead instanceof Player) {

View File

@ -3,7 +3,6 @@ package com.djrapitops.plan.system.listeners.bukkit;
import com.djrapitops.plan.data.container.Session; import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.cache.SessionCache;
import com.djrapitops.plan.system.settings.WorldAliasSettings; import com.djrapitops.plan.system.settings.WorldAliasSettings;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -41,7 +40,7 @@ public class GamemodeChangeListener implements Listener {
private void actOnEvent(PlayerGameModeChangeEvent event) { private void actOnEvent(PlayerGameModeChangeEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
String gameMode = event.getNewGameMode().name(); String gameMode = event.getNewGameMode().name();
String worldName = player.getWorld().getName(); String worldName = player.getWorld().getName();

View File

@ -7,7 +7,6 @@ import com.djrapitops.plan.system.processing.processors.info.NetworkPageUpdatePr
import com.djrapitops.plan.system.processing.processors.info.PlayerPageUpdateProcessor; import com.djrapitops.plan.system.processing.processors.info.PlayerPageUpdateProcessor;
import com.djrapitops.plan.system.processing.processors.player.*; import com.djrapitops.plan.system.processing.processors.player.*;
import com.djrapitops.plan.system.tasks.TaskSystem; import com.djrapitops.plan.system.tasks.TaskSystem;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.systems.NotificationCenter; import com.djrapitops.plugin.api.systems.NotificationCenter;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -119,7 +118,7 @@ public class PlayerOnlineListener implements Listener {
} }
private void actOnQuitEvent(PlayerQuitEvent event) { private void actOnQuitEvent(PlayerQuitEvent event) {
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
Player player = event.getPlayer(); Player player = event.getPlayer();
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();

View File

@ -3,7 +3,6 @@ package com.djrapitops.plan.system.listeners.bukkit;
import com.djrapitops.plan.data.container.Session; import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.cache.SessionCache;
import com.djrapitops.plan.system.settings.WorldAliasSettings; import com.djrapitops.plan.system.settings.WorldAliasSettings;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -26,7 +25,7 @@ public class WorldChangeListener implements Listener {
} }
private void actOnEvent(PlayerChangedWorldEvent event) { private void actOnEvent(PlayerChangedWorldEvent event) {
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
Player player = event.getPlayer(); Player player = event.getPlayer();
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();

View File

@ -1,7 +1,6 @@
package com.djrapitops.plan.system.listeners.sponge; package com.djrapitops.plan.system.listeners.sponge;
import com.djrapitops.plan.system.afk.AFKTracker; import com.djrapitops.plan.system.afk.AFKTracker;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.Listener;
@ -31,7 +30,7 @@ public class SpongeAFKListener {
private void event(TargetPlayerEvent event) { private void event(TargetPlayerEvent event) {
try { try {
UUID uuid = event.getTargetEntity().getUniqueId(); UUID uuid = event.getTargetEntity().getUniqueId();
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
AFK_TRACKER.performedAction(uuid, time); AFK_TRACKER.performedAction(uuid, time);
} catch (Exception e) { } catch (Exception e) {
@ -42,21 +41,21 @@ public class SpongeAFKListener {
@Listener(order = Order.POST) @Listener(order = Order.POST)
public void onMove(MoveEntityEvent event, @First Player player) { public void onMove(MoveEntityEvent event, @First Player player) {
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
AFK_TRACKER.performedAction(uuid, time); AFK_TRACKER.performedAction(uuid, time);
} }
@Listener(order = Order.POST) @Listener(order = Order.POST)
public void onPlayerChat(MessageChannelEvent.Chat event, @First Player player) { public void onPlayerChat(MessageChannelEvent.Chat event, @First Player player) {
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
AFK_TRACKER.performedAction(uuid, time); AFK_TRACKER.performedAction(uuid, time);
} }
@Listener(order = Order.POST) @Listener(order = Order.POST)
public void onPlayerCommand(SendCommandEvent event, @First Player player) { public void onPlayerCommand(SendCommandEvent event, @First Player player) {
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
AFK_TRACKER.performedAction(uuid, time); AFK_TRACKER.performedAction(uuid, time);
} }

View File

@ -4,7 +4,6 @@ import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.cache.SessionCache;
import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.processing.Processing;
import com.djrapitops.plan.system.processing.processors.player.SpongeKillProcessor; import com.djrapitops.plan.system.processing.processors.player.SpongeKillProcessor;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.utilities.Format; import com.djrapitops.plugin.utilities.Format;
import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.data.key.Keys;
@ -34,7 +33,7 @@ public class SpongeDeathListener {
@Listener @Listener
public void onEntityDeath(DestructEntityEvent.Death event) { public void onEntityDeath(DestructEntityEvent.Death event) {
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
Living dead = event.getTargetEntity(); Living dead = event.getTargetEntity();
if (dead instanceof Player) { if (dead instanceof Player) {

View File

@ -3,7 +3,6 @@ package com.djrapitops.plan.system.listeners.sponge;
import com.djrapitops.plan.data.container.Session; import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.cache.SessionCache;
import com.djrapitops.plan.system.settings.WorldAliasSettings; import com.djrapitops.plan.system.settings.WorldAliasSettings;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener; import org.spongepowered.api.event.Listener;
@ -36,7 +35,7 @@ public class SpongeGMChangeListener {
private void actOnGMChangeEvent(ChangeGameModeEvent.TargetPlayer event) { private void actOnGMChangeEvent(ChangeGameModeEvent.TargetPlayer event) {
Player player = event.getTargetEntity(); Player player = event.getTargetEntity();
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
String gameMode = event.getGameMode().getName().toUpperCase(); String gameMode = event.getGameMode().getName().toUpperCase();
String worldName = player.getWorld().getName(); String worldName = player.getWorld().getName();

View File

@ -7,7 +7,6 @@ import com.djrapitops.plan.system.processing.processors.info.NetworkPageUpdatePr
import com.djrapitops.plan.system.processing.processors.info.PlayerPageUpdateProcessor; import com.djrapitops.plan.system.processing.processors.info.PlayerPageUpdateProcessor;
import com.djrapitops.plan.system.processing.processors.player.*; import com.djrapitops.plan.system.processing.processors.player.*;
import com.djrapitops.plan.system.tasks.TaskSystem; import com.djrapitops.plan.system.tasks.TaskSystem;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.systems.NotificationCenter; import com.djrapitops.plugin.api.systems.NotificationCenter;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
@ -82,7 +81,7 @@ public class SpongePlayerListener {
NotificationCenter.checkNotifications(player); NotificationCenter.checkNotifications(player);
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
SpongeAFKListener.AFK_TRACKER.performedAction(uuid, time); SpongeAFKListener.AFK_TRACKER.performedAction(uuid, time);
@ -122,7 +121,7 @@ public class SpongePlayerListener {
} }
private void actOnQuitEvent(ClientConnectionEvent.Disconnect event) { private void actOnQuitEvent(ClientConnectionEvent.Disconnect event) {
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
Player player = event.getTargetEntity(); Player player = event.getTargetEntity();
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();

View File

@ -3,7 +3,6 @@ package com.djrapitops.plan.system.listeners.sponge;
import com.djrapitops.plan.data.container.Session; import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.system.cache.SessionCache; import com.djrapitops.plan.system.cache.SessionCache;
import com.djrapitops.plan.system.settings.WorldAliasSettings; import com.djrapitops.plan.system.settings.WorldAliasSettings;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
@ -37,7 +36,7 @@ public class SpongeWorldChangeListener {
} }
private void actOnEvent(MoveEntityEvent.Teleport event, Player player) { private void actOnEvent(MoveEntityEvent.Teleport event, Player player) {
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();

View File

@ -17,7 +17,6 @@ import com.djrapitops.plan.system.info.server.ServerInfo;
import com.djrapitops.plan.system.processing.importing.ServerImportData; import com.djrapitops.plan.system.processing.importing.ServerImportData;
import com.djrapitops.plan.system.processing.importing.UserImportData; import com.djrapitops.plan.system.processing.importing.UserImportData;
import com.djrapitops.plan.system.processing.importing.UserImportRefiner; import com.djrapitops.plan.system.processing.importing.UserImportRefiner;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.Benchmark; import com.djrapitops.plugin.api.Benchmark;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.utilities.Verify; import com.djrapitops.plugin.utilities.Verify;
@ -225,7 +224,7 @@ public abstract class Importer {
} }
private List<GeoInfo> convertGeoInfo(UserImportData userImportData) { private List<GeoInfo> convertGeoInfo(UserImportData userImportData) {
long date = MiscUtils.getTime(); long date = System.currentTimeMillis();
return userImportData.getIps().parallelStream() return userImportData.getIps().parallelStream()
.map(ip -> { .map(ip -> {

View File

@ -12,7 +12,6 @@ import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.info.server.ServerInfo; import com.djrapitops.plan.system.info.server.ServerInfo;
import com.djrapitops.plan.system.processing.CriticalRunnable; import com.djrapitops.plan.system.processing.CriticalRunnable;
import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.processing.Processing;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.html.HtmlUtils; import com.djrapitops.plan.utilities.html.HtmlUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
@ -67,7 +66,7 @@ public class NameProcessor implements CriticalRunnable {
return; return;
} }
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
Processing.submitCritical(() -> { Processing.submitCritical(() -> {
String info = HtmlUtils.removeXSS(displayName); String info = HtmlUtils.removeXSS(displayName);

View File

@ -4,7 +4,6 @@ import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.data.container.TPS; import com.djrapitops.plan.data.container.TPS;
import com.djrapitops.plan.system.processing.Processing; import com.djrapitops.plan.system.processing.Processing;
import com.djrapitops.plan.system.processing.processors.TPSInsertProcessor; import com.djrapitops.plan.system.processing.processors.TPSInsertProcessor;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.task.AbsRunnable; import com.djrapitops.plugin.task.AbsRunnable;
@ -33,7 +32,7 @@ public abstract class TPSCountTimer<T extends PlanPlugin> extends AbsRunnable {
public void run() { public void run() {
try { try {
long nanoTime = System.nanoTime(); long nanoTime = System.nanoTime();
long now = MiscUtils.getTime(); long now = System.currentTimeMillis();
addNewTPSEntry(nanoTime, now); addNewTPSEntry(nanoTime, now);

View File

@ -77,7 +77,7 @@ public class InspectPage extends Page {
} }
public String parse(PlayerProfile profile, UUID serverUUID, Map<UUID, String> serverNames) throws IOException { public String parse(PlayerProfile profile, UUID serverUUID, Map<UUID, String> serverNames) throws IOException {
long now = MiscUtils.getTime(); long now = System.currentTimeMillis();
addValue("refresh", FormatUtils.formatTimeStampClock(now)); addValue("refresh", FormatUtils.formatTimeStampClock(now));
addValue("version", MiscUtils.getPlanVersion()); addValue("version", MiscUtils.getPlanVersion());

View File

@ -42,7 +42,7 @@ public class NetworkPage extends Page {
public String toHtml() throws ParseException { public String toHtml() throws ParseException {
try { try {
UUID serverUUID = ServerInfo.getServerUUID(); UUID serverUUID = ServerInfo.getServerUUID();
long now = MiscUtils.getTime(); long now = System.currentTimeMillis();
Database database = Database.getActive(); Database database = Database.getActive();
List<TPS> networkOnlineData = database.fetch().getNetworkOnlineData(); List<TPS> networkOnlineData = database.fetch().getNetworkOnlineData();
List<String> geolocations = database.fetch().getNetworkGeolocations(); List<String> geolocations = database.fetch().getNetworkGeolocations();

View File

@ -95,7 +95,7 @@ public class FormatUtils {
} }
private static String replaceRecentDays(long epochMs, String format, String pattern) { private static String replaceRecentDays(long epochMs, String format, String pattern) {
long now = MiscUtils.getTime(); long now = System.currentTimeMillis();
long fromStartOfDay = now % TimeAmount.DAY.ms(); long fromStartOfDay = now % TimeAmount.DAY.ms();
if (epochMs > now - fromStartOfDay) { if (epochMs > now - fromStartOfDay) {

View File

@ -32,19 +32,9 @@ public class MiscUtils {
throw new IllegalStateException("Utility class"); throw new IllegalStateException("Utility class");
} }
/**
* Used to get the current time as milliseconds.
*
* @return Epoch ms.
*/
@Deprecated
public static long getTime() {
return System.currentTimeMillis();
}
public static int getTimeZoneOffsetHours() { public static int getTimeZoneOffsetHours() {
if (Settings.USE_SERVER_TIME.isTrue()) { if (Settings.USE_SERVER_TIME.isTrue()) {
return -TimeZone.getDefault().getOffset(MiscUtils.getTime()) / (int) TimeAmount.HOUR.ms(); return -TimeZone.getDefault().getOffset(System.currentTimeMillis()) / (int) TimeAmount.HOUR.ms();
} }
return 0; return 0;
} }

View File

@ -18,7 +18,6 @@ import com.djrapitops.plan.system.settings.locale.Locale;
import com.djrapitops.plan.system.settings.locale.Msg; import com.djrapitops.plan.system.settings.locale.Msg;
import com.djrapitops.plan.system.tasks.ServerTaskSystem; import com.djrapitops.plan.system.tasks.ServerTaskSystem;
import com.djrapitops.plan.system.tasks.TaskSystem; import com.djrapitops.plan.system.tasks.TaskSystem;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.StaticHolder; import com.djrapitops.plugin.StaticHolder;
import com.djrapitops.plugin.api.Benchmark; import com.djrapitops.plugin.api.Benchmark;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
@ -87,7 +86,7 @@ public class Analysis implements Callable<AnalysisData> {
} }
private static void updateRefreshDate() { private static void updateRefreshDate() {
Analysis.refreshDate = MiscUtils.getTime(); Analysis.refreshDate = System.currentTimeMillis();
} }
private void updatePlayerNameCache(ServerProfile profile) { private void updatePlayerNameCache(ServerProfile profile) {

View File

@ -9,7 +9,6 @@ import com.djrapitops.plan.data.plugin.PluginData;
import com.djrapitops.plan.system.info.server.ServerInfo; import com.djrapitops.plan.system.info.server.ServerInfo;
import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.utilities.FormatUtils; import com.djrapitops.plan.utilities.FormatUtils;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.html.Html; import com.djrapitops.plan.utilities.html.Html;
import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.api.utility.log.Log;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
@ -37,7 +36,7 @@ public class PlayersTableCreator {
StringBuilder html = new StringBuilder(); StringBuilder html = new StringBuilder();
long now = MiscUtils.getTime(); long now = System.currentTimeMillis();
UUID serverUUID = ServerInfo.getServerUUID(); UUID serverUUID = ServerInfo.getServerUUID();
int i = 0; int i = 0;

View File

@ -2,7 +2,6 @@ package com.djrapitops.plan.data;
import com.djrapitops.plan.data.container.Session; import com.djrapitops.plan.data.container.Session;
import com.djrapitops.plan.system.settings.Settings; import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plugin.api.TimeAmount; import com.djrapitops.plugin.api.TimeAmount;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.ClassRule; import org.junit.ClassRule;
@ -34,7 +33,7 @@ public class PlayerProfileTest {
PlayerProfile p = new PlayerProfile(null, null, 0L); PlayerProfile p = new PlayerProfile(null, null, 0L);
List<Session> sessions = new ArrayList<>(); List<Session> sessions = new ArrayList<>();
long date = MiscUtils.getTime(); long date = System.currentTimeMillis();
long week = TimeAmount.WEEK.ms(); long week = TimeAmount.WEEK.ms();
long weekAgo = date - week; long weekAgo = date - week;
long twoWeeksAgo = date - 2L * week; long twoWeeksAgo = date - 2L * week;
@ -58,7 +57,7 @@ public class PlayerProfileTest {
PlayerProfile p = new PlayerProfile(null, null, 0L); PlayerProfile p = new PlayerProfile(null, null, 0L);
List<Session> sessions = new ArrayList<>(); List<Session> sessions = new ArrayList<>();
long date = MiscUtils.getTime(); long date = System.currentTimeMillis();
long week = TimeAmount.WEEK.ms(); long week = TimeAmount.WEEK.ms();
long weekAgo = date - week; long weekAgo = date - week;
long twoWeeksAgo = date - 2L * week; long twoWeeksAgo = date - 2L * week;
@ -82,7 +81,7 @@ public class PlayerProfileTest {
PlayerProfile p = new PlayerProfile(null, null, 0L); PlayerProfile p = new PlayerProfile(null, null, 0L);
List<Session> sessions = new ArrayList<>(); List<Session> sessions = new ArrayList<>();
long date = MiscUtils.getTime(); long date = System.currentTimeMillis();
long week = TimeAmount.WEEK.ms(); long week = TimeAmount.WEEK.ms();
long weekAgo = date - week; long weekAgo = date - week;
long twoWeeksAgo = date - 2L * week; long twoWeeksAgo = date - 2L * week;

View File

@ -21,7 +21,6 @@ import com.djrapitops.plan.system.info.server.ServerInfo;
import com.djrapitops.plan.system.processing.processors.player.RegisterProcessor; import com.djrapitops.plan.system.processing.processors.player.RegisterProcessor;
import com.djrapitops.plan.utilities.Base64Util; import com.djrapitops.plan.utilities.Base64Util;
import com.djrapitops.plan.utilities.ManageUtils; import com.djrapitops.plan.utilities.ManageUtils;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.SHA256Hash; import com.djrapitops.plan.utilities.SHA256Hash;
import com.djrapitops.plan.utilities.analysis.MathUtils; import com.djrapitops.plan.utilities.analysis.MathUtils;
import com.djrapitops.plugin.StaticHolder; import com.djrapitops.plugin.StaticHolder;
@ -259,7 +258,7 @@ public class SQLiteTest {
String expectedIP = "1.2.3.4"; String expectedIP = "1.2.3.4";
String expectedGeoLoc = "TestLocation"; String expectedGeoLoc = "TestLocation";
long time = MiscUtils.getTime(); long time = System.currentTimeMillis();
GeoInfo expected = new GeoInfo(expectedIP, expectedGeoLoc, time, "3"); GeoInfo expected = new GeoInfo(expectedIP, expectedGeoLoc, time, "3");
geoInfoTable.saveGeoInfo(playerUUID, expected); geoInfoTable.saveGeoInfo(playerUUID, expected);
@ -762,7 +761,7 @@ public class SQLiteTest {
@Test @Test
public void testBackupAndRestore() throws SQLException, DBInitException, UnsupportedEncodingException, NoSuchAlgorithmException { public void testBackupAndRestore() throws SQLException, DBInitException, UnsupportedEncodingException, NoSuchAlgorithmException {
System.out.println("- Creating Backup Database -"); System.out.println("- Creating Backup Database -");
SQLiteDB backup = new SQLiteDB("debug-backup" + MiscUtils.getTime()); SQLiteDB backup = new SQLiteDB("debug-backup" + System.currentTimeMillis());
backup.init(); backup.init();
System.out.println("- Backup Database Created -"); System.out.println("- Backup Database Created -");