refactor: eliminate redundant patterns across codebase#95
Merged
70CentsApple merged 5 commits intomultiloaderfrom Apr 9, 2026
Merged
refactor: eliminate redundant patterns across codebase#9570CentsApple merged 5 commits intomultiloaderfrom
70CentsApple merged 5 commits intomultiloaderfrom
Conversation
Replace manual cast patterns across all feature/logic files: - (boolean) ConfigUtils.get() → ConfigUtils.getBoolean() - ((Number) ConfigUtils.get()).intValue() → ConfigUtils.getInt() - ((Number) ConfigUtils.get()).longValue() → ConfigUtils.getLong() - ((Number) ConfigUtils.get()).floatValue() → ConfigUtils.getFloat() - (String) ConfigUtils.get() → ConfigUtils.getString() List casts and config UI files are left unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: 70CentsApple <63957117+70CentsApple@users.noreply.github.com>
…debase Agent-Logs-Url: https://github.com/70CentsApple/ChatTools/sessions/9b4675d3-008d-40ad-8213-b93cc57b7712 Co-authored-by: 70CentsApple <63957117+70CentsApple@users.noreply.github.com>
…rintStackTrace with LoggerUtils Agent-Logs-Url: https://github.com/70CentsApple/ChatTools/sessions/9b4675d3-008d-40ad-8213-b93cc57b7712 Co-authored-by: 70CentsApple <63957117+70CentsApple@users.noreply.github.com>
… eviction consolidation Agent-Logs-Url: https://github.com/70CentsApple/ChatTools/sessions/9b4675d3-008d-40ad-8213-b93cc57b7712 Co-authored-by: 70CentsApple <63957117+70CentsApple@users.noreply.github.com>
Agent-Logs-Url: https://github.com/70CentsApple/ChatTools/sessions/9b4675d3-008d-40ad-8213-b93cc57b7712 Co-authored-by: 70CentsApple <63957117+70CentsApple@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
70CentsApple
April 9, 2026 03:52
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Systematic cleanup of repeated boilerplate patterns—manual config casts, duplicated HTTP helpers, raw
e.printStackTrace(), copy-pasted version-branched constructors, and verbose modifier key checks.Typed config getters
Added
ConfigUtils.getBoolean/getInt/getLong/getFloat/getStringto replace ~65 manual casts across 24 files:Translator HTTP dedup
Extracted
AbstractTranslator.buildQueryString(Map)— identical URL-encoding logic was in Google, Microsoft, and Baidu translators.Structured exception logging
Added
LoggerUtils.error(String, Throwable)overload. Replaced all 18e.printStackTrace()calls with proper SLF4J logging. Removed athrow new Exception()anti-pattern inConfigStorage.get()that existed solely for stack trace output.Data-driven KeyboardUtils
Replaced ~50-line switch/case block with
EnumMap<KeyModifiers, int[]>lookup tables for required and forbidden modifier keys. ExtractedisAnyKeyDown()helper.Version-branched HoverEvent helper
TextUtils.showTextHoverEvent(Component)centralizes the//? if >=1.21.5branching forHoverEvent.ShowTextvsnew HoverEvent(Action.SHOW_TEXT, ...)— used in 10 call sites across 5 files.Minor cleanups
ChatColorEraser.work()simplified tocomputeIfAbsent(matchingNickHider)TextUtils.evictOldest(Map, int)replaces manual eldest-entry eviction loops inNickHiderandTextUtils