LoChat/TODO.md

5.3 KiB

LoChat Development TODO

Last updated: 2026-07-05


✅ COMPLETED

Memory Leaks

  • AutoMessageManager: save task reference, cancel in stop()
  • Event listeners: HandlerList.unregisterAll(this) in onDisable()
  • MuteHistoryManager: MAX_HISTORY_PER_PLAYER = 50

Race Conditions

  • AsyncChatEvent: try-catch for Location in async
  • ConfigManager: volatile + synchronized reload()

Compilation Fixes

  • EnhancedChatRenderer: appearanceCfg → cfg.getAppearanceConfig()
  • Replace deprecated Registry.SOUNDS.match() with Registry.SOUNDS.get(NamespacedKey)
  • Remove unused imports
  • Remove redundant TabCompleter from RollCommand

Config Refactor

  • BaseConfig base class for all configs
  • MessagesConfig (renamed from HardcodedMessages)
  • Clean config.yml: 300+ → 44 lines
  • Thread-safety: volatile + synchronized

Main Class Refactor

  • PluginInitializer — init logic
  • PluginShutdown — shutdown logic
  • LoChat: 185 → 108 lines

Documentation

  • README bilingual (EN + RU)
  • CONTRIBUTING.md created
  • CODE_OF_CONDUCT.md bilingual
  • SECURITY.md bilingual
  • GitHub issue/PR templates bilingual
  • Config comments in English, no Spacelegacy palette

Checkstyle

  • Google Java Style config (2-space indent, 100-char lines, Javadoc)
  • Checkstyle plugin wired into build.gradle.kts

Cleanup

  • Removed libs/lolib-3.0.0.jar (unused)
  • Removed CODE_OF_CONDUCT.md, SECURITY.md
  • Added bin/ to .gitignore
  • Configs rewritten: clean, English, no Russian/Spacelegacy

🟡 CODE QUALITY ISSUES (HIGH PRIORITY)

1. Max 3 Files Per Folder

Folder Files Fix
config/ 9 ⚠️ Split into config/chat/, config/mute/, config/filter/, config/general/
api/service/ 8 ⚠️ Keep interfaces flat or split into api/service/chat/, api/service/mute/
core/service/ 8 ⚠️ Mirror the api split

2. DRY: AppearanceConfig.loadEmojiCache() Called Twice

File: config/AppearanceConfig.java:23-31

  • init() calls super.init() which calls onLoad() which calls loadEmojiCache()
  • Then init() calls loadEmojiCache() again
  • Fix: Remove the duplicate call in init()

3. SRP: ConfigManager.java (278 lines)

God class with 60+ methods across 10+ concerns:

  • Config orchestration
  • Chat settings (global, local, PM)
  • Mention settings
  • Clear chat state mutation
  • Announcement settings
  • Join/quit/death message settings

Fix: Split into ChatConfig, PmConfig, MentionConfig, ClearChatConfig, AnnouncementConfig, CustomMessagesConfig

4. OCP: AdvancedMessageFilter.filterMessage()

Hardcoded pipeline of 7 filters. Adding a new filter requires modifying this method.

Fix: Dynamic List<Filter> pipeline with registration

5. ISP: MessagingService (fat interface)

16 methods across 4 concerns: PM + Spy + Ignore + Persistence

Fix: Split into PrivateMessageService, SpyService, IgnoreService, PersistableService

6. DIP: Service Locator Anti-Pattern

ServiceRegistry.get(Xxx.class) used everywhere instead of constructor DI.

Fix: Pass required services via constructor parameters

7. DRY: 12 Commands Duplicate Constructor Pattern

Commands like MsgCommand, ReplyCommand, IgnoreCommand, MuteCommand, BanCommand etc. don't use BaseCommand hierarchy and repeat the same field/constructor/permission pattern.

Fix: Migrate all to PlayerCommand / AdminCommand

8. DRY: PM Send Logic Duplicated

MsgCommand.java:48-59 and ReplyCommand.java:47-57 have identical PM send code.

Fix: Extract to shared method/service

9. KISS: MuteCommand.onCommand() (~100 lines)

High complexity: argument parsing, flags, fallback logic, permission checks, broadcast logic, voice-mute.

Fix: Decompose into MuteRequest parser + MuteExecutor service

10. OOP: Leaked Internals

  • LoChat.getInstance() — singleton abuse
  • LoChat exposes 7+ internal components via public getters
  • ChatEventListener casts to concrete PlayerServiceImpl
  • BaseConfig has protected mutable fields

🔵 MEDIUM PRIORITY

11. Dual Message Configs

MessageConfig.java (root, path-based) and MessagesConfig.java (config/, typed getters) overlap.

Fix: Unify into single MessageConfig

12. Filter Classes Don't Share Interface

core/filter/filters/*.java are standalone. CooldownFilter/MuteFilter implement MessageFilter from api.

Fix: Make all filters implement MessageFilter

13. 5+ Services Repeat Load/Save/Persistence

NickServiceImpl, PlayerServiceImpl, ChatServiceImpl, PunishmentServiceImpl all have their own file I/O.

Fix: Shared persistence utility

14. Mute Duration Permissions Not Declared in plugin.yml

lochat.mute.dur.5m, lochat.mute.dur.3h, lochat.mute.reason.* — used in code/configs but missing from plugin.yml.


⚪ LOW PRIORITY

15. Performance: Aho-Corasick for Swear Filter

16. Discord Rate Limiter

17. Tests: Only 4 test files (150 main files)

18. .project, .classpath, .settings/ should be gitignored


📋 KNOWN ISSUES

  • Gradients may not display correctly on clients < 1.16
  • Some filters may block legitimate messages (configurable in config/filters.yml)