Commit graph

96 commits

Author SHA1 Message Date
260986ff11
feat: hover translation (Google, Chrome endpoint with gtx fallback), LuckPerms prefixes in chat, restyled messages
Some checks are pending
Build & Test / Build LoChat (push) Waiting to run
2026-09-20 21:05:17 +02:00
bd39118b14
chore: add PMD 7.8.0 and fix warnings/antipatterns
- build.gradle.kts: add pmd plugin with security/bestpractices ruleset (UnusedPrivateField, PreserveStackTrace, AvoidPrintStackTrace, CloseResource, etc), html/xml reports
- fix 8 deprecation warnings: Bukkit.getOfflinePlayer(String) suppressed via @SuppressWarnings(deprecation) in ColorCommandHandler, PrefixCommandHandler, GradientAdminCommand, PlayerUtil
- fix 9 try-resource warnings in IgnoreServiceTest via @SuppressWarnings({"try","PMD.UnusedLocalVariable"})
- PMD fixes: AvoidPrintStackTrace -> logger.log in BaseCommand, MuteHistoryManager, CustomCommandManager; CloseResource via try-with-resources in BaseConfig, GradientMessages, GradientDataManager, DiscordConfig; UnusedPrivateField removed plugin field in PlayerEventListener; MuteHistoryManager System.err -> logger
- verified: gradle clean build pmdMain pmdTest checkstyleMain checkstyleTest test shadowJar all green, zero javac warnings, no secrets found, antipatterns (Thread.sleep in async webhook/rate-limiter kept isolated, printStackTrace removed)
2026-09-20 16:56:02 +02:00
83e980d1bb
trim: moderation → mute only
- remove ban/warn commands: BanCommand (/lban), UnbanCommand (/lunban),
  WarnCommand (/warn), SilentWarnCommand (silentwarn) and empty ban/warn dirs
- plugin.yml: remove commands lban/lunban/warn/silentwarn and
  permissions lochat.ban/lochat.unban/lochat.warn/lochat.warn.silent/
  lochat.warn.notify/lochat.bypass.warn/lochat.bypass.ban/lochat.ban.override;
  remove LibertyBans from softdepend
- remove registration in CommandManager and PluginInitializer
  (LibertyBansHook, ModerationListener)
- delete PunishmentService api+impl, BanRecord/WarnEntry models,
  ModerationListener, LibertyBansHook; strip ServiceRegistry/PluginInitializer/
  LoChat reload and PlayerInfoCommand (warn/ban sections)
- config: remove moderation.default-ban-reason/ban-kick-message from
  config.yml, ban/warn keys from config/messages.yml, escalation header
  Punishment->Mute in mute.yml
- MessagesConfig.java: remove ban/warn getters (keep mute)
- README: remove /lban /warn rows, update features to mute-only
- preserve /lmute /lunmute /lmutelist /lmuteblame, MuteService, mute.yml,
  mutes.json format and HIGHEST chat handler
2026-09-20 16:44:39 +02:00
7f513a7104
port: replace Paper component APIs, chat pipeline, events and schedulers
- Msg.send/broadcast/actionBar/title/legacy/plain for all 58 files sendMessage replacements (plan step 3)
- ChatEventListener: AsyncChatEvent->AsyncPlayerChatEvent, getRecipients filtering, manual render+Msg.send loop, HIGHEST|ignoreCancelled, nobodyHeard via Bukkit scheduler (step 4)
- EnhancedChatRenderer: remove ChatRenderer/Audience, render(Player,Component,Component,Player), getLocale String, Msg.actionBar
- PlayerEventListener: join/quit/death String API, getCustomName/getDisplayName legacy, Msg.broadcast
- FoliaUtil: IS_FOLIA false, Bukkit scheduler only; AutoMessageManager BukkitTask
- CustomCommandManager: reflective getCommandMap; other mechanical fixes (displayName, kick, inventory titles)
- single universal jar (variant A) - loads on Spigot 1.20.1 and Paper
2026-09-20 16:38:37 +02:00
88e4e68cca
port: compat layer
- add compat/Adventure (BukkitAudiences lifecycle with legacy fallback)
- add compat/Msg (send/broadcast/actionBar/title/legacy/plain/displayName/playerListName/kick/itemMeta/inventoryTitle)
- wire Adventure.init/close in LoChat onEnable/onDisable
- remove unused reflection-based utils/platform/AdventureManager
2026-09-20 16:18:40 +02:00
a822c91637
feat: chat channel system (/join /leave /channel)
- config-driven channels in config/channels.yml (global, local, staff, trade) with
  emoji, colors, prefix, radius, cooldowns, permissions and aliases
- Channel record + ChannelConfig loader wired into ConfigManager (reload supported)
- ChannelService (api) + ConcurrentHashMap-backed ChannelServiceImpl, joined in
  ServiceRegistry; default channel join treated as 'not in channel'
- JoinChannelCommand / LeaveChannelCommand / ChannelCommand (+ tab completion),
  registered in CommandManager; plugin.yml commands + permissions
- ChatEventListener routes AsyncChatEvent to the active channel: per-channel
  cooldown, local-radius viewer filtering, channel-aware renderer
- EnhancedChatRenderer supports Channel overload (emojiFor/prefixText/channelColor)
- ChannelServiceImplTest covering join/leave/permissions/aliases
2026-08-09 21:31:11 +02:00
689ab1a9ae
feat: anti-swear obfuscation bypass + filter statistics
- SwearNormalizer: expanded leet/lookalike map (q→р, digits), strips separators inside
  words, collapses repeated letters; single source of truth for AhoCorasick
- SwearFilter: detects obfuscated profanity on normalized text, masks tolerant matches
  in replace mode via tolerant word patterns
- FilterStatistics: per-filter block counters -> /lochat filterstats subcommand
- tests: SwearNormalizerTest, FilterStatisticsTest
2026-08-09 21:17:18 +02:00
cda89c78e4
fix: carry-over fixes — per-type cooldowns, PM cooldown, nickname persistence, thread-safe deques
- PlayerServiceImpl: separate cooldown map per chat type (fixes cross-blocking between local chat and RP commands)
- PrivateMessageServiceImpl: enforce chat.pm.cooldown (honors chat.bypass.cooldown)
- NickServiceImpl: persist nicknames async on every change/reset
- FloodFilter/SpamFilter: ConcurrentLinkedDeque instead of ArrayDeque
- tests: PlayerServiceCooldownTest
2026-08-09 21:08:58 +02:00
b1b0c9082b
fix: critical fixes from code review — async translation, atomic persistence, unified chat pipeline, config key alignment 2026-08-09 21:04:07 +02:00
103c982f87
chore: unify checkstyle, fix violations, cleanup bin/ 2026-07-12 00:59:08 +02:00
25cd6c3e88 feat: add chat message translation via LibreTranslate
Adds optional translation feature that shows translated chat messages
on hover in each viewer's Minecraft client language.

- TranslationService with LibreTranslate API support and caching
- Config options: enabled, endpoint, api-key
- Hover translation on chat messages in EnhancedChatRenderer
- Disabled by default, supports any LibreTranslate-compatible endpoint
2026-07-06 00:01:59 +02:00
09689ae799 refactor: DIP — core services & listeners use constructor injection, ServiceRegistry removed 2026-07-05 16:16:18 +02:00
5eae09e5bb perf: replace regex swear filter with Aho-Corasick O(n) trie + add FilterResult unit tests 2026-07-05 16:08:32 +02:00
42ebac890c feat: persistence util, PM DRY, Discord rate limiter, missing permissions in plugin.yml 2026-07-05 15:17:15 +02:00
dd0fb0f10d fix: zero checkstyle warnings, exclude test sources, fix LineLength 2026-07-05 13:51:48 +02:00
4efccd3968 fix: encapsulation, star imports, checkstyle warnings (520→41), remove casts 2026-07-05 13:38:47 +02:00
90c3cac5cf refactor: split god classes, fix OCP/ISP/SRP, migrate commands to BaseCommand hierarchy 2026-07-05 13:22:48 +02:00
812517513f build: rebuild artifacts and update CI workflows 2026-04-07 13:45:25 +02:00
e7b10a7daa refactor(core): обновить ServiceFactory и ServiceRegistry
Добавлен фабричный метод для MessagingService:
- ServiceFactory.createMessagingService() - создание MessagingService
- ServiceRegistry теперь использует фабрику для MessagingService

Изменения:
~ core/factory/ServiceFactory.java
  + createMessagingService(plugin, messageConfig)
~ core/registry/ServiceRegistry.java
  - new MessagingServiceImpl(plugin, messageConfig)
  + ServiceFactory.createMessagingService(plugin, messageConfig)

Результат:
- Единообразное создание сервисов через фабрику
- Упрощена инициализация в ServiceRegistry
- Улучшена тестируемость
2026-04-07 13:23:10 +02:00
4107731014 refactor(gradient): разбить GradientPrefixCommand через Command pattern (212→64 строки)
Применен Command pattern с handlers:
- PrefixSubCommandHandler: интерфейс для обработчиков
- PrefixOnHandler: включение префикса (40 строк)
- PrefixOffHandler: выключение префикса (35 строк)
- PrefixResetHandler: сброс префикса (40 строк)
- PrefixSetHandler: установка префикса (110 строк)

Структура:
+ gradient/commands/handlers/prefix/PrefixSubCommandHandler.java
+ gradient/commands/handlers/prefix/PrefixOnHandler.java
+ gradient/commands/handlers/prefix/PrefixOffHandler.java
+ gradient/commands/handlers/prefix/PrefixResetHandler.java
+ gradient/commands/handlers/prefix/PrefixSetHandler.java
~ gradient/commands/GradientPrefixCommand.java (212→64 строки)

Результат:
- GradientPrefixCommand уменьшен с 212 до 64 строк
- Каждый handler отвечает за одну подкоманду
- Улучшена тестируемость и расширяемость
- Все god-классы разбиты, директории оптимизированы
2026-04-07 12:57:06 +02:00
7c02b0407e refactor(gradient): разбить GradientColorCommand через Command pattern (255→68 строк)
Применен Command pattern с handlers:
- SubCommandHandler: интерфейс для обработчиков
- ColorOnHandler: включение градиента (40 строк)
- ColorOffHandler: выключение градиента (35 строк)
- ColorResetHandler: сброс градиента (40 строк)
- ColorCopyHandler: копирование градиента (90 строк)
- ColorSetHandler: установка цветов (95 строк)

Структура:
+ gradient/commands/handlers/color/SubCommandHandler.java
+ gradient/commands/handlers/color/ColorOnHandler.java
+ gradient/commands/handlers/color/ColorOffHandler.java
+ gradient/commands/handlers/color/ColorResetHandler.java
+ gradient/commands/handlers/color/ColorCopyHandler.java
+ gradient/commands/handlers/color/ColorSetHandler.java
~ gradient/commands/GradientColorCommand.java (255→68 строк)

Результат:
- GradientColorCommand уменьшен с 255 до 68 строк
- Каждый handler отвечает за одну подкоманду
- Улучшена тестируемость и расширяемость
2026-04-07 12:54:20 +02:00
bb78f1e60f refactor(config): разбить ConfigManager на 3 класса (312→80 строк)
Применен принцип Single Responsibility:
- ConfigLoader: загрузка и миграция версий конфига
- ConfigAccessor: доступ к значениям конфигурации
- ConfigManager: координатор, делегирует вызовы

Структура:
+ config/core/ConfigLoader.java (70 строк)
+ config/core/ConfigAccessor.java (185 строк)
~ config/ConfigManager.java (312→80 строк)

Результат:
- ConfigManager уменьшен с 312 до 80 строк
- Логика разделена по ответственности
- Улучшена читаемость и поддерживаемость
2026-04-07 12:52:34 +02:00
f45786c6af Рефакторинг: KISS принципы, разбиение god-классов, реорганизация
- Создан RatConfig.java с централизованными константами
- MuteServiceImpl: 261→170 строк (Strategy pattern)
- MessagingServiceImpl: 219→124 строк (3 отдельных сервиса)
- ServiceFactory для создания сервисов
- Реорганизованы директории: utils/, commands/moderation/, commands/admin/
- Все директории теперь ≤6 файлов
2026-04-07 12:48:23 +02:00
4f6eaf35e9 chore: clean up documentation and rebuild with badwords filter
- Remove outdated CODE_REVIEW_RU.md and REFACTORING_SERVICES.md documentation
- Add badwords.txt resource file for swear filter functionality
- Rebuild compiled classes with updated filter and configuration logic
- Update all configuration files (appearance, discord, filters, messages)
- Rebuild core components: ConfigManager, PluginInitializer, SwearFilter, GradientModule, PrefixService, PlayerEventListener, EnhancedChatRenderer
- Consolidate build artifacts with source changes for consistency
2026-04-06 00:38:34 +02:00
bba480002f refactor: restructure services and filters architecture
- Remove deprecated service interfaces (CooldownService, IgnoreService, PMService, PlayerDataService, SpyService)
- Add new unified service interfaces (MessagingService, PlayerService, PunishmentService)
- Extract FilterResult as standalone class from AdvancedMessageFilter
- Implement individual filter classes (CharacterFilter, FloodFilter, SpamFilter, SwearFilter, UrlFilter)
- Add moderation commands (BanCommand, WarnCommand, SilentWarnCommand, UnbanCommand)
- Introduce data models for punishment tracking (BanRecord, WarnEntry)
- Refactor messaging service with new MessagingServiceImpl implementation
- Add mute service utilities (MuteDataStorage, MutePermissionChecker)
- Implement PunishmentServiceImpl with snapshot tracking
- Add Discord integration components (DiscordConfig, DiscordMessageService)
- Introduce command handlers for gradient module (ColorCommandHandler, PrefixCommandHandler)
- Add renderer components (EmojiComponent, GradientBuilder, UrlProcessor)
- Add utility classes (ColorConverter, MessageSender, PlaceholderProcessor)
- Update configuration files and plugin metadata
- Add documentation files (CODE_REVIEW_RU.md, REFACTORING_SERVICES.md)
- Consolidate service architecture for improved maintainability and separation of concerns
2026-04-06 00:18:25 +02:00
2d79d2a91d chore: update .gitignore and build.gradle.kts for local server testing
- Added entries to .gitignore for local Paper test server and API documentation.
- Included the run-paper plugin in build.gradle.kts for local server execution.
- Configured runServer task with Minecraft version 1.21.4 for testing.
2026-04-01 16:09:15 +02:00
d1d2b93742 fix all 2026-03-16 12:43:52 +01:00
5088e3ad1c fix color 2026-03-13 15:51:47 +01:00
6b6605a2b0 fix 2026-03-11 14:35:00 +01:00
5ece2192a2 add fiscord webhook 2026-03-11 14:21:43 +01:00
0fea0f4537 fix 2026-03-11 11:05:47 +01:00
49744acc59 fix 2026-03-10 17:12:23 +01:00
fe64b3d51f fix command and refactoring config 2026-03-10 16:58:10 +01:00
1e5e8d8638 feat(lohub): Add complete configuration system with 6 config files
- Added messages.yml for all plugin messages with customizable prefix
- Added commands.yml for custom commands (discord, website, store, rules, heal, clearinventory)
- Added serverselector.yml for GUI server selector menu
- Added data.yml for persistent data storage (chat_locked, spawn location)
- Updated ConfigManager to load all config files
- Updated ChatLockManager to use data.yml instead of chatlock.dat
- Updated SpawnManager to use data.yml instead of spawn.yml
- Updated all commands to use messages.yml
- Updated listeners to use messages.yml
- Removed duplicate config files from root directory
- Added CONFIG_GUIDE.md documentation
2026-02-24 13:27:18 +01:00
e78d8a2de4 Update to Minecraft 1.21.8, add checkstyle, fix compilation errors
- Update Paper API: 1.20.1 -> 1.21.4
- Update plugin version: 1.5.5-1.20.1 -> 1.5.5-1.21.8
- Add checkstyle plugin with reasonable rules
- Fix Enchantment.LUCK -> Enchantment.UNBREAKING
- Fix EntityType.FIREWORK -> EntityType.FIREWORK_ROCKET
- Remove unused imports
- Add temp_*/ to .gitignore
- 118 files changed, 1633 insertions(+), 1301 deletions(-)
2026-02-24 00:04:03 +01:00
6a4c8a7886 feat: LoHub Action system + Join system implementation 2026-02-23 17:27:34 +01:00
69cae99476 feat: Add Paper Chat API with hover/click/mentions/emojis/URLs + custom nicknames 2026-02-23 15:40:48 +01:00
7658f6f3e6 fix: Use correct placeholder format {prefix} {player} {message} instead of angle brackets 2026-02-23 14:11:30 +01:00
874835cb97 fix: Use FoliaUtil for AutoMessageManager timer (Folia compatibility) 2026-02-23 14:06:53 +01:00
0d74dbacbf fix: Add try-catch for LuckPerms initialization in GradientModule 2026-02-23 14:02:40 +01:00
4ee5393a5e refactor: Remove all legacy managers, complete SOLID migration 2026-02-23 12:17:37 +01:00
74482851aa refactor: Remove emoji system and chat filters, implement SOLID architecture 2026-02-23 12:10:51 +01:00
16a5e09118 Fix final compilation warnings
- Removed unused imports and variables in HeadEmojiManager
- Clean compilation with no warnings
- All features working correctly
- Ready for production use
2026-01-23 22:08:46 +01:00
01d8c3a2e7 Complete config redesign and feature additions
🎨 Config Redesign:
- Unified style for all config files with beautiful headers
- Consistent color scheme using gradients throughout
- Improved readability with proper sections and comments
- Fixed color formatting issues

✨ New Features:
- SkinsRestorer integration for custom skins support
- Head emoji system (:head_nickname: and @head nickname)
- Clear chat message configuration command (/clearchatconfig)
- Enhanced custom commands with more examples
- Improved emoji system with 200+ emojis

📝 Documentation:
- Completely rewritten README.md with modern styling
- Added comprehensive feature descriptions
- Detailed command and permission tables
- Configuration examples and usage guides
- Professional formatting and structure

🔧 Technical Improvements:
- Fixed compilation errors
- Improved code organization
- Better error handling
- Enhanced compatibility

All configs now follow consistent MiniMessage gradient styling!
2026-01-23 22:06:46 +01:00
e616667c78 Fix missing features and improve code quality
Features fixed:
- Added chat filter functionality (block/warn/censor modes)
- Fixed spy command to monitor all chat messages
- Added proper spy notifications for global/local chat

Code quality improvements:
- Created PlayerUtil to eliminate code duplication in player lookup
- Refactored ChatListener into smaller, focused methods
- Added Constants class to replace magic numbers
- Improved SOLID principles compliance
- Fixed all compilation warnings

All features from README are now implemented and working.
2026-01-23 21:52:17 +01:00
4f7b792633 Adapt LoChat for Minecraft 1.20.1 Paper
- Changed dependency from Folia API 1.21.4 to Paper API 1.20.1
- Updated plugin.yml: api-version to 1.20, folia-supported to false
- Replaced Folia-specific scheduler calls with FoliaUtil for compatibility
- Updated version to 1.5.5-1.20.1
- Fixed enum switch warning in ChatListener
- Removed unused imports
- All tests pass successfully
2026-01-23 21:46:26 +01:00
3aa6291765 Fix legacy color codes (§) support in ChatFormatter
- Added conversion for § color codes to MiniMessage format
- Now supports both & and § legacy color codes
2026-01-03 12:42:23 +01:00
d00ecc88d5 Fix Folia compatibility and allow self-mute
- Use FoliaUtil.runAsync instead of scheduler.runTaskAsynchronously
- Remove self-mute restriction (can now mute yourself)
2026-01-03 12:40:05 +01:00
b74fa21272 Major mute system overhaul
Commands:
- /mute <nick> [time] [-s] [reason] - mute player
- /unmute <nick> [-s] - unmute player
- /mutelist - list active mutes
- /mutehistory <nick> - player mute history
- /muteblame <moderator> - mutes issued by moderator

Features:
- Configurable messages with placeholders (%player%, %operator%, %duration%, %reason%)
- Duration permissions: lochat.mute.dur.<time> (10m, 30m, 1h, 6h, 12h, 1d, 3d, 7d, 14d, 30d, perm)
- Silent mute: -s flag (requires lochat.mute.silent)
- See silent mutes: lochat.mute.see-silent
- Default reason configurable (default: Нету.)
- Auto-use max allowed duration if not specified
- All settings in config.yml under 'mute' section
2026-01-03 12:34:32 +01:00
d92799613e Add /lmutelist and /lmutehistory commands
- /lmutelist - shows all active mutes with remaining time
- /lmutehistory <player> - shows mute history for a player
- Added mute history tracking (mute-history.json)
- History includes: who muted, when, duration, reason, unmute info
- Permissions: lochat.mutelist, lochat.mutehistory
2026-01-03 12:29:24 +01:00