mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-09-03 18:30:36 +02:00
parent
c95260bd1f
commit
12f3d31525
|
@ -104,8 +104,8 @@ public class Plan extends JavaPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.handler = new DataCacheHandler(this);
|
this.handler = new DataCacheHandler(this);
|
||||||
this.infoPoolProcessor = new InfoPoolProcessor(this);
|
// this.infoPoolProcessor = new InfoPoolProcessor(this);
|
||||||
infoPoolProcessor.startPoolTask();
|
// infoPoolProcessor.startPoolTask();
|
||||||
this.inspectCache = new InspectCacheHandler(this);
|
this.inspectCache = new InspectCacheHandler(this);
|
||||||
this.analysisCache = new AnalysisCacheHandler(this);
|
this.analysisCache = new AnalysisCacheHandler(this);
|
||||||
registerListeners();
|
registerListeners();
|
||||||
|
@ -152,10 +152,10 @@ public class Plan extends JavaPlugin {
|
||||||
}
|
}
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
Bukkit.getScheduler().cancelTasks(this);
|
||||||
if (handler != null) {
|
if (handler != null) {
|
||||||
infoPoolProcessor.processPool();
|
|
||||||
log(Phrase.CACHE_SAVE + "");
|
log(Phrase.CACHE_SAVE + "");
|
||||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||||
scheduler.execute(() -> {
|
scheduler.execute(() -> {
|
||||||
|
// infoPoolProcessor.processPool();
|
||||||
handler.saveCacheOnDisable();
|
handler.saveCacheOnDisable();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,16 @@ public class SearchCommand extends SubCommand {
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(message);
|
sender.sendMessage(message);
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
Bukkit.getServer().dispatchCommand(
|
BukkitTask link = new BukkitRunnable() {
|
||||||
Bukkit.getConsoleSender(),
|
@Override
|
||||||
"tellraw " + player.getName() + " [\"\",{\"text\":\"Click Me\",\"underlined\":true,"
|
public void run() {
|
||||||
+ "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + url + "\"}}]");
|
Bukkit.getServer().dispatchCommand(
|
||||||
|
Bukkit.getConsoleSender(),
|
||||||
|
"tellraw " + player.getName() + " [\"\",{\"text\":\"Click Me\",\"underlined\":true,"
|
||||||
|
+ "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + url + "\"}}]");
|
||||||
|
}
|
||||||
|
}.runTask(plugin);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,23 @@ import main.java.com.djrapitops.plan.data.cache.queue.DataCacheClearQueue;
|
||||||
import main.java.com.djrapitops.plan.utilities.NewPlayerCreator;
|
import main.java.com.djrapitops.plan.utilities.NewPlayerCreator;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import main.java.com.djrapitops.plan.Phrase;
|
import main.java.com.djrapitops.plan.Phrase;
|
||||||
import main.java.com.djrapitops.plan.Plan;
|
import main.java.com.djrapitops.plan.Plan;
|
||||||
import main.java.com.djrapitops.plan.Settings;
|
import main.java.com.djrapitops.plan.Settings;
|
||||||
import main.java.com.djrapitops.plan.data.*;
|
import main.java.com.djrapitops.plan.data.*;
|
||||||
|
import main.java.com.djrapitops.plan.data.cache.queue.DataCacheProcessQueue;
|
||||||
|
import main.java.com.djrapitops.plan.data.handling.info.HandlingInfo;
|
||||||
import main.java.com.djrapitops.plan.data.handling.info.ReloadInfo;
|
import main.java.com.djrapitops.plan.data.handling.info.ReloadInfo;
|
||||||
import main.java.com.djrapitops.plan.database.Database;
|
import main.java.com.djrapitops.plan.database.Database;
|
||||||
|
import main.java.com.djrapitops.plan.utilities.comparators.HandlingInfoTimeComparator;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -40,6 +47,7 @@ public class DataCacheHandler extends LocationCache {
|
||||||
// Queues
|
// Queues
|
||||||
private DataCacheSaveQueue saveTask;
|
private DataCacheSaveQueue saveTask;
|
||||||
private DataCacheClearQueue clearTask;
|
private DataCacheClearQueue clearTask;
|
||||||
|
private DataCacheProcessQueue processTask;
|
||||||
private DataCacheGetQueue getTask;
|
private DataCacheGetQueue getTask;
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
|
@ -62,6 +70,7 @@ public class DataCacheHandler extends LocationCache {
|
||||||
|
|
||||||
getTask = new DataCacheGetQueue(plugin);
|
getTask = new DataCacheGetQueue(plugin);
|
||||||
clearTask = new DataCacheClearQueue(plugin, this);
|
clearTask = new DataCacheClearQueue(plugin, this);
|
||||||
|
processTask = new DataCacheProcessQueue(plugin, this);
|
||||||
saveTask = new DataCacheSaveQueue(plugin);
|
saveTask = new DataCacheSaveQueue(plugin);
|
||||||
|
|
||||||
timesSaved = 0;
|
timesSaved = 0;
|
||||||
|
@ -164,6 +173,10 @@ public class DataCacheHandler extends LocationCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addToPool(HandlingInfo i) {
|
||||||
|
processTask.addToPool(i);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves all data in the cache to Database and closes the database down.
|
* Saves all data in the cache to Database and closes the database down.
|
||||||
* Closes save clear and get tasks.
|
* Closes save clear and get tasks.
|
||||||
|
@ -172,11 +185,33 @@ public class DataCacheHandler extends LocationCache {
|
||||||
saveTask.stop();
|
saveTask.stop();
|
||||||
getTask.stop();
|
getTask.stop();
|
||||||
clearTask.stop();
|
clearTask.stop();
|
||||||
|
List<HandlingInfo> toProcess = processTask.stop();
|
||||||
|
Collections.sort(toProcess, new HandlingInfoTimeComparator());
|
||||||
|
for (HandlingInfo i : toProcess) {
|
||||||
|
UserData uData = dataCache.get(i.getUuid());
|
||||||
|
if (uData == null) {
|
||||||
|
DBCallableProcessor p = new DBCallableProcessor() {
|
||||||
|
@Override
|
||||||
|
public void process(UserData data) {
|
||||||
|
i.process(data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
db.giveUserDataToProcessors(i.getUuid(), p);
|
||||||
|
} catch (SQLException ex) {
|
||||||
|
plugin.toLog(this.getClass().getName(), ex);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
i.process(uData);
|
||||||
|
}
|
||||||
|
}
|
||||||
List<UserData> data = new ArrayList<>();
|
List<UserData> data = new ArrayList<>();
|
||||||
|
|
||||||
data.addAll(dataCache.values());
|
data.addAll(dataCache.values());
|
||||||
data.parallelStream().forEach((userData) -> {
|
data.parallelStream()
|
||||||
endSession(userData);
|
.forEach((userData) -> {
|
||||||
});
|
addSession(userData);
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
db.saveMultipleUserData(data);
|
db.saveMultipleUserData(data);
|
||||||
db.saveCommandUse(commandUse);
|
db.saveCommandUse(commandUse);
|
||||||
|
@ -197,6 +232,7 @@ public class DataCacheHandler extends LocationCache {
|
||||||
public void process(UserData data) {
|
public void process(UserData data) {
|
||||||
data.addLocations(getLocationsForSaving(uuid));
|
data.addLocations(getLocationsForSaving(uuid));
|
||||||
clearLocations(uuid);
|
clearLocations(uuid);
|
||||||
|
addSession(data);
|
||||||
saveTask.scheduleForSave(data);
|
saveTask.scheduleForSave(data);
|
||||||
scheludeForClear(uuid);
|
scheludeForClear(uuid);
|
||||||
}
|
}
|
||||||
|
@ -225,7 +261,8 @@ public class DataCacheHandler extends LocationCache {
|
||||||
private void saveHandlerDataToCache(Player player) {
|
private void saveHandlerDataToCache(Player player) {
|
||||||
long time = new Date().getTime();
|
long time = new Date().getTime();
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
plugin.getInfoPoolProcessor().addToPool(new ReloadInfo(uuid, time, player.getAddress().getAddress(), player.isBanned(), player.getDisplayName(), player.getGameMode()));
|
// plugin.getInfoPoolProcessor().
|
||||||
|
addToPool(new ReloadInfo(uuid, time, player.getAddress().getAddress(), player.isBanned(), player.getDisplayName(), player.getGameMode()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +315,7 @@ public class DataCacheHandler extends LocationCache {
|
||||||
* @param player Player the new UserData is created for
|
* @param player Player the new UserData is created for
|
||||||
*/
|
*/
|
||||||
public void newPlayer(Player player) {
|
public void newPlayer(Player player) {
|
||||||
saveTask.scheduleNewPlayer(NewPlayerCreator.createNewPlayer(player));
|
newPlayer(NewPlayerCreator.createNewPlayer(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,7 +323,11 @@ public class DataCacheHandler extends LocationCache {
|
||||||
* @param player
|
* @param player
|
||||||
*/
|
*/
|
||||||
public void newPlayer(OfflinePlayer player) {
|
public void newPlayer(OfflinePlayer player) {
|
||||||
saveTask.scheduleNewPlayer(NewPlayerCreator.createNewPlayer(player));
|
newPlayer(NewPlayerCreator.createNewPlayer(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void newPlayer(UserData data) {
|
||||||
|
saveTask.scheduleNewPlayer(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,7 +18,6 @@ public class InspectCacheHandler {
|
||||||
private DataCacheHandler handler;
|
private DataCacheHandler handler;
|
||||||
private Plan plugin;
|
private Plan plugin;
|
||||||
private HashMap<UUID, UserData> cache;
|
private HashMap<UUID, UserData> cache;
|
||||||
private HashMap<UUID, Long> clearTimes;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Class constructor
|
||||||
|
@ -29,29 +28,14 @@ public class InspectCacheHandler {
|
||||||
this.handler = plugin.getHandler();
|
this.handler = plugin.getHandler();
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.cache = new HashMap<>();
|
this.cache = new HashMap<>();
|
||||||
this.clearTimes = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Caches the UserData of user to the HashMap for X minutes. Data is removed
|
|
||||||
* from the cache automatically after 5 minutes with a BukkitRunnable
|
|
||||||
*
|
|
||||||
* @param uuid UUID of the player
|
|
||||||
*/
|
|
||||||
public void cache(UUID uuid) {
|
|
||||||
int minutes = Settings.CLEAR_INSPECT_CACHE.getNumber();
|
|
||||||
if (minutes <= 0) {
|
|
||||||
minutes = 3;
|
|
||||||
}
|
|
||||||
cache(uuid, minutes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param uuid
|
* @param uuid
|
||||||
* @param minutes
|
|
||||||
*/
|
*/
|
||||||
public void cache(UUID uuid, int minutes) {
|
public void cache(UUID uuid) {
|
||||||
|
// plugin.getInfoPoolProcessor().process(uuid);
|
||||||
DBCallableProcessor cacher = new DBCallableProcessor() {
|
DBCallableProcessor cacher = new DBCallableProcessor() {
|
||||||
@Override
|
@Override
|
||||||
public void process(UserData data) {
|
public void process(UserData data) {
|
||||||
|
@ -59,33 +43,6 @@ public class InspectCacheHandler {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
handler.getUserDataForProcessing(cacher, uuid, false);
|
handler.getUserDataForProcessing(cacher, uuid, false);
|
||||||
long clearTime = new Date().toInstant().getEpochSecond() + (long) 60 * (long) minutes;
|
|
||||||
if (clearTimes.get(uuid) == null) {
|
|
||||||
clearTimes.put(uuid, (long) 0);
|
|
||||||
}
|
|
||||||
if (clearTimes.get(uuid) < clearTime) {
|
|
||||||
clearTimes.put(uuid, clearTime);
|
|
||||||
BukkitTask timedInspectCacheClearTask = (new BukkitRunnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (new Date().toInstant().getEpochSecond() - clearTimes.get(uuid) < 30) {
|
|
||||||
UserData uData = cache.get(uuid);
|
|
||||||
if (uData == null) {
|
|
||||||
this.cancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!uData.isAccessed()) {
|
|
||||||
clearFomCache(uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.cancel();
|
|
||||||
}
|
|
||||||
}).runTaskLater(plugin, 60 * 20 * minutes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearFomCache(UUID uuid) {
|
|
||||||
cache.remove(uuid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,16 +33,22 @@ public class SessionCache {
|
||||||
activeSessions.put(uuid, session);
|
activeSessions.put(uuid, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void endSession(UUID uuid) {
|
||||||
*
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
public void endSession (UserData data) {
|
|
||||||
UUID uuid = data.getUuid();
|
|
||||||
SessionData currentSession = activeSessions.get(uuid);
|
SessionData currentSession = activeSessions.get(uuid);
|
||||||
if (currentSession != null) {
|
if (currentSession != null) {
|
||||||
long now = new Date().toInstant().getEpochSecond() * (long) 1000;
|
long now = new Date().toInstant().getEpochSecond() * (long) 1000;
|
||||||
currentSession.endSession(now);
|
currentSession.endSession(now);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
public void addSession(UserData data) {
|
||||||
|
UUID uuid = data.getUuid();
|
||||||
|
SessionData currentSession = activeSessions.get(uuid);
|
||||||
|
if (currentSession != null && currentSession.isValid()) {
|
||||||
data.addSession(currentSession);
|
data.addSession(currentSession);
|
||||||
activeSessions.remove(uuid);
|
activeSessions.remove(uuid);
|
||||||
}
|
}
|
||||||
|
|
133
Plan/src/main/java/com/djrapitops/plan/data/cache/queue/DataCacheProcessQueue.java
vendored
Normal file
133
Plan/src/main/java/com/djrapitops/plan/data/cache/queue/DataCacheProcessQueue.java
vendored
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
package main.java.com.djrapitops.plan.data.cache.queue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
|
import java.util.concurrent.BlockingQueue;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import main.java.com.djrapitops.plan.Plan;
|
||||||
|
import main.java.com.djrapitops.plan.data.UserData;
|
||||||
|
import main.java.com.djrapitops.plan.data.cache.DBCallableProcessor;
|
||||||
|
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
|
||||||
|
import main.java.com.djrapitops.plan.data.handling.info.HandlingInfo;
|
||||||
|
import main.java.com.djrapitops.plan.database.Database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Rsl1122
|
||||||
|
*/
|
||||||
|
public class DataCacheProcessQueue {
|
||||||
|
|
||||||
|
private BlockingQueue<HandlingInfo> q;
|
||||||
|
private DataCacheHandler h;
|
||||||
|
private ProcessSetup s;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param plugin
|
||||||
|
* @param handler
|
||||||
|
*/
|
||||||
|
public DataCacheProcessQueue(Plan plugin, DataCacheHandler handler) {
|
||||||
|
h = handler;
|
||||||
|
q = new ArrayBlockingQueue(20000);
|
||||||
|
s = new ProcessSetup();
|
||||||
|
s.go(q, plugin.getDB(), h);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param info
|
||||||
|
*/
|
||||||
|
public void addToPool(HandlingInfo info) {
|
||||||
|
try {
|
||||||
|
q.add(info);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
// getPlugin(Plan.class).logError(Phrase.ERROR_TOO_SMALL_QUEUE.parse("Save Queue", Settings.PROCESS_SAVE_LIMIT.getNumber() + ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param info
|
||||||
|
*/
|
||||||
|
public void addToPool(Collection<HandlingInfo> info) {
|
||||||
|
try {
|
||||||
|
q.addAll(info);
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
// getPlugin(Plan.class).logError(Phrase.ERROR_TOO_SMALL_QUEUE.parse("Save Queue", Settings.PROCESS_SAVE_LIMIT.getNumber() + ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean containsUUID(UUID uuid) {
|
||||||
|
return new ArrayList<>(q).stream().map(d -> d.getUuid()).collect(Collectors.toList()).contains(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<HandlingInfo> stop() {
|
||||||
|
return s.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ProcessConsumer implements Runnable {
|
||||||
|
|
||||||
|
private final BlockingQueue<HandlingInfo> queue;
|
||||||
|
private final DataCacheHandler handler;
|
||||||
|
private final Database db;
|
||||||
|
private boolean run;
|
||||||
|
|
||||||
|
ProcessConsumer(BlockingQueue q, Database db, DataCacheHandler h) {
|
||||||
|
handler = h;
|
||||||
|
queue = q;
|
||||||
|
this.db = db;
|
||||||
|
run = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
while (run) {
|
||||||
|
consume(queue.take());
|
||||||
|
}
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void consume(HandlingInfo info) {
|
||||||
|
DBCallableProcessor p = new DBCallableProcessor() {
|
||||||
|
@Override
|
||||||
|
public void process(UserData data) {
|
||||||
|
info.process(data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
handler.getUserDataForProcessing(p, info.getUuid());
|
||||||
|
}
|
||||||
|
|
||||||
|
Collection<HandlingInfo> stop() {
|
||||||
|
run = false;
|
||||||
|
return queue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ProcessSetup {
|
||||||
|
|
||||||
|
private ProcessConsumer one;
|
||||||
|
private ProcessConsumer two;
|
||||||
|
|
||||||
|
void go(BlockingQueue<HandlingInfo> q, Database db, DataCacheHandler h) {
|
||||||
|
one = new ProcessConsumer(q, db, h);
|
||||||
|
two = new ProcessConsumer(q, db, h);
|
||||||
|
new Thread(one).start();
|
||||||
|
new Thread(two).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<HandlingInfo> stop() {
|
||||||
|
List<HandlingInfo> i = new ArrayList<>(one.stop());
|
||||||
|
i.addAll(two.stop());
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
package main.java.com.djrapitops.plan.data.handling;
|
package main.java.com.djrapitops.plan.data.handling;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -47,6 +48,9 @@ public class InfoPoolProcessor {
|
||||||
|
|
||||||
public void processPool() {
|
public void processPool() {
|
||||||
List<HandlingInfo> toProcess = new ArrayList<>(pool);
|
List<HandlingInfo> toProcess = new ArrayList<>(pool);
|
||||||
|
if (toProcess.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
pool.removeAll(toProcess);
|
pool.removeAll(toProcess);
|
||||||
List<UUID> uuids = toProcess.parallelStream().map(i -> i.getUuid()).distinct().collect(Collectors.toList());
|
List<UUID> uuids = toProcess.parallelStream().map(i -> i.getUuid()).distinct().collect(Collectors.toList());
|
||||||
|
@ -67,6 +71,32 @@ public class InfoPoolProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void process(UUID uuid) {
|
||||||
|
List<HandlingInfo> toProcess = new ArrayList<>();
|
||||||
|
toProcess.addAll(pool.stream().filter(i -> i.getUuid().equals(uuid)).collect(Collectors.toList()));
|
||||||
|
if (toProcess.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
pool.removeAll(toProcess);
|
||||||
|
List<UUID> uuids = Arrays.asList(new UUID[]{uuid});
|
||||||
|
Map<UUID, UserData> userData = getAffectedUserData(uuids);
|
||||||
|
|
||||||
|
Collections.sort(toProcess, new HandlingInfoTimeComparator());
|
||||||
|
for (HandlingInfo r : toProcess) {
|
||||||
|
UserData data = userData.get(r.getUuid());
|
||||||
|
if (data == null) {
|
||||||
|
pool.add(r);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
r.process(data);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
plugin.toLog(this.getClass().getName(), e);
|
||||||
|
pool.addAll(toProcess);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Map<UUID, UserData> getAffectedUserData(List<UUID> uuids) {
|
public Map<UUID, UserData> getAffectedUserData(List<UUID> uuids) {
|
||||||
Map<UUID, UserData> userData = new HashMap<>();
|
Map<UUID, UserData> userData = new HashMap<>();
|
||||||
for (UUID uuid : uuids) {
|
for (UUID uuid : uuids) {
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package main.java.com.djrapitops.plan.data.handling;
|
package main.java.com.djrapitops.plan.data.handling;
|
||||||
|
|
||||||
import main.java.com.djrapitops.plan.Plan;
|
|
||||||
import main.java.com.djrapitops.plan.data.UserData;
|
import main.java.com.djrapitops.plan.data.UserData;
|
||||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -18,6 +16,5 @@ public class LogoutHandling {
|
||||||
data.setPlayTime(data.getPlayTime() + (time - data.getLastPlayed()));
|
data.setPlayTime(data.getPlayTime() + (time - data.getLastPlayed()));
|
||||||
data.setLastPlayed(time);
|
data.setLastPlayed(time);
|
||||||
data.updateBanned(banned);
|
data.updateBanned(banned);
|
||||||
getPlugin(Plan.class).getHandler().getSessionCache().endSession(data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,8 @@ import org.bukkit.GameMode;
|
||||||
*
|
*
|
||||||
* @author Risto
|
* @author Risto
|
||||||
*/
|
*/
|
||||||
public class LogoutInfo extends HandlingInfo{
|
public class LogoutInfo extends HandlingInfo {
|
||||||
|
|
||||||
private boolean banned;
|
private boolean banned;
|
||||||
private GamemodeInfo gmInfo;
|
private GamemodeInfo gmInfo;
|
||||||
|
|
||||||
|
@ -29,8 +30,8 @@ public class LogoutInfo extends HandlingInfo{
|
||||||
if (uData.getUuid() != uuid) {
|
if (uData.getUuid() != uuid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
gmInfo.process(uData);
|
|
||||||
LogoutHandling.processLogoutInfo(uData, time, banned);
|
LogoutHandling.processLogoutInfo(uData, time, banned);
|
||||||
|
gmInfo.process(uData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package main.java.com.djrapitops.plan.data.listeners;
|
package main.java.com.djrapitops.plan.data.listeners;
|
||||||
|
|
||||||
import main.java.com.djrapitops.plan.Plan;
|
import main.java.com.djrapitops.plan.Plan;
|
||||||
import main.java.com.djrapitops.plan.data.handling.InfoPoolProcessor;
|
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
|
||||||
import main.java.com.djrapitops.plan.data.handling.info.ChatInfo;
|
import main.java.com.djrapitops.plan.data.handling.info.ChatInfo;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -16,7 +16,8 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
public class PlanChatListener implements Listener {
|
public class PlanChatListener implements Listener {
|
||||||
|
|
||||||
private final Plan plugin;
|
private final Plan plugin;
|
||||||
private final InfoPoolProcessor processor;
|
// private final InfoPoolProcessor processor;
|
||||||
|
private final DataCacheHandler handler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Constructor.
|
* Class Constructor.
|
||||||
|
@ -25,7 +26,8 @@ public class PlanChatListener implements Listener {
|
||||||
*/
|
*/
|
||||||
public PlanChatListener(Plan plugin) {
|
public PlanChatListener(Plan plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
processor = plugin.getInfoPoolProcessor();
|
// processor = plugin.getInfoPoolProcessor();
|
||||||
|
handler = plugin.getHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,6 +41,6 @@ public class PlanChatListener implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
processor.addToPool(new ChatInfo(p.getUniqueId(), p.getDisplayName(), event.getMessage()));
|
handler.addToPool(new ChatInfo(p.getUniqueId(), p.getDisplayName(), event.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package main.java.com.djrapitops.plan.data.listeners;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import main.java.com.djrapitops.plan.Plan;
|
import main.java.com.djrapitops.plan.Plan;
|
||||||
import main.java.com.djrapitops.plan.data.handling.InfoPoolProcessor;
|
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
|
||||||
import main.java.com.djrapitops.plan.data.handling.info.DeathInfo;
|
import main.java.com.djrapitops.plan.data.handling.info.DeathInfo;
|
||||||
import main.java.com.djrapitops.plan.data.handling.info.KillInfo;
|
import main.java.com.djrapitops.plan.data.handling.info.KillInfo;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
@ -19,7 +19,8 @@ import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
public class PlanDeathEventListener implements Listener {
|
public class PlanDeathEventListener implements Listener {
|
||||||
|
|
||||||
private final Plan plugin;
|
private final Plan plugin;
|
||||||
private final InfoPoolProcessor processor;
|
// private final InfoPoolProcessor processor;
|
||||||
|
private final DataCacheHandler handler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -27,7 +28,8 @@ public class PlanDeathEventListener implements Listener {
|
||||||
*/
|
*/
|
||||||
public PlanDeathEventListener(Plan plugin) {
|
public PlanDeathEventListener(Plan plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.processor = plugin.getInfoPoolProcessor();
|
// this.processor = plugin.getInfoPoolProcessor();
|
||||||
|
this.handler = plugin.getHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,10 +44,10 @@ public class PlanDeathEventListener implements Listener {
|
||||||
Player killer = dead.getKiller();
|
Player killer = dead.getKiller();
|
||||||
boolean killerIsPlayer = killer != null;
|
boolean killerIsPlayer = killer != null;
|
||||||
if (killerIsPlayer) {
|
if (killerIsPlayer) {
|
||||||
processor.addToPool(new KillInfo(killer.getUniqueId(), time, dead, killer.getInventory().getItemInMainHand().getType().name()));
|
handler.addToPool(new KillInfo(killer.getUniqueId(), time, dead, killer.getInventory().getItemInMainHand().getType().name()));
|
||||||
}
|
}
|
||||||
if (dead instanceof Player) {
|
if (dead instanceof Player) {
|
||||||
processor.addToPool(new DeathInfo(((Player) dead).getUniqueId()));
|
handler.addToPool(new DeathInfo(((Player) dead).getUniqueId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package main.java.com.djrapitops.plan.data.listeners;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import main.java.com.djrapitops.plan.Plan;
|
import main.java.com.djrapitops.plan.Plan;
|
||||||
import main.java.com.djrapitops.plan.data.handling.InfoPoolProcessor;
|
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
|
||||||
import main.java.com.djrapitops.plan.data.handling.info.GamemodeInfo;
|
import main.java.com.djrapitops.plan.data.handling.info.GamemodeInfo;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
@ -17,7 +17,8 @@ import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||||
public class PlanGamemodeChangeListener implements Listener {
|
public class PlanGamemodeChangeListener implements Listener {
|
||||||
|
|
||||||
private final Plan plugin;
|
private final Plan plugin;
|
||||||
private final InfoPoolProcessor processor;
|
// private final InfoPoolProcessor processor;
|
||||||
|
private final DataCacheHandler handler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Constructor.
|
* Class Constructor.
|
||||||
|
@ -26,7 +27,8 @@ public class PlanGamemodeChangeListener implements Listener {
|
||||||
*/
|
*/
|
||||||
public PlanGamemodeChangeListener(Plan plugin) {
|
public PlanGamemodeChangeListener(Plan plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
processor = plugin.getInfoPoolProcessor();
|
// processor = plugin.getInfoPoolProcessor();
|
||||||
|
handler = plugin.getHandler();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +43,6 @@ public class PlanGamemodeChangeListener implements Listener {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
processor.addToPool(new GamemodeInfo(p.getUniqueId(), new Date().getTime(), event.getNewGameMode()));
|
handler.addToPool(new GamemodeInfo(p.getUniqueId(), new Date().getTime(), event.getNewGameMode()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package main.java.com.djrapitops.plan.data.listeners;
|
package main.java.com.djrapitops.plan.data.listeners;
|
||||||
|
|
||||||
import main.java.com.djrapitops.plan.data.cache.LocationCache;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import main.java.com.djrapitops.plan.Plan;
|
import main.java.com.djrapitops.plan.Plan;
|
||||||
|
import main.java.com.djrapitops.plan.data.UserData;
|
||||||
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
|
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
|
||||||
import main.java.com.djrapitops.plan.data.handling.InfoPoolProcessor;
|
|
||||||
import main.java.com.djrapitops.plan.data.handling.info.KickInfo;
|
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.LoginInfo;
|
||||||
import main.java.com.djrapitops.plan.data.handling.info.LogoutInfo;
|
import main.java.com.djrapitops.plan.data.handling.info.LogoutInfo;
|
||||||
|
import main.java.com.djrapitops.plan.utilities.NewPlayerCreator;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
@ -27,8 +27,7 @@ public class PlanPlayerListener implements Listener {
|
||||||
|
|
||||||
private final Plan plugin;
|
private final Plan plugin;
|
||||||
private final DataCacheHandler handler;
|
private final DataCacheHandler handler;
|
||||||
private final InfoPoolProcessor processor;
|
// private final InfoPoolProcessor processor;
|
||||||
private final LocationCache locationH;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Constructor.
|
* Class Constructor.
|
||||||
|
@ -41,8 +40,7 @@ public class PlanPlayerListener implements Listener {
|
||||||
public PlanPlayerListener(Plan plugin) {
|
public PlanPlayerListener(Plan plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
handler = plugin.getHandler();
|
handler = plugin.getHandler();
|
||||||
processor = plugin.getInfoPoolProcessor();
|
// handler = plugin.getInfoPoolProcessor();
|
||||||
locationH = handler.getLocationHandler();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,14 +55,18 @@ public class PlanPlayerListener implements Listener {
|
||||||
public void onPlayerLogin(PlayerJoinEvent event) {
|
public void onPlayerLogin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
processor.addToPool(new LoginInfo(uuid, new Date().getTime(), player.getAddress().getAddress(), player.isBanned(), player.getDisplayName(), player.getGameMode(), 1));
|
handler.startSession(uuid);
|
||||||
handler.getSessionCache().startSession(uuid);
|
|
||||||
BukkitTask asyncNewPlayerCheckTask = (new BukkitRunnable() {
|
BukkitTask asyncNewPlayerCheckTask = (new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
LoginInfo loginInfo = new LoginInfo(uuid, new Date().getTime(), player.getAddress().getAddress(), player.isBanned(), player.getDisplayName(), player.getGameMode(), 1);
|
||||||
boolean isNewPlayer = !plugin.getDB().wasSeenBefore(uuid);
|
boolean isNewPlayer = !plugin.getDB().wasSeenBefore(uuid);
|
||||||
if (isNewPlayer) {
|
if (isNewPlayer) {
|
||||||
handler.newPlayer(player);
|
UserData newUserData = NewPlayerCreator.createNewPlayer(player);
|
||||||
|
loginInfo.process(newUserData);
|
||||||
|
handler.newPlayer(newUserData);
|
||||||
|
} else {
|
||||||
|
handler.addToPool(loginInfo);
|
||||||
}
|
}
|
||||||
this.cancel();
|
this.cancel();
|
||||||
}
|
}
|
||||||
|
@ -83,7 +85,8 @@ public class PlanPlayerListener implements Listener {
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
processor.addToPool(new LogoutInfo(uuid, new Date().getTime(), player.isBanned(), player.getGameMode()));
|
handler.endSession(uuid);
|
||||||
|
handler.addToPool(new LogoutInfo(uuid, new Date().getTime(), player.isBanned(), player.getGameMode()));
|
||||||
handler.saveCachedData(uuid);
|
handler.saveCachedData(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,8 +104,8 @@ public class PlanPlayerListener implements Listener {
|
||||||
}
|
}
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
processor.addToPool(new LogoutInfo(uuid, new Date().getTime(), player.isBanned(), player.getGameMode()));
|
handler.addToPool(new LogoutInfo(uuid, new Date().getTime(), player.isBanned(), player.getGameMode()));
|
||||||
processor.addToPool(new KickInfo(uuid));
|
handler.addToPool(new KickInfo(uuid));
|
||||||
handler.saveCachedData(uuid);
|
handler.saveCachedData(uuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,6 @@ public class PlanPlayerMoveListener implements Listener {
|
||||||
|
|
||||||
private final Plan plugin;
|
private final Plan plugin;
|
||||||
private final DataCacheHandler handler;
|
private final DataCacheHandler handler;
|
||||||
private final LocationCache locationH;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Consturctor.
|
* Class Consturctor.
|
||||||
|
@ -28,7 +27,6 @@ public class PlanPlayerMoveListener implements Listener {
|
||||||
public PlanPlayerMoveListener(Plan plugin) {
|
public PlanPlayerMoveListener(Plan plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
handler = plugin.getHandler();
|
handler = plugin.getHandler();
|
||||||
locationH = handler.getLocationHandler();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,6 +48,6 @@ public class PlanPlayerMoveListener implements Listener {
|
||||||
}
|
}
|
||||||
UUID uuid = event.getPlayer().getUniqueId();
|
UUID uuid = event.getPlayer().getUniqueId();
|
||||||
Location savedLocation = to.getBlock().getLocation();
|
Location savedLocation = to.getBlock().getLocation();
|
||||||
locationH.addLocation(uuid, savedLocation);
|
handler.addLocation(uuid, savedLocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class Analysis {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
uuids.stream().forEach((uuid) -> {
|
uuids.stream().forEach((uuid) -> {
|
||||||
inspectCache.cache(uuid, 15);
|
inspectCache.cache(uuid);
|
||||||
});
|
});
|
||||||
log(Phrase.ANALYSIS_FETCH_DATA + "");
|
log(Phrase.ANALYSIS_FETCH_DATA + "");
|
||||||
while (rawData.size() != uuids.size()) {
|
while (rawData.size() != uuids.size()) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: Plan
|
name: Plan
|
||||||
author: Rsl1122
|
author: Rsl1122
|
||||||
main: main.java.com.djrapitops.plan.Plan
|
main: main.java.com.djrapitops.plan.Plan
|
||||||
version: 2.9.3
|
version: 3.0.0
|
||||||
|
|
||||||
softdepend:
|
softdepend:
|
||||||
- OnTime
|
- OnTime
|
||||||
|
|
|
@ -52,15 +52,9 @@ public class LogoutHandlingTest {
|
||||||
data.setLastPlayed(10L);
|
data.setLastPlayed(10L);
|
||||||
data.updateBanned(false);
|
data.updateBanned(false);
|
||||||
long time = 20L;
|
long time = 20L;
|
||||||
Exception ex = null;
|
LogoutHandling.processLogoutInfo(data, time, true);
|
||||||
try {
|
|
||||||
LogoutHandling.processLogoutInfo(data, time, true);
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
ex = e;
|
|
||||||
}
|
|
||||||
assertTrue("Didn't catch endSessionException", ex != null);
|
|
||||||
assertTrue("Last Played wrong", data.getLastPlayed() == 20L);
|
assertTrue("Last Played wrong", data.getLastPlayed() == 20L);
|
||||||
assertTrue("Playtime wrong", data.getPlayTime()== 10L);
|
assertTrue("Playtime wrong", data.getPlayTime() == 10L);
|
||||||
assertTrue("Banned wrong", data.isBanned());
|
assertTrue("Banned wrong", data.isBanned());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,14 +57,9 @@ public class LogoutInfoTest {
|
||||||
Exception ex = null;
|
Exception ex = null;
|
||||||
data.setLastGamemode(GameMode.SURVIVAL);
|
data.setLastGamemode(GameMode.SURVIVAL);
|
||||||
LogoutInfo i = new LogoutInfo(data.getUuid(), time, true, GameMode.CREATIVE);
|
LogoutInfo i = new LogoutInfo(data.getUuid(), time, true, GameMode.CREATIVE);
|
||||||
try {
|
assertTrue(i.process(data));
|
||||||
assertTrue(i.process(data));
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
ex = e;
|
|
||||||
}
|
|
||||||
assertTrue("Caught endSessionException", ex != null);
|
|
||||||
assertTrue("Last Played wrong", data.getLastPlayed() == 20L);
|
assertTrue("Last Played wrong", data.getLastPlayed() == 20L);
|
||||||
assertTrue("Playtime wrong", data.getPlayTime()== 10L);
|
assertTrue("Playtime wrong", data.getPlayTime() == 10L);
|
||||||
assertTrue("Banned wrong", data.isBanned());
|
assertTrue("Banned wrong", data.isBanned());
|
||||||
assertTrue("Didn't process gamemode", data.getLastGamemode() == GameMode.CREATIVE);
|
assertTrue("Didn't process gamemode", data.getLastGamemode() == GameMode.CREATIVE);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +79,7 @@ public class LogoutInfoTest {
|
||||||
}
|
}
|
||||||
assertTrue("Caught endSessionException", ex == null);
|
assertTrue("Caught endSessionException", ex == null);
|
||||||
assertTrue("Last Played wrong", data.getLastPlayed() == 10L);
|
assertTrue("Last Played wrong", data.getLastPlayed() == 10L);
|
||||||
assertTrue("Playtime wrong", data.getPlayTime()== 0L);
|
assertTrue("Playtime wrong", data.getPlayTime() == 0L);
|
||||||
assertTrue("Banned wrong", !data.isBanned());
|
assertTrue("Banned wrong", !data.isBanned());
|
||||||
assertTrue("Didn't process gamemode", data.getLastGamemode() == GameMode.SURVIVAL);
|
assertTrue("Didn't process gamemode", data.getLastGamemode() == GameMode.SURVIVAL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user