mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +08:00
Merge branch '3.7.0' of https://github.com/Rsl1122/Plan-PlayerAnalytics
This commit is contained in:
commit
deae15faa3
@ -175,7 +175,6 @@ public class DataCacheHandler extends SessionCache {
|
||||
* of DataCacheHandler after it has been fetched (if not already fetched)
|
||||
*/
|
||||
public void getUserDataForProcessing(DBCallableProcessor processor, UUID uuid, boolean cache) {
|
||||
Log.debug(uuid + ": HANDLER getForProcess," + " Cache:" + cache);
|
||||
UserData uData = dataCache.get(uuid);
|
||||
if (uData == null) {
|
||||
if (cache) {
|
||||
@ -241,7 +240,6 @@ public class DataCacheHandler extends SessionCache {
|
||||
if (i == null) {
|
||||
return;
|
||||
}
|
||||
Log.debug(i.getUuid() + ": Adding to pool, type:" + i.getType().name());
|
||||
processTask.addToPool(i);
|
||||
}
|
||||
|
||||
@ -407,9 +405,7 @@ public class DataCacheHandler extends SessionCache {
|
||||
* @param uuid Player's UUID
|
||||
*/
|
||||
public void clearFromCache(UUID uuid) {
|
||||
Log.debug(uuid + ": Clear");
|
||||
if (plugin.fetch().isOnline(uuid)) {
|
||||
Log.debug(uuid + ": Online, did not clear");
|
||||
UserData data = dataCache.get(uuid);
|
||||
if (data != null) {
|
||||
data.setClearAfterSave(false);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package main.java.com.djrapitops.plan.data.cache;
|
||||
|
||||
import main.java.com.djrapitops.plan.Log;
|
||||
import main.java.com.djrapitops.plan.data.SessionData;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.utilities.MiscUtils;
|
||||
@ -32,9 +31,7 @@ public class SessionCache {
|
||||
* @param uuid UUID of the player.
|
||||
*/
|
||||
public void startSession(UUID uuid) {
|
||||
long now = MiscUtils.getTime();
|
||||
Log.debug(uuid + ": Starting a session: " + now);
|
||||
SessionData session = new SessionData(now);
|
||||
SessionData session = new SessionData(MiscUtils.getTime());
|
||||
activeSessions.put(uuid, session);
|
||||
}
|
||||
|
||||
@ -46,9 +43,7 @@ public class SessionCache {
|
||||
public void endSession(UUID uuid) {
|
||||
SessionData currentSession = activeSessions.get(uuid);
|
||||
if (currentSession != null) {
|
||||
long now = MiscUtils.getTime();
|
||||
Log.debug(uuid + ": Ending a session: " + now);
|
||||
currentSession.endSession(now);
|
||||
currentSession.endSession(MiscUtils.getTime());
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,7 +65,6 @@ public class SessionCache {
|
||||
public void addSession(UserData data) {
|
||||
UUID uuid = data.getUuid();
|
||||
SessionData currentSession = activeSessions.get(uuid);
|
||||
Log.debug("Adding a session: " + uuid + " " + currentSession);
|
||||
if (currentSession != null && currentSession.isValid() && !data.getSessions().contains(currentSession)) {
|
||||
data.addSession(currentSession);
|
||||
activeSessions.remove(uuid);
|
||||
|
@ -38,7 +38,6 @@ public class DataCacheClearQueue extends Queue<UUID> {
|
||||
* @param uuid UUID of the UserData object (Player's UUID)
|
||||
*/
|
||||
public void scheduleForClear(UUID uuid) {
|
||||
Log.debug(uuid + ": Scheduling for clear");
|
||||
queue.add(uuid);
|
||||
}
|
||||
|
||||
@ -52,7 +51,6 @@ public class DataCacheClearQueue extends Queue<UUID> {
|
||||
return;
|
||||
}
|
||||
uuids = uuids.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||
Log.debug("Scheduling for clear: " + uuids);
|
||||
try {
|
||||
queue.addAll(uuids);
|
||||
} catch (IllegalStateException e) {
|
||||
|
@ -40,7 +40,6 @@ public class DataCacheGetQueue extends Queue<Map<UUID, List<DBCallableProcessor>
|
||||
* fetch is complete, with the UserData object.
|
||||
*/
|
||||
public void scheduleForGet(UUID uuid, DBCallableProcessor... processors) {
|
||||
Log.debug(uuid + ": Scheduling for get");
|
||||
try {
|
||||
Map<UUID, List<DBCallableProcessor>> map = new HashMap<>();
|
||||
map.put(uuid, Arrays.asList(processors));
|
||||
@ -85,7 +84,7 @@ class GetConsumer extends Consumer<Map<UUID, List<DBCallableProcessor>>> {
|
||||
List<DBCallableProcessor> processorsList = entrySet.getValue();
|
||||
|
||||
if (processorsList != null) {
|
||||
Log.debug(uuid + ": Get, For:" + processorsList.size());
|
||||
Log.debug("Database", uuid + ": Get, For:" + processorsList.size());
|
||||
try {
|
||||
db.giveUserDataToProcessors(uuid, processorsList);
|
||||
} catch (SQLException e) {
|
||||
|
@ -14,7 +14,6 @@ import java.util.Collection;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* This Class is starts the Save Queue Thread, that saves data to the Database.
|
||||
@ -42,7 +41,6 @@ public class DataCacheSaveQueue extends Queue<UserData> {
|
||||
* @param data UserData object.
|
||||
*/
|
||||
public void scheduleForSave(UserData data) {
|
||||
Log.debug(data.getUuid() + ": Scheduling for save");
|
||||
try {
|
||||
queue.add(data);
|
||||
} catch (IllegalStateException e) {
|
||||
@ -56,7 +54,6 @@ public class DataCacheSaveQueue extends Queue<UserData> {
|
||||
* @param data Collection of UserData objects.
|
||||
*/
|
||||
public void scheduleForSave(Collection<UserData> data) {
|
||||
Log.debug("Scheduling for save: " + data.stream().map(UserData::getUuid).collect(Collectors.toList()));
|
||||
try {
|
||||
queue.addAll(data);
|
||||
} catch (IllegalStateException e) {
|
||||
@ -113,11 +110,9 @@ class SaveConsumer extends Consumer<UserData> {
|
||||
return;
|
||||
}
|
||||
|
||||
Log.debug(uuid + ": Saving: " + uuid);
|
||||
try {
|
||||
db.saveUserData(data);
|
||||
data.stopAccessing();
|
||||
Log.debug(uuid + ": Saved!");
|
||||
if (data.shouldClearAfterSave()) {
|
||||
handler.getClearTask().scheduleForClear(uuid);
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import com.djrapitops.plugin.task.AbsRunnable;
|
||||
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.Log;
|
||||
import main.java.com.djrapitops.plan.Plan;
|
||||
import main.java.com.djrapitops.plan.data.UserData;
|
||||
import main.java.com.djrapitops.plan.data.cache.DataCacheHandler;
|
||||
@ -65,8 +64,6 @@ public class PlanPlayerListener implements Listener {
|
||||
|
||||
UUID uuid = player.getUniqueId();
|
||||
handler.startSession(uuid);
|
||||
Log.debug(uuid + ": PlayerJoinEvent");
|
||||
|
||||
plugin.getRunnableFactory().createNew(new AbsRunnable("NewPlayerCheckTask") {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -87,13 +84,9 @@ public class PlanPlayerListener implements Listener {
|
||||
} else {
|
||||
handler.addToPool(loginInfo);
|
||||
}
|
||||
|
||||
Log.debug(uuid + ": PlayerJoinEvent_AsyncTask_END, New:" + isNewPlayer);
|
||||
this.cancel();
|
||||
}
|
||||
}).runTaskAsynchronously();
|
||||
|
||||
Log.debug(uuid + ": PlayerJoinEvent_END");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +102,6 @@ public class PlanPlayerListener implements Listener {
|
||||
UUID uuid = player.getUniqueId();
|
||||
handler.endSession(uuid);
|
||||
|
||||
Log.debug(uuid + ": PlayerQuitEvent");
|
||||
long time = MiscUtils.getTime();
|
||||
boolean banned = player.isBanned();
|
||||
Gamemode gm = Gamemode.wrap(player.getGameMode());
|
||||
@ -117,8 +109,6 @@ public class PlanPlayerListener implements Listener {
|
||||
|
||||
handler.addToPool(new LogoutInfo(uuid, time, banned, gm.name(), handler.getSession(uuid), worldName));
|
||||
handler.saveCachedData(uuid);
|
||||
|
||||
Log.debug(uuid + ": PlayerQuitEvent_END");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -138,7 +128,6 @@ public class PlanPlayerListener implements Listener {
|
||||
UUID uuid = player.getUniqueId();
|
||||
|
||||
handler.endSession(uuid);
|
||||
Log.debug(uuid + ": PlayerKickEvent");
|
||||
|
||||
long time = MiscUtils.getTime();
|
||||
boolean banned = player.isBanned();
|
||||
@ -148,7 +137,5 @@ public class PlanPlayerListener implements Listener {
|
||||
handler.addToPool(new LogoutInfo(uuid, time, banned, gm.name(), handler.getSession(uuid), worldName));
|
||||
handler.addToPool(new KickInfo(uuid));
|
||||
handler.saveCachedData(uuid);
|
||||
|
||||
Log.debug(uuid + ": PlayerKickEvent_END");
|
||||
}
|
||||
}
|
||||
|
@ -235,9 +235,6 @@ public class GMTimesTable extends Table {
|
||||
return;
|
||||
}
|
||||
|
||||
int batchSize = batch.size();
|
||||
Log.debug("Database", "Preparing update of GM Times - Batch Size: " + batchSize);
|
||||
|
||||
String[] gms = getGMKeyArray();
|
||||
Set<Integer> savedIDs = getSavedIDs();
|
||||
|
||||
@ -305,9 +302,6 @@ public class GMTimesTable extends Table {
|
||||
return;
|
||||
}
|
||||
|
||||
int batchSize = batch.size();
|
||||
Log.debug("Database", "Preparing insertion of GM Times - Batch Size: " + batchSize);
|
||||
|
||||
String[] gms = getGMKeyArray();
|
||||
|
||||
PreparedStatement statement = null;
|
||||
|
@ -82,7 +82,6 @@ public class KillsTable extends Table {
|
||||
* @throws SQLException
|
||||
*/
|
||||
public List<KillData> getPlayerKills(int userId) throws SQLException {
|
||||
Benchmark.start("Get Kills");
|
||||
UsersTable usersTable = db.getUsersTable();
|
||||
PreparedStatement statement = null;
|
||||
ResultSet set = null;
|
||||
@ -100,7 +99,6 @@ public class KillsTable extends Table {
|
||||
} finally {
|
||||
close(set);
|
||||
close(statement);
|
||||
Benchmark.stop("Database", "Get Kills");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,9 +230,6 @@ public class SessionsTable extends Table {
|
||||
return;
|
||||
}
|
||||
|
||||
int batchSize = batch.size();
|
||||
Log.debug("Database", "Preparing insertion of sessions - Batch Size: " + batchSize);
|
||||
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
statement = prepareStatement("INSERT INTO " + tableName + " ("
|
||||
|
@ -135,9 +135,6 @@ public class TPSTable extends Table {
|
||||
return;
|
||||
}
|
||||
|
||||
int batchSize = batch.size();
|
||||
Log.debug("Database", "Preparing insertion of TPS - Batch Size: " + batchSize);
|
||||
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
statement = prepareStatement("INSERT INTO " + tableName + " ("
|
||||
|
@ -691,9 +691,6 @@ public class UsersTable extends Table {
|
||||
return;
|
||||
}
|
||||
|
||||
int batchSize = data.size();
|
||||
Log.debug("Database", "Preparing insertion of new users - Batch Size: " + batchSize);
|
||||
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
statement = prepareStatement(getInsertStatement());
|
||||
|
@ -78,7 +78,7 @@ public class ExportUtility {
|
||||
|
||||
Benchmark.start("Exporting Player pages");
|
||||
rawData.forEach(userData -> writeInspectHtml(userData, playersFolder, playerHtml));
|
||||
Benchmark.stop("Exporting Player pages");
|
||||
Benchmark.stop("Export", "Exporting Player pages");
|
||||
} catch (IOException ex) {
|
||||
Log.toLog("ExportUtils.export", ex);
|
||||
} finally {
|
||||
|
Loading…
Reference in New Issue
Block a user