Skip to content

Persist detected mods to disk so they survive player logout #41

Description

@Th0rgal

Problem

All detected mod data (generic checks, Lunar mods, Forge mods) is stored in-memory in `HackedPlayer` and cleared when the player disconnects. Server staff cannot review what mods a player was using after they log out.

Root cause: `HackedPlayer` stores everything in memory (`HashSet`, `LinkedHashMap`), and the player is removed from the global map on `PlayerQuitEvent`.

Suggested approach

Option A: File-based logging (simple)

Log detections to a file (e.g., `logs/detections.log` or `detections/.json`):

  • On each new detection, append a timestamped entry
  • Could be a simple CSV/JSON log: `[timestamp, uuid, playerName, checkId, modName]`
  • Add a command like `/hs history ` to query the log

Option B: In-memory retention with expiry

Keep `HackedPlayer` objects alive for a configurable duration after disconnect instead of immediately removing them. This is simpler but doesn't survive server restarts.

Option C: SQLite/flat-file database

Store detections in a lightweight database for queryable history. More complex but most flexible.

Recommended: Option A

A simple append-only log file is the lowest-effort solution and covers the main use case (staff reviewing what mods a player had). Could be combined with Option B for short-term in-memory lookups.

Relevant files

  • `hackedserver-core/src/main/java/org/hackedserver/core/HackedPlayer.java` (in-memory storage)
  • `hackedserver-core/src/main/java/org/hackedserver/core/HackedServer.java` (`removePlayer()`)
  • `hackedserver-spigot/src/main/java/org/hackedserver/spigot/listeners/HackedPlayerListeners.java` (PlayerQuitEvent handler)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions