Add config option to suppress packetevents debug logging (off by default)#14
Conversation
Co-authored-by: funkemunky <30784509+funkemunky@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a configuration option to control PacketEvents debug logging, which was previously hardcoded to true and causing log spam with messages about handshake processing and state transitions. The debug logging is now configurable and disabled by default.
Changes:
- Added
packetevents.debugconfiguration field with@ConfigSettingannotation, defaulting tofalse - Moved
loadConfig()call toonLoad()to ensure config is available before PacketEvents initialization - Modified PacketEvents initialization to read debug setting from config instead of using hardcoded
truevalue
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
Anticheat/src/main/java/dev/brighten/ac/Anticheat.java |
Added packetEventsDebug config field with @ConfigSetting annotation and called loadConfig() in onLoad() before PacketEvents registration |
Anticheat/src/main/java/dev/brighten/ac/utils/PacketEventsRegister.java |
Changed from hardcoded debug(true) to reading packetevents.debug from config with fallback to Anticheat.packetEventsDebug |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| getLogger().info("Loading Anticheat..."); | ||
| LibraryLoader.loadAll(INSTANCE); | ||
|
|
||
| loadConfig(); |
There was a problem hiding this comment.
The loadConfig() method is now called in both onLoad() (line 143) and onEnable() (line 160). The PR description mentions "moved loadConfig() into onLoad()" which suggests the call in onEnable() should have been removed. Consider removing the duplicate call from onEnable() unless there's a specific reason to reload the configuration between these two lifecycle phases.
PacketEvents was hardcoded with
debug(true), spamming logs with "Processed handshake" and "Transitioned null's decoder into STATUS state!" messages for every server ping/status check.Changes
Anticheat.java: Added@ConfigSetting(path = "packetevents", name = "debug")field defaulting tofalse, and movedloadConfig()intoonLoad()(beforePacketEventsRegister.register()) so the config is available at PacketEvents initialization time.PacketEventsRegister.java: Replaced hardcodeddebug(true)with a config-driven value:Debug logging is now off by default. Users can re-enable it by setting
packetevents.debug: trueinanticheat.yml. The@ConfigSettingannotation ensures the key is written to the config file on first run viaClassScanner.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.