mirror of
https://github.com/DiscordSRV/Ascension.git
synced 2024-11-01 08:39:31 +01:00
Add any offline uuid data to debug reports
This commit is contained in:
parent
cfcbada10d
commit
9f6b2ef9fd
@ -127,6 +127,7 @@ public class DebugReport {
|
||||
values.put("jdaStatus", jda != null ? jda.getStatus().name() : "JDA null");
|
||||
values.put("platformLogger", discordSRV.platformLogger().getClass().getName());
|
||||
values.put("onlineMode", discordSRV.onlineMode().name());
|
||||
values.put("offlineModeUuid", discordSRV.playerProvider().isAnyOffline());
|
||||
|
||||
values.put("javaVersion", System.getProperty("java.version"));
|
||||
values.put("javaVendor", System.getProperty("java.vendor")
|
||||
|
@ -31,23 +31,34 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public abstract class AbstractPlayerProvider<T extends IPlayer, DT extends DiscordSRV> implements PlayerProvider<T> {
|
||||
|
||||
private final Map<UUID, T> players = new ConcurrentHashMap<>();
|
||||
private final List<T> allPlayers = new CopyOnWriteArrayList<>();
|
||||
protected final DT discordSRV;
|
||||
private final AtomicBoolean anyOffline = new AtomicBoolean(false);
|
||||
|
||||
public AbstractPlayerProvider(DT discordSRV) {
|
||||
this.discordSRV = discordSRV;
|
||||
}
|
||||
|
||||
public boolean isAnyOffline() {
|
||||
return anyOffline.get();
|
||||
}
|
||||
|
||||
public abstract void subscribe();
|
||||
|
||||
protected void addPlayer(UUID uuid, T player, boolean initial) {
|
||||
this.players.put(uuid, player);
|
||||
this.allPlayers.add(player);
|
||||
discordSRV.scheduler().run(() -> discordSRV.eventBus().publish(new PlayerConnectedEvent(player, initial)));
|
||||
|
||||
if (uuid.getLeastSignificantBits() != 0 /* Not Geyser */
|
||||
&& uuid.version() == 3 /* Offline */) {
|
||||
anyOffline.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
protected void removePlayer(UUID uuid) {
|
||||
|
Loading…
Reference in New Issue
Block a user