mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-24 16:14:26 +08:00
Renamed SessionData to Session
Started work on Login Processing Changed some GeolocationCache public access methods to private.
This commit is contained in:
parent
9790b6cb73
commit
997ec683ae
@ -14,10 +14,26 @@
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
<include>*.keystore</include>
|
||||
<include>*.js</include>
|
||||
<include>*.css</include>
|
||||
<include>*.yml</include>
|
||||
<include>*.html</include>
|
||||
<include>*.txt</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>licence.yml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<directory>${basedir}/src/main/resources/html</directory>
|
||||
<includes>
|
||||
<include>*.html</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<targetPath>.</targetPath>
|
||||
<directory>${basedir}/src/main/resources/js</directory>
|
||||
<includes>
|
||||
<include>*.js</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
@ -83,6 +83,7 @@ public class Plan extends BukkitPlugin<Plan> {
|
||||
private ServerInfoManager serverInfoManager;
|
||||
|
||||
private ServerVariableHolder serverVariableHolder;
|
||||
private TPSCountTimer tpsCountTimer;
|
||||
private int bootAnalysisTaskID = -1;
|
||||
|
||||
/**
|
||||
@ -162,7 +163,8 @@ public class Plan extends BukkitPlugin<Plan> {
|
||||
this.analysisCache = new AnalysisCacheHandler(this);
|
||||
Benchmark.stop("Enable", "Init DataCache");
|
||||
|
||||
super.getRunnableFactory().createNew(new TPSCountTimer(this)).runTaskTimer(1000, TimeAmount.SECOND.ticks());
|
||||
tpsCountTimer = new TPSCountTimer(this);
|
||||
super.getRunnableFactory().createNew(tpsCountTimer).runTaskTimer(1000, TimeAmount.SECOND.ticks());
|
||||
registerListeners();
|
||||
|
||||
this.api = new API(this);
|
||||
@ -472,6 +474,10 @@ public class Plan extends BukkitPlugin<Plan> {
|
||||
return processingQueue;
|
||||
}
|
||||
|
||||
public TPSCountTimer getTpsCountTimer() {
|
||||
return tpsCountTimer;
|
||||
}
|
||||
|
||||
public void addToProcessQueue(Processor processor) {
|
||||
processingQueue.addToQueue(processor);
|
||||
}
|
||||
|
@ -6,34 +6,38 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is used for storing start and end of a play session inside UserData
|
||||
* object.
|
||||
* Object for storing various information about a player's play session.
|
||||
* <p>
|
||||
* Includes:
|
||||
* <ul>
|
||||
* <li>World & GameMode playtimes</li>
|
||||
* <li>Player & Mob kills</li>
|
||||
* <li>Deaths</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* Following data can be derived from Sessions in the database (Between any time span):
|
||||
* <ul>
|
||||
* <li>Playtime</li>
|
||||
* <li>LoginTimes</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class SessionData {
|
||||
public class Session {
|
||||
|
||||
private final WorldTimes worldTimes; // TODO add World Times to SessionData
|
||||
private final WorldTimes worldTimes;
|
||||
private final long sessionStart;
|
||||
private long sessionEnd;
|
||||
private final List<KillData> playerKills;
|
||||
private int mobKills;
|
||||
private int deaths;
|
||||
|
||||
|
||||
@Deprecated // TODO Remove
|
||||
public SessionData(long sessionStart) {
|
||||
worldTimes = null;
|
||||
this.sessionStart = 0;
|
||||
playerKills = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new session with given start and end of -1.
|
||||
*
|
||||
* @param sessionStart Epoch millisecond the session was started.
|
||||
*/
|
||||
public SessionData(long sessionStart, String world, String gm) {
|
||||
public Session(long sessionStart, String world, String gm) {
|
||||
this.worldTimes = new WorldTimes(world, gm);
|
||||
this.sessionStart = sessionStart;
|
||||
this.sessionEnd = -1;
|
||||
@ -48,7 +52,7 @@ public class SessionData {
|
||||
* @param sessionStart Epoch millisecond the session was started.
|
||||
* @param sessionEnd Epoch millisecond the session ended.
|
||||
*/
|
||||
public SessionData(long sessionStart, long sessionEnd, WorldTimes worldTimes, List<KillData> playerKills, int mobKills, int deaths) {
|
||||
public Session(long sessionStart, long sessionEnd, WorldTimes worldTimes, List<KillData> playerKills, int mobKills, int deaths) {
|
||||
this.sessionStart = sessionStart;
|
||||
this.sessionEnd = sessionEnd;
|
||||
this.worldTimes = worldTimes;
|
||||
@ -69,6 +73,29 @@ public class SessionData {
|
||||
worldTimes.updateState(endOfSession);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates WorldTimes state.
|
||||
*
|
||||
* @param world World Name the player has moved to
|
||||
* @param gm GameMode the player is in.
|
||||
* @param time Epoch ms of the event.
|
||||
*/
|
||||
public void changeState(String world, String gm, long time) {
|
||||
worldTimes.updateState(world, gm, time);
|
||||
}
|
||||
|
||||
public void playerKilled(KillData kill) {
|
||||
playerKills.add(kill);
|
||||
}
|
||||
|
||||
public void mobKilled() {
|
||||
mobKills++;
|
||||
}
|
||||
|
||||
public void died() {
|
||||
deaths++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length of the session in milliseconds.
|
||||
*
|
||||
@ -96,14 +123,20 @@ public class SessionData {
|
||||
return sessionEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the session start was before the end.
|
||||
*
|
||||
* @return Is the length positive?
|
||||
*/
|
||||
@Deprecated // TODO Remove
|
||||
public boolean isValid() {
|
||||
return sessionStart <= sessionEnd;
|
||||
public WorldTimes getWorldTimes() {
|
||||
return worldTimes;
|
||||
}
|
||||
|
||||
public List<KillData> getPlayerKills() {
|
||||
return playerKills;
|
||||
}
|
||||
|
||||
public int getMobKills() {
|
||||
return mobKills;
|
||||
}
|
||||
|
||||
public int getDeaths() {
|
||||
return deaths;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -117,7 +150,7 @@ public class SessionData {
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final SessionData other = (SessionData) obj;
|
||||
final Session other = (Session) obj;
|
||||
return this.sessionStart == other.sessionStart && this.sessionEnd == other.sessionEnd;
|
||||
}
|
||||
|
||||
@ -128,4 +161,16 @@ public class SessionData {
|
||||
hash = 97 * hash + (int) (this.sessionEnd ^ (this.sessionEnd >>> 32));
|
||||
return hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a new Session.
|
||||
*
|
||||
* @param time Time the session started.
|
||||
* @param world World the session started in.
|
||||
* @param gm GameMode the session started in.
|
||||
* @return a new Session object.
|
||||
*/
|
||||
public static Session start(long time, String world, String gm) {
|
||||
return new Session(time, world, gm);
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ import java.util.*;
|
||||
// TODO Change to be only used for DB User Get Query responses.
|
||||
public class UserData {
|
||||
|
||||
private final List<SessionData> sessions;
|
||||
private final List<Session> sessions;
|
||||
private int accessing;
|
||||
private boolean clearAfterSave;
|
||||
private UUID uuid;
|
||||
@ -31,8 +31,6 @@ public class UserData {
|
||||
@Deprecated
|
||||
private boolean isBanned; //TODO DB Update code to JoinListener
|
||||
@Deprecated
|
||||
private boolean isOnline; //TODO New Class for getting online status of players
|
||||
@Deprecated
|
||||
private long registered; //TODO DB Update code to JoinListener (When registering)
|
||||
@Deprecated
|
||||
private long lastPlayed; //TODO DB Update code to Join, Refresh, QuitListener
|
||||
@ -173,9 +171,9 @@ public class UserData {
|
||||
/**
|
||||
* Get the sessions of a player.
|
||||
*
|
||||
* @return a list of SessionData.
|
||||
* @return a list of Session.
|
||||
*/
|
||||
public List<SessionData> getSessions() {
|
||||
public List<Session> getSessions() {
|
||||
return sessions;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package main.java.com.djrapitops.plan.data.analysis;
|
||||
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.data.TPS;
|
||||
import main.java.com.djrapitops.plan.ui.html.graphs.PlayerActivityGraphCreator;
|
||||
import main.java.com.djrapitops.plan.ui.html.graphs.PunchCardGraphCreator;
|
||||
@ -72,13 +72,13 @@ public class ActivityPart extends RawData {
|
||||
|
||||
playerActivityGraphs();
|
||||
|
||||
final List<SessionData> sessions = joins.getAllSessions();
|
||||
final List<Session> sessions = joins.getAllSessions();
|
||||
|
||||
List<Long> lengths = AnalysisUtils.transformSessionDataToLengths(sessions);
|
||||
long averageLength = MathUtils.averageLong(lengths);
|
||||
addValue("sessionAverage", FormatUtils.formatTimeAmount(averageLength));
|
||||
|
||||
List<SessionData> sessionsMonth = sessions.stream()
|
||||
List<Session> sessionsMonth = sessions.stream()
|
||||
.filter(s -> s.getSessionStart() > MiscUtils.getTime() - TimeAmount.MONTH.ms())
|
||||
.collect(Collectors.toList());
|
||||
addValue("punchCardSeries", PunchCardGraphCreator.createDataSeries(sessionsMonth));
|
||||
|
@ -2,7 +2,7 @@ package main.java.com.djrapitops.plan.data.analysis;
|
||||
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
||||
|
||||
@ -36,7 +36,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public class JoinInfoPart extends RawData {
|
||||
|
||||
private final Map<UUID, List<SessionData>> sessions;
|
||||
private final Map<UUID, List<Session>> sessions;
|
||||
private final List<Long> registered;
|
||||
private long loginTimes;
|
||||
|
||||
@ -108,11 +108,11 @@ public class JoinInfoPart extends RawData {
|
||||
return loginTimes;
|
||||
}
|
||||
|
||||
public Map<UUID, List<SessionData>> getSessions() {
|
||||
public Map<UUID, List<Session>> getSessions() {
|
||||
return sessions;
|
||||
}
|
||||
|
||||
public List<SessionData> getAllSessions() {
|
||||
public List<Session> getAllSessions() {
|
||||
return MiscUtils.flatMap(sessions.values());
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ public class JoinInfoPart extends RawData {
|
||||
return registered;
|
||||
}
|
||||
|
||||
public void addSessions(UUID uuid, List<SessionData> sessions) {
|
||||
public void addSessions(UUID uuid, List<Session> sessions) {
|
||||
Verify.nullCheck(uuid);
|
||||
Verify.nullCheck(sessions);
|
||||
this.sessions.put(uuid, sessions.stream().distinct().collect(Collectors.toList()));
|
||||
|
@ -69,7 +69,7 @@ public class GeolocationCacheHandler {
|
||||
* @see <a href="http://freegeoip.net">http://freegeoip.net</a>
|
||||
* @see #getCountry(String)
|
||||
*/
|
||||
public static String getUncachedCountry(String ipAddress) {
|
||||
private static String getUncachedCountry(String ipAddress) {
|
||||
URL url;
|
||||
|
||||
String urlString = "http://freegeoip.net/csv/" + ipAddress;
|
||||
@ -101,7 +101,7 @@ public class GeolocationCacheHandler {
|
||||
* @param ipAddress The IP Address which is retrieved out of the cache
|
||||
* @return The cached country, {@code null} if the country is not cached
|
||||
*/
|
||||
public static String getCachedCountry(String ipAddress) {
|
||||
private static String getCachedCountry(String ipAddress) {
|
||||
return geolocationCache.getIfPresent(ipAddress);
|
||||
}
|
||||
|
||||
@ -114,4 +114,8 @@ public class GeolocationCacheHandler {
|
||||
public static boolean isCached(String ipAddress) {
|
||||
return geolocationCache.asMap().containsKey(ipAddress);
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
geolocationCache.invalidateAll();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package main.java.com.djrapitops.plan.data.cache;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -14,7 +14,7 @@ import java.util.UUID;
|
||||
*/
|
||||
public class SessionCache {
|
||||
|
||||
private static final Map<UUID, SessionData> activeSessions = new HashMap<>();
|
||||
private static final Map<UUID, Session> activeSessions = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Class Constructor.
|
||||
@ -22,17 +22,17 @@ public class SessionCache {
|
||||
public SessionCache() {
|
||||
}
|
||||
|
||||
public void cacheSession(UUID uuid, SessionData session) {
|
||||
public void cacheSession(UUID uuid, Session session) {
|
||||
activeSessions.put(uuid, session);
|
||||
}
|
||||
|
||||
public void endSession(UUID uuid, long time) {
|
||||
SessionData session = activeSessions.get(uuid);
|
||||
Session session = activeSessions.get(uuid);
|
||||
if (session == null) {
|
||||
return;
|
||||
}
|
||||
session.endSession(time);
|
||||
|
||||
// TODO DB Save the session.
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,13 +54,13 @@ public class SessionCache {
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get the SessionData of the player in the sessionCache.
|
||||
* Used to get the Session of the player in the sessionCache.
|
||||
*
|
||||
* @param uuid UUID of the player.
|
||||
* @return SessionData or null if not cached.
|
||||
* @return Session or null if not cached.
|
||||
*/
|
||||
@Deprecated
|
||||
public SessionData getSession(UUID uuid) {
|
||||
public Session getSession(UUID uuid) {
|
||||
return activeSessions.get(uuid);
|
||||
}
|
||||
|
||||
@ -69,10 +69,10 @@ public class SessionCache {
|
||||
* <p>
|
||||
* Used for testing.
|
||||
*
|
||||
* @return key:value UUID:SessionData
|
||||
* @return key:value UUID:Session
|
||||
*/
|
||||
@Deprecated
|
||||
public Map<UUID, SessionData> getActiveSessions() {
|
||||
public Map<UUID, Session> getActiveSessions() {
|
||||
return activeSessions;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Licence is provided in the jar as license.yml also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.data.handling;
|
||||
|
||||
import main.java.com.djrapitops.plan.queue.processing.Processor;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Abstract Processor that takes UUID as a parameter.
|
||||
* <p>
|
||||
* Created to allow extending processors to use Generics.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public abstract class PlayerProcessor extends Processor<UUID> {
|
||||
|
||||
public PlayerProcessor(UUID uuid) {
|
||||
super(uuid);
|
||||
}
|
||||
|
||||
protected UUID getUUID() {
|
||||
return object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract void process();
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Licence is provided in the jar as license.yml also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.data.handling.login;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.cache.GeolocationCacheHandler;
|
||||
import main.java.com.djrapitops.plan.data.handling.PlayerProcessor;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class IPUpdateProcessor extends PlayerProcessor {
|
||||
|
||||
private final String ip;
|
||||
|
||||
public IPUpdateProcessor(UUID uuid, String ip) {
|
||||
super(uuid);
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
UUID uuid = getUUID();
|
||||
GeolocationCacheHandler.getCountry(ip);
|
||||
// TODO DB Update IP & Geolocation
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Licence is provided in the jar as license.yml also here:
|
||||
* https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.data.handling.login;
|
||||
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.handling.PlayerProcessor;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* //TODO Class Javadoc Comment
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class RegisterProcessor extends PlayerProcessor {
|
||||
|
||||
private final long time;
|
||||
private final int playersOnline;
|
||||
|
||||
public RegisterProcessor(UUID uuid, long time, int playersOnline) {
|
||||
super(uuid);
|
||||
this.time = time;
|
||||
this.playersOnline = playersOnline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
UUID uuid = getUUID();
|
||||
if (Plan.getInstance().getDB().wasSeenBefore(uuid)) {
|
||||
return;
|
||||
}
|
||||
// TODO DB Register
|
||||
}
|
||||
}
|
@ -5,11 +5,13 @@ import com.djrapitops.plugin.utilities.player.Fetch;
|
||||
import com.djrapitops.plugin.utilities.player.Gamemode;
|
||||
import com.djrapitops.plugin.utilities.player.IPlayer;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.cache.DataCache;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.KickInfo;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.LoginInfo;
|
||||
import main.java.com.djrapitops.plan.data.handling.info.LogoutInfo;
|
||||
import main.java.com.djrapitops.plan.data.handling.login.RegisterProcessor;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.NewPlayerCreator;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -32,18 +34,18 @@ import java.util.UUID;
|
||||
public class PlanPlayerListener implements Listener {
|
||||
|
||||
private final Plan plugin;
|
||||
private final DataCache handler;
|
||||
private final DataCache cache;
|
||||
|
||||
/**
|
||||
* Class Constructor.
|
||||
* <p>
|
||||
* Copies the references to multiple handlers from Current instance of handler.
|
||||
* Copies the references to multiple handlers from Current instance of cache.
|
||||
*
|
||||
* @param plugin Current instance of Plan
|
||||
*/
|
||||
public PlanPlayerListener(Plan plugin) {
|
||||
this.plugin = plugin;
|
||||
handler = plugin.getHandler();
|
||||
cache = plugin.getHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -63,7 +65,16 @@ public class PlanPlayerListener implements Listener {
|
||||
plugin.getNotificationCenter().checkNotifications(iPlayer);
|
||||
|
||||
UUID uuid = player.getUniqueId();
|
||||
handler.startSession(uuid);
|
||||
String world = player.getWorld().getName();
|
||||
String gm = player.getGameMode().name();
|
||||
long time = MiscUtils.getTime();
|
||||
|
||||
int playersOnline = plugin.getTpsCountTimer().getLatestPlayersOnline();
|
||||
|
||||
cache.cacheSession(uuid, Session.start(time, world, gm));
|
||||
|
||||
plugin.addToProcessQueue(new RegisterProcessor(uuid, time, playersOnline));
|
||||
|
||||
plugin.getRunnableFactory().createNew(new AbsRunnable("NewPlayerCheckTask") {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -80,9 +91,9 @@ public class PlanPlayerListener implements Listener {
|
||||
if (isNewPlayer) {
|
||||
UserData newUserData = NewPlayerCreator.createNewPlayer(iPlayer);
|
||||
loginInfo.process(newUserData);
|
||||
// TODO Rewrite Register & Login system handler.newPlayer(newUserData);
|
||||
// TODO Rewrite Register & Login system cache.newPlayer(newUserData);
|
||||
} else {
|
||||
// handler.addToPool(loginInfo);
|
||||
// cache.addToPool(loginInfo);
|
||||
}
|
||||
this.cancel();
|
||||
}
|
||||
@ -101,7 +112,7 @@ public class PlanPlayerListener implements Listener {
|
||||
// TODO Rewrite Logout system
|
||||
Player player = event.getPlayer();
|
||||
UUID uuid = player.getUniqueId();
|
||||
handler.endSession(uuid);
|
||||
cache.endSession(uuid);
|
||||
|
||||
long time = MiscUtils.getTime();
|
||||
boolean banned = player.isBanned();
|
||||
@ -127,7 +138,7 @@ public class PlanPlayerListener implements Listener {
|
||||
Player player = event.getPlayer();
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
handler.endSession(uuid);
|
||||
cache.endSession(uuid);
|
||||
|
||||
long time = MiscUtils.getTime();
|
||||
boolean banned = player.isBanned();
|
||||
|
@ -27,6 +27,8 @@ public class TPSCountTimer extends AbsRunnable {
|
||||
private final List<TPS> history;
|
||||
private long lastCheckNano;
|
||||
|
||||
private int latestPlayersOnline = 0;
|
||||
|
||||
public TPSCountTimer(Plan plugin) {
|
||||
super("TPSCountTimer");
|
||||
lastCheckNano = -1;
|
||||
@ -79,6 +81,7 @@ public class TPSCountTimer extends AbsRunnable {
|
||||
long usedMemory = (totalMemory - runtime.freeMemory()) / 1000000;
|
||||
|
||||
int playersOnline = plugin.getServer().getOnlinePlayers().size();
|
||||
latestPlayersOnline = playersOnline;
|
||||
int loadedChunks = getLoadedChunks();
|
||||
int entityCount;
|
||||
|
||||
@ -167,4 +170,8 @@ public class TPSCountTimer extends AbsRunnable {
|
||||
private int getEntityCountPaper() {
|
||||
return plugin.getServer().getWorlds().stream().mapToInt(World::getEntityCount).sum();
|
||||
}
|
||||
|
||||
public int getLatestPlayersOnline() {
|
||||
return latestPlayersOnline;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.KillData;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.database.Database;
|
||||
import main.java.com.djrapitops.plan.database.tables.*;
|
||||
@ -363,7 +363,7 @@ public abstract class SQLDB extends Database {
|
||||
Map<Integer, List<String>> nicknames = nicknamesTable.getNicknames(ids);
|
||||
Map<Integer, Set<InetAddress>> ipList = ipsTable.getIPList(ids);
|
||||
Map<Integer, List<KillData>> playerKills = killsTable.getPlayerKills(ids, idUuidRel);
|
||||
Map<Integer, List<SessionData>> sessionData = sessionsTable.getSessionData(ids);
|
||||
Map<Integer, List<Session>> sessionData = sessionsTable.getSessionData(ids);
|
||||
Map<Integer, Map<String, Long>> worldTimes = worldTimesTable.getWorldTimes(ids);
|
||||
|
||||
Log.debug("Database",
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main.java.com.djrapitops.plan.database.tables;
|
||||
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.database.Container;
|
||||
import main.java.com.djrapitops.plan.database.databases.SQLDB;
|
||||
import main.java.com.djrapitops.plan.database.sql.Sql;
|
||||
@ -66,16 +66,16 @@ public class SessionsTable extends UserIDTable {
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
public List<SessionData> getSessionData(int userId) throws SQLException {
|
||||
public List<Session> getSessionData(int userId) throws SQLException {
|
||||
PreparedStatement statement = null;
|
||||
ResultSet set = null;
|
||||
try {
|
||||
statement = prepareStatement("SELECT * FROM " + tableName + " WHERE (" + columnUserID + "=?)");
|
||||
statement.setInt(1, userId);
|
||||
set = statement.executeQuery();
|
||||
List<SessionData> sessions = new ArrayList<>();
|
||||
List<Session> sessions = new ArrayList<>();
|
||||
while (set.next()) {
|
||||
// sessions.add(new SessionData(set.getLong(columnSessionStart), set.getLong(columnSessionEnd)));
|
||||
// sessions.add(new Session(set.getLong(columnSessionStart), set.getLong(columnSessionEnd)));
|
||||
}
|
||||
set.close();
|
||||
statement.close();
|
||||
@ -99,7 +99,7 @@ public class SessionsTable extends UserIDTable {
|
||||
* @param sessions
|
||||
* @throws SQLException
|
||||
*/
|
||||
public void saveSessionData(int userId, List<SessionData> sessions) throws SQLException {
|
||||
public void saveSessionData(int userId, List<Session> sessions) throws SQLException {
|
||||
if (sessions == null) {
|
||||
return;
|
||||
}
|
||||
@ -118,7 +118,7 @@ public class SessionsTable extends UserIDTable {
|
||||
+ columnSessionStart + ", "
|
||||
+ columnSessionEnd
|
||||
+ ") VALUES (?, ?, ?)");
|
||||
for (SessionData session : sessions) {
|
||||
for (Session session : sessions) {
|
||||
long end = session.getSessionEnd();
|
||||
long start = session.getSessionStart();
|
||||
if (end < start) {
|
||||
@ -142,7 +142,7 @@ public class SessionsTable extends UserIDTable {
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Map<Integer, List<SessionData>> getSessionData(Collection<Integer> ids) throws SQLException {
|
||||
public Map<Integer, List<Session>> getSessionData(Collection<Integer> ids) throws SQLException {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
@ -152,7 +152,7 @@ public class SessionsTable extends UserIDTable {
|
||||
ResultSet set = null;
|
||||
|
||||
try {
|
||||
Map<Integer, List<SessionData>> sessions = new HashMap<>();
|
||||
Map<Integer, List<Session>> sessions = new HashMap<>();
|
||||
statement = prepareStatement("SELECT * FROM " + tableName);
|
||||
set = statement.executeQuery();
|
||||
|
||||
@ -169,7 +169,7 @@ public class SessionsTable extends UserIDTable {
|
||||
long sessionStart = set.getLong(columnSessionStart);
|
||||
long sessionEnd = set.getLong(columnSessionEnd);
|
||||
|
||||
// sessions.get(id).add(new SessionData(sessionStart, sessionEnd));
|
||||
// sessions.get(id).add(new Session(sessionStart, sessionEnd));
|
||||
}
|
||||
|
||||
return sessions;
|
||||
@ -184,18 +184,18 @@ public class SessionsTable extends UserIDTable {
|
||||
* @param sessions
|
||||
* @throws SQLException
|
||||
*/
|
||||
public void saveSessionData(Map<Integer, List<SessionData>> sessions) throws SQLException {
|
||||
public void saveSessionData(Map<Integer, List<Session>> sessions) throws SQLException {
|
||||
if (sessions == null || sessions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Benchmark.start("Save Sessions multiple");
|
||||
|
||||
Map<Integer, List<SessionData>> saved = getSessionData(sessions.keySet());
|
||||
for (Map.Entry<Integer, List<SessionData>> entrySet : sessions.entrySet()) {
|
||||
Map<Integer, List<Session>> saved = getSessionData(sessions.keySet());
|
||||
for (Map.Entry<Integer, List<Session>> entrySet : sessions.entrySet()) {
|
||||
Integer id = entrySet.getKey();
|
||||
List<SessionData> sessionList = entrySet.getValue();
|
||||
List<SessionData> s = saved.get(id);
|
||||
List<Session> sessionList = entrySet.getValue();
|
||||
List<Session> s = saved.get(id);
|
||||
|
||||
if (s != null) {
|
||||
sessionList.removeAll(s);
|
||||
@ -208,7 +208,7 @@ public class SessionsTable extends UserIDTable {
|
||||
saved.put(id, sessionList);
|
||||
}
|
||||
|
||||
List<List<Container<SessionData>>> batches = splitIntoBatches(sessions);
|
||||
List<List<Container<Session>>> batches = splitIntoBatches(sessions);
|
||||
|
||||
batches.forEach(batch -> {
|
||||
try {
|
||||
@ -221,7 +221,7 @@ public class SessionsTable extends UserIDTable {
|
||||
Benchmark.stop("Database", "Save Sessions multiple");
|
||||
}
|
||||
|
||||
private void saveSessionBatch(List<Container<SessionData>> batch) throws SQLException {
|
||||
private void saveSessionBatch(List<Container<Session>> batch) throws SQLException {
|
||||
if (batch.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@ -234,13 +234,9 @@ public class SessionsTable extends UserIDTable {
|
||||
+ columnSessionEnd
|
||||
+ ") VALUES (?, ?, ?)");
|
||||
|
||||
for (Container<SessionData> data : batch) {
|
||||
SessionData session = data.getObject();
|
||||
for (Container<Session> data : batch) {
|
||||
Session session = data.getObject();
|
||||
int id = data.getId();
|
||||
if (!session.isValid()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
statement.setInt(1, id);
|
||||
statement.setLong(2, session.getSessionStart());
|
||||
statement.setLong(3, session.getSessionEnd());
|
||||
|
@ -1,6 +1,6 @@
|
||||
package main.java.com.djrapitops.plan.ui.html.graphs;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.data.TPS;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.Point;
|
||||
|
||||
@ -28,7 +28,7 @@ public class PlayerActivityGraphCreator {
|
||||
return SeriesCreator.seriesGraph(points, true);
|
||||
}
|
||||
|
||||
public static String buildSeriesDataStringSessions(Collection<SessionData> sessions) {
|
||||
public static String buildSeriesDataStringSessions(Collection<Session> sessions) {
|
||||
List<Point> points = sessions.stream()
|
||||
.map(session -> new Point[]{new Point(session.getSessionStart(), 1), new Point(session.getSessionEnd(), 0)})
|
||||
.flatMap(Arrays::stream)
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package main.java.com.djrapitops.plan.ui.html.graphs;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -34,7 +34,7 @@ public class PunchCardGraphCreator {
|
||||
* @param sessions Sessions (Unique/Player) to be placed into the PunchCard.
|
||||
* @return Data array as a string.
|
||||
*/
|
||||
public static String createDataSeries(Collection<SessionData> sessions) {
|
||||
public static String createDataSeries(Collection<Session> sessions) {
|
||||
List<Long> sessionStarts = getSessionStarts(sessions);
|
||||
List<int[]> daysAndHours = AnalysisUtils.getDaysAndHours(sessionStarts);
|
||||
int[][] dataArray = createDataArray(daysAndHours);
|
||||
@ -75,11 +75,10 @@ public class PunchCardGraphCreator {
|
||||
return dataArray;
|
||||
}
|
||||
|
||||
private static List<Long> getSessionStarts(Collection<SessionData> data) {
|
||||
private static List<Long> getSessionStarts(Collection<Session> data) {
|
||||
return data.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(SessionData::isValid)
|
||||
.map(SessionData::getSessionStart)
|
||||
.map(Session::getSessionStart)
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package main.java.com.djrapitops.plan.utilities;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import main.java.com.djrapitops.plan.data.AnalysisData;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.ui.html.graphs.PunchCardGraphCreator;
|
||||
|
||||
@ -74,7 +74,7 @@ public class PlaceholderUtils {
|
||||
// replaceMap.put("mobKillCount", data.getMobKills());
|
||||
// replaceMap.put("deathCount", data.getDeaths());
|
||||
|
||||
Set<SessionData> sessions = new HashSet<>(data.getSessions());
|
||||
Set<Session> sessions = new HashSet<>(data.getSessions());
|
||||
replaceMap.put("punchCardSeries", PunchCardGraphCreator.createDataSeries(sessions));
|
||||
//TODO WorldTimes worldTimes = data.getWorldTimes();
|
||||
// TODO replaceMap.put("worldSeries", WorldPieCreator.createSeriesData(worldTimes.getTimes()));
|
||||
|
@ -5,7 +5,7 @@ import com.djrapitops.plugin.utilities.Verify;
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.AnalysisData;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.data.TPS;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.additional.AnalysisType;
|
||||
@ -305,7 +305,7 @@ public class Analysis {
|
||||
}
|
||||
//TODO List<KillData> playerKills = uData.getPlayerKills();
|
||||
|
||||
List<SessionData> sessions = uData.getSessions();
|
||||
List<Session> sessions = uData.getSessions();
|
||||
joinInfo.addSessions(uuid, sessions);
|
||||
});
|
||||
Benchmark.stop("Analysis", "Fill Dataset");
|
||||
|
@ -1,7 +1,7 @@
|
||||
package main.java.com.djrapitops.plan.utilities.analysis;
|
||||
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.data.additional.AnalysisType;
|
||||
import main.java.com.djrapitops.plan.data.additional.PluginData;
|
||||
import main.java.com.djrapitops.plan.utilities.FormatUtils;
|
||||
@ -62,11 +62,11 @@ public class AnalysisUtils {
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static List<Long> transformSessionDataToLengths(Collection<SessionData> data) {
|
||||
public static List<Long> transformSessionDataToLengths(Collection<Session> data) {
|
||||
return data.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(session -> session.getLength() > 0)
|
||||
.map(SessionData::getLength)
|
||||
.map(Session::getLength)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ public class AnalysisUtils {
|
||||
* @param scale Scale (milliseconds), time before (Current epoch - scale) will be ignored.
|
||||
* @return Amount of Unique joins within the time span.
|
||||
*/
|
||||
public static int getUniqueJoins(Map<UUID, List<SessionData>> sessions, long scale) {
|
||||
public static int getUniqueJoins(Map<UUID, List<Session>> sessions, long scale) {
|
||||
long now = MiscUtils.getTime();
|
||||
long nowMinusScale = now - scale;
|
||||
|
||||
@ -226,13 +226,13 @@ public class AnalysisUtils {
|
||||
* @param scale
|
||||
* @return
|
||||
*/
|
||||
public static int getUniqueJoinsPerDay(Map<UUID, List<SessionData>> sessions, long scale) {
|
||||
public static int getUniqueJoinsPerDay(Map<UUID, List<Session>> sessions, long scale) {
|
||||
Map<Integer, Set<UUID>> uniqueJoins = new HashMap<>();
|
||||
long now = MiscUtils.getTime();
|
||||
long nowMinusScale = now - scale;
|
||||
|
||||
sessions.forEach((uuid, s) -> {
|
||||
for (SessionData session : s) {
|
||||
for (Session session : s) {
|
||||
if (scale != -1
|
||||
&& session.getSessionStart() < nowMinusScale) {
|
||||
continue;
|
||||
@ -308,7 +308,7 @@ public class AnalysisUtils {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static int getDayOfYear(SessionData session) {
|
||||
private static int getDayOfYear(Session session) {
|
||||
return getDayOfYear(session.getSessionStart());
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
package main.java.com.djrapitops.plan.utilities.comparators;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class SessionDataComparator implements Comparator<SessionData> {
|
||||
public class SessionDataComparator implements Comparator<Session> {
|
||||
|
||||
@Override
|
||||
public int compare(SessionData s1, SessionData s2) {
|
||||
public int compare(Session s1, Session s2) {
|
||||
return Long.compare(s1.getSessionStart(), s2.getSessionStart());
|
||||
}
|
||||
}
|
||||
|
@ -5,20 +5,20 @@
|
||||
*/
|
||||
package test.java.main.java.com.djrapitops.plan.data;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import org.junit.Before;
|
||||
|
||||
/**
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class SessionDataTest {
|
||||
public class SessionTest {
|
||||
|
||||
private SessionData test;
|
||||
private Session test;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public SessionDataTest() {
|
||||
public SessionTest() {
|
||||
}
|
||||
|
||||
/**
|
||||
@ -26,7 +26,6 @@ public class SessionDataTest {
|
||||
*/
|
||||
@Before
|
||||
public void setUp() {
|
||||
test = new SessionData(0);
|
||||
}
|
||||
|
||||
/**
|
@ -12,9 +12,7 @@ import test.java.utils.TestInit;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static junit.framework.TestCase.assertFalse;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
import static junit.framework.TestCase.*;
|
||||
|
||||
/**
|
||||
* @author Fuzzlemann
|
||||
@ -27,6 +25,7 @@ public class GeolocationCacheTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
GeolocationCacheHandler.clearCache();
|
||||
ipsToCountries.put("8.8.8.8", "United States");
|
||||
ipsToCountries.put("8.8.4.4", "United States");
|
||||
ipsToCountries.put("4.4.2.2", "United States");
|
||||
@ -46,7 +45,7 @@ public class GeolocationCacheTest {
|
||||
String ip = entry.getKey();
|
||||
String expCountry = entry.getValue();
|
||||
|
||||
String country = GeolocationCacheHandler.getUncachedCountry(ip);
|
||||
String country = GeolocationCacheHandler.getCountry(ip);
|
||||
|
||||
assertEquals(country, expCountry);
|
||||
}
|
||||
@ -60,15 +59,12 @@ public class GeolocationCacheTest {
|
||||
String ip = entry.getKey();
|
||||
String expIp = entry.getValue();
|
||||
|
||||
String countryFirstCall = GeolocationCacheHandler.getUncachedCountry(ip);
|
||||
assertFalse(GeolocationCacheHandler.isCached(ip));
|
||||
|
||||
String countrySecondCall = GeolocationCacheHandler.getCountry(ip);
|
||||
assertTrue(GeolocationCacheHandler.isCached(ip));
|
||||
|
||||
String countryThirdCall = GeolocationCacheHandler.getCachedCountry(ip);
|
||||
String countryThirdCall = GeolocationCacheHandler.getCountry(ip);
|
||||
|
||||
assertEquals(countryFirstCall, countrySecondCall);
|
||||
assertEquals(countrySecondCall, countryThirdCall);
|
||||
assertEquals(countryThirdCall, expIp);
|
||||
}
|
||||
|
@ -171,5 +171,5 @@ public class WorldTimesTest {
|
||||
assertEquals(2000L, worldOneGMTimes.getTime("ADVENTURE"));
|
||||
}
|
||||
|
||||
// TODO Test where SessionData is ended, check if worldTimes & session length add up.
|
||||
// TODO Test where Session is ended, check if worldTimes & session length add up.
|
||||
}
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
package test.java.main.java.com.djrapitops.plan.utilities.analysis;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
import main.java.com.djrapitops.plan.utilities.analysis.AnalysisUtils;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -122,10 +122,9 @@ public class AnalysisUtilsTest {
|
||||
*/
|
||||
@Test
|
||||
public void testTransformSessionDataToLengths() {
|
||||
Collection<SessionData> data = new ArrayList<>();
|
||||
data.add(new SessionData(0L, 5L, null, null, 0, 0));
|
||||
data.add(new SessionData(0, 20L, null, null, 0, 0));
|
||||
data.add(new SessionData(0));
|
||||
Collection<Session> data = new ArrayList<>();
|
||||
data.add(new Session(0L, 5L, null, null, 0, 0));
|
||||
data.add(new Session(0, 20L, null, null, 0, 0));
|
||||
List<Long> expResult = new ArrayList<>();
|
||||
expResult.add(5L);
|
||||
expResult.add(20L);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package test.java.main.java.com.djrapitops.plan.utilities.comparators;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.data.TPS;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.WebUser;
|
||||
@ -43,11 +43,11 @@ public class ComparatorTest {
|
||||
|
||||
@Test
|
||||
public void testSessionDataComparator() {
|
||||
List<SessionData> test = RandomData.randomSessions();
|
||||
List<Long> longValues = test.stream().map(SessionData::getSessionStart).collect(Collectors.toList());
|
||||
List<Session> test = RandomData.randomSessions();
|
||||
List<Long> longValues = test.stream().map(Session::getSessionStart).collect(Collectors.toList());
|
||||
longValues.sort(Long::compare);
|
||||
test.sort(new SessionDataComparator());
|
||||
List<Long> afterSort = test.stream().map(SessionData::getSessionStart).collect(Collectors.toList());
|
||||
List<Long> afterSort = test.stream().map(Session::getSessionStart).collect(Collectors.toList());
|
||||
assertEquals(longValues, afterSort);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package test.java.utils;
|
||||
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.Session;
|
||||
import main.java.com.djrapitops.plan.data.TPS;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.WebUser;
|
||||
@ -46,10 +46,10 @@ public class RandomData {
|
||||
return test;
|
||||
}
|
||||
|
||||
public static List<SessionData> randomSessions() {
|
||||
List<SessionData> test = new ArrayList<>();
|
||||
public static List<Session> randomSessions() {
|
||||
List<Session> test = new ArrayList<>();
|
||||
for (int i = 0; i < 20; i++) {
|
||||
test.add(new SessionData(r.nextLong(), r.nextLong(), null, null, 0, 0));
|
||||
test.add(new Session(r.nextLong(), r.nextLong(), null, null, 0, 0));
|
||||
}
|
||||
return test;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user