Skip to content

Fix /pixelchat reload not applying config changes (API key, log level, language, ChatGuard state) - #9

Merged
ToothyDev merged 4 commits into
masterfrom
copilot/fix-config-reload-issue
May 12, 2026
Merged

ToothyDev merged 4 commits into
masterfrom
copilot/fix-config-reload-issue

Conversation

Copilot AI commented Mar 31, 2026 •

Copy link
Copy Markdown
Contributor
  • Fix APIHelper.java: remove cached config fields; read from configHelper dynamically on each call
  • Fix PixelChat.java: add reloadPlugin() that reloads all 12 configs, updates log level, and re-initializes APIHelper/ChatGuardHelper
  • Fix PixelChatCommand.java: delegate reload to plugin.reloadPlugin(); resolve language ConfigHelper as a local variable at the start of each method instead of calling plugin.getConfigHelperLanguage() inline on every usage
  • Fix ChatGuardHelper.java: resolve language ConfigHelper as a local variable at the start of each method (same pattern)
  • Fix AsyncPlayerChatListener.java: check plugin.getAPIHelper() != null dynamically per event instead of a cached boolean
  • Build verified (BUILD SUCCESSFUL)
  • Code review: no actionable issues in changed code

Copilot AI linked an issue Mar 31, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix config reload issues in pixelchat plugin Fix /pixelchat reload not applying config changes (API key, log level, language, ChatGuard state) Mar 31, 2026
Copilot AI requested a review from ToothyDev March 31, 2026 23:15
@ToothyDev
ToothyDev requested a review from Gaming12846 March 31, 2026 23:27
this.loggingHelper = plugin.getLoggingHelper();
this.configHelper = plugin.getConfigHelper();
this.configHelperPlayerStrikes = plugin.getConfigHelperPlayerStrikes();
this.configHelperLanguage = plugin.getConfigHelperLanguage();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the variable and get the ConfigHelper from the plugin every single time?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Explore whether another pattern is more fitting here, and apply it to the other changed files as well. Using the getter every single time isn't ideal and quite verbose

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in commit dedaef1. Instead of removing the field and scattering plugin.getConfigHelperLanguage() calls throughout each method, each method that needs the language config now resolves it once into a local variable at the top (ConfigHelper configHelperLanguage = plugin.getConfigHelperLanguage()). This keeps the code as readable as a field reference while ensuring it always picks up the current language setting after a reload.

@Gaming12846 Gaming12846 added bug Something isn't working enhancement New feature or request labels May 7, 2026
@Gaming12846 Gaming12846 added this to the 1.3.0 milestone May 7, 2026
# Conflicts:
#	src/main/java/de/pixelmindmc/pixelchat/commands/PixelChatCommand.java
@ToothyDev
ToothyDev marked this pull request as ready for review May 12, 2026 17:35
…instead of inline getter calls

Agent-Logs-Url: https://github.com/PixelMindMC/PixelChatGuardian/sessions/54e9aa28-56d1-4d25-8493-a6fcf24c8704

Co-authored-by: ToothyDev <55001472+ToothyDev@users.noreply.github.com>
@ToothyDev
ToothyDev requested a review from Gaming12846 May 12, 2026 17:46
@ToothyDev ToothyDev removed this from the 1.3.0 milestone May 12, 2026
@ToothyDev
ToothyDev merged commit 17723e3 into master May 12, 2026
3 checks passed
@ToothyDev
ToothyDev deleted the copilot/fix-config-reload-issue branch May 12, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Config reloads are spotty / don't apply

3 participants