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.
This commit is contained in:
loki5512344 2026-01-23 21:52:17 +01:00
parent 4f7b792633
commit e616667c78
20 changed files with 250 additions and 99 deletions

View file

@ -13,6 +13,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* Команда /unmute nick [-s]
@ -57,24 +58,15 @@ public class UnmuteCommand implements CommandExecutor, TabCompleter {
}
// Ищем игрока
Player target = Bukkit.getPlayer(targetName);
String finalTargetName = targetName;
java.util.UUID targetUUID;
if (target == null) {
@SuppressWarnings("deprecation")
var offlinePlayer = Bukkit.getOfflinePlayer(targetName);
if (!offlinePlayer.hasPlayedBefore() && !offlinePlayer.isOnline()) {
sender.sendMessage(plugin.getMessageConfig().getComponent("errors.player-not-found"));
return true;
}
targetUUID = offlinePlayer.getUniqueId();
finalTargetName = offlinePlayer.getName() != null ? offlinePlayer.getName() : targetName;
} else {
targetUUID = target.getUniqueId();
finalTargetName = target.getName();
UUID targetUUID = com.loki.lochat.utils.PlayerUtil.findPlayerUUID(targetName);
if (targetUUID == null) {
sender.sendMessage(plugin.getMessageConfig().getComponent("errors.player-not-found"));
return true;
}
Player target = Bukkit.getPlayer(targetUUID);
String finalTargetName = com.loki.lochat.utils.PlayerUtil.getPlayerName(targetUUID);
String operatorName = sender.getName();
// Размучиваем