From a6a4713dd7b554dbcb8566ef6a21395416a0c3d0 Mon Sep 17 00:00:00 2001 From: M_Viper Date: Thu, 7 May 2026 19:49:49 +0000 Subject: [PATCH] Delete src/main/java/net/viper/status/stats/PlayerStats.java via Git Manager GUI --- .../net/viper/status/stats/PlayerStats.java | 113 ------------------ 1 file changed, 113 deletions(-) delete mode 100644 src/main/java/net/viper/status/stats/PlayerStats.java diff --git a/src/main/java/net/viper/status/stats/PlayerStats.java b/src/main/java/net/viper/status/stats/PlayerStats.java deleted file mode 100644 index 5395999..0000000 --- a/src/main/java/net/viper/status/stats/PlayerStats.java +++ /dev/null @@ -1,113 +0,0 @@ -package net.viper.status.stats; - -import java.util.UUID; - -public class PlayerStats { - public final UUID uuid; - public String name; - public long firstSeen; - public long lastSeen; - public long totalPlaytime; - public long currentSessionStart; - public int joins; - - // Economy - public double balance; - public double totalEarned; - public double totalSpent; - public int transactionsCount; - - // Punishments - public int bansCount; - public int mutesCount; - public int warnsCount; - public long lastPunishmentAt; // Unix-Timestamp (Sek.), 0 = nie - public String lastPunishmentType; // "ban", "mute", "warn", "kick", "" = nie - public int punishmentScore; - - public PlayerStats(UUID uuid, String name) { - this.uuid = uuid; - this.name = name; - long now = System.currentTimeMillis() / 1000L; - this.firstSeen = now; - this.lastSeen = now; - this.totalPlaytime = 0; - this.currentSessionStart = 0; - this.joins = 0; - this.balance = 0.0; - this.totalEarned = 0.0; - this.totalSpent = 0.0; - this.transactionsCount = 0; - this.bansCount = 0; - this.mutesCount = 0; - this.warnsCount = 0; - this.lastPunishmentAt = 0; - this.lastPunishmentType = ""; - this.punishmentScore = 0; - } - - public synchronized void onJoin() { - long now = System.currentTimeMillis() / 1000L; - if (this.currentSessionStart == 0) this.currentSessionStart = now; - this.lastSeen = now; - this.joins++; - if (this.firstSeen == 0) this.firstSeen = now; - } - - public synchronized void onQuit() { - long now = System.currentTimeMillis() / 1000L; - if (this.currentSessionStart > 0) { - long session = now - this.currentSessionStart; - if (session > 0) this.totalPlaytime += session; - this.currentSessionStart = 0; - } - this.lastSeen = now; - } - - public synchronized long getPlaytimeWithCurrentSession() { - long now = System.currentTimeMillis() / 1000L; - if (this.currentSessionStart > 0) return totalPlaytime + (now - currentSessionStart); - return totalPlaytime; - } - - public synchronized String toLine() { - String safeType = (lastPunishmentType == null ? "" : lastPunishmentType).replace("|", "_"); - return uuid + "|" + name.replace("|", "_") + "|" + firstSeen + "|" + lastSeen + "|" + totalPlaytime + "|" + currentSessionStart + "|" + joins - + "|" + balance + "|" + totalEarned + "|" + totalSpent + "|" + transactionsCount - + "|" + bansCount + "|" + mutesCount + "|" + warnsCount + "|" + lastPunishmentAt + "|" + safeType + "|" + punishmentScore; - } - - public static PlayerStats fromLine(String line) { - String[] parts = line.split("\\|", -1); - if (parts.length < 7) return null; - try { - UUID uuid = UUID.fromString(parts[0]); - String name = parts[1]; - PlayerStats ps = new PlayerStats(uuid, name); - ps.firstSeen = Long.parseLong(parts[2]); - ps.lastSeen = Long.parseLong(parts[3]); - ps.totalPlaytime = Long.parseLong(parts[4]); - ps.currentSessionStart = Long.parseLong(parts[5]); - ps.joins = Integer.parseInt(parts[6]); - // Economy (felder 7-10) - if (parts.length >= 11) { - try { ps.balance = Double.parseDouble(parts[7]); } catch (Exception ignored) {} - try { ps.totalEarned = Double.parseDouble(parts[8]); } catch (Exception ignored) {} - try { ps.totalSpent = Double.parseDouble(parts[9]); } catch (Exception ignored) {} - try { ps.transactionsCount = Integer.parseInt(parts[10]); } catch (Exception ignored) {} - } - // Punishments (felder 11-16) - if (parts.length >= 17) { - try { ps.bansCount = Integer.parseInt(parts[11]); } catch (Exception ignored) {} - try { ps.mutesCount = Integer.parseInt(parts[12]); } catch (Exception ignored) {} - try { ps.warnsCount = Integer.parseInt(parts[13]); } catch (Exception ignored) {} - try { ps.lastPunishmentAt = Long.parseLong(parts[14]); } catch (Exception ignored) {} - ps.lastPunishmentType = parts[15]; - try { ps.punishmentScore = Integer.parseInt(parts[16]); } catch (Exception ignored) {} - } - return ps; - } catch (Exception e) { - return null; - } - } -} \ No newline at end of file