mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-03 17:29:51 +01:00
Attempt to correct register date when gathering register date data
Affects issues: - Possibly fixed #2934
This commit is contained in:
parent
e4a32a2902
commit
e5cf9cb4c5
@ -130,8 +130,17 @@ public class PlayerJoinEventConsumer {
|
||||
.ifPresent(dbSystem.getDatabase()::executeTransaction);
|
||||
}
|
||||
|
||||
private CompletableFuture<?> storeGamePlayer(PlayerJoin join) {
|
||||
private static long getRegisterDate(PlayerJoin join) {
|
||||
long registerDate = join.getPlayer().getRegisterDate().orElseGet(join::getTime);
|
||||
// Correct incorrect register dates https://github.com/plan-player-analytics/Plan/issues/2934
|
||||
if (registerDate < System.currentTimeMillis() / 1000) {
|
||||
registerDate = registerDate * 1000;
|
||||
}
|
||||
return registerDate;
|
||||
}
|
||||
|
||||
private CompletableFuture<?> storeGamePlayer(PlayerJoin join) {
|
||||
long registerDate = getRegisterDate(join);
|
||||
String joinAddress = join.getPlayer().getJoinAddress().orElse(JoinAddressTable.DEFAULT_VALUE_FOR_LOOKUP);
|
||||
Transaction transaction = new StoreServerPlayerTransaction(
|
||||
join.getPlayerUUID(), registerDate, join.getPlayer().getName(), join.getServerUUID(), joinAddress
|
||||
|
@ -59,7 +59,11 @@ public class StoreServerPlayerTransaction extends PlayerRegisterTransaction {
|
||||
|
||||
// Updates register date to smallest possible value.
|
||||
Optional<Long> foundRegisterDate = query(PlayerFetchQueries.fetchRegisterDate(playerUUID));
|
||||
if (foundRegisterDate.isPresent() && foundRegisterDate.get() > registerDate) {
|
||||
if (foundRegisterDate.isPresent() &&
|
||||
(foundRegisterDate.get() > registerDate
|
||||
// Correct incorrect register dates https://github.com/plan-player-analytics/Plan/issues/2934
|
||||
|| foundRegisterDate.get() < System.currentTimeMillis() / 1000)
|
||||
) {
|
||||
execute(DataStoreQueries.updateMainRegisterDate(playerUUID, registerDate));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user