fix: remove all unused imports, fields, and variables across codebase

This commit is contained in:
2026-06-01 12:43:20 -05:00
parent 062d398d71
commit 0e18a64054
7 changed files with 6 additions and 26 deletions

View File

@@ -125,7 +125,7 @@ public final class NickCorePlugin extends JavaPlugin {
Bukkit.getPluginManager().registerEvents(chatService, this); Bukkit.getPluginManager().registerEvents(chatService, this);
Bukkit.getPluginManager().registerEvents(guiManager, this); Bukkit.getPluginManager().registerEvents(guiManager, this);
Bukkit.getPluginManager().registerEvents( Bukkit.getPluginManager().registerEvents(
new CommandPreprocessListener(nameOverrideService, getLogger()), this); new CommandPreprocessListener(nameOverrideService), this);
Bukkit.getPluginManager().registerEvents( Bukkit.getPluginManager().registerEvents(
new TabCompleteListener(nameOverrideService), this); new TabCompleteListener(nameOverrideService), this);

View File

@@ -1,6 +1,5 @@
package com.nickcore.paper.command; package com.nickcore.paper.command;
import com.nickcore.common.model.NickHistory;
import com.nickcore.common.model.NickProfile; import com.nickcore.common.model.NickProfile;
import com.nickcore.common.validation.InputSanitizer; import com.nickcore.common.validation.InputSanitizer;
import com.nickcore.paper.gui.GuiManager; import com.nickcore.paper.gui.GuiManager;
@@ -39,7 +38,6 @@ public final class NickCommand implements CommandExecutor, TabCompleter {
private static final String PERM_RESET = "nickcore.reset"; private static final String PERM_RESET = "nickcore.reset";
private static final String PERM_RANK = "nickcore.rank.select"; private static final String PERM_RANK = "nickcore.rank.select";
private static final String PERM_SKIN = "nickcore.skin.select"; private static final String PERM_SKIN = "nickcore.skin.select";
private static final String PERM_ADMIN = "nickcore.admin";
private static final String PERM_RELOAD = "nickcore.reload"; private static final String PERM_RELOAD = "nickcore.reload";
private static final String PERM_FORCE = "nickcore.force"; private static final String PERM_FORCE = "nickcore.force";
private static final String PERM_INFO = "nickcore.info"; private static final String PERM_INFO = "nickcore.info";

View File

@@ -54,7 +54,7 @@ public final class GuiManager implements Listener {
public void openRankMenu(Player player) { public void openRankMenu(Player player) {
RankMenuGui gui = new RankMenuGui(player, this, nickService, rankService, RankMenuGui gui = new RankMenuGui(player, this, nickService, rankService,
profileCache, placeholderService, nametagService); placeholderService, nametagService);
openGuis.put(player.getUniqueId(), gui); openGuis.put(player.getUniqueId(), gui);
gui.open(); gui.open();
} }
@@ -67,7 +67,7 @@ public final class GuiManager implements Listener {
@EventHandler @EventHandler
public void onInventoryClick(InventoryClickEvent event) { public void onInventoryClick(InventoryClickEvent event) {
if (!(event.getWhoClicked() instanceof Player player)) return; if (!(event.getWhoClicked() instanceof Player)) return;
if (!(event.getInventory().getHolder() instanceof AbstractGui gui)) return; if (!(event.getInventory().getHolder() instanceof AbstractGui gui)) return;
gui.handleClick(event); gui.handleClick(event);
} }

View File

@@ -1,8 +1,6 @@
package com.nickcore.paper.gui; package com.nickcore.paper.gui;
import com.nickcore.common.model.NickProfile;
import com.nickcore.common.model.RankDefinition; import com.nickcore.common.model.RankDefinition;
import com.nickcore.paper.cache.ProfileCache;
import com.nickcore.paper.service.NickService; import com.nickcore.paper.service.NickService;
import com.nickcore.paper.service.NametagService; import com.nickcore.paper.service.NametagService;
import com.nickcore.paper.service.PlaceholderService; import com.nickcore.paper.service.PlaceholderService;
@@ -24,20 +22,18 @@ public final class RankMenuGui extends AbstractGui {
private final GuiManager guiManager; private final GuiManager guiManager;
private final NickService nickService; private final NickService nickService;
private final RankService rankService; private final RankService rankService;
private final ProfileCache profileCache;
private final PlaceholderService placeholderService; private final PlaceholderService placeholderService;
private final NametagService nametagService; private final NametagService nametagService;
private final MiniMessage mm = MiniMessage.miniMessage(); private final MiniMessage mm = MiniMessage.miniMessage();
private int page = 0; private int page = 0;
public RankMenuGui(Player viewer, GuiManager guiManager, NickService nickService, public RankMenuGui(Player viewer, GuiManager guiManager, NickService nickService,
RankService rankService, ProfileCache profileCache, RankService rankService, PlaceholderService placeholderService,
PlaceholderService placeholderService, NametagService nametagService) { NametagService nametagService) {
super(viewer, 54, Component.text("Select Rank", NamedTextColor.GOLD, TextDecoration.BOLD)); super(viewer, 54, Component.text("Select Rank", NamedTextColor.GOLD, TextDecoration.BOLD));
this.guiManager = guiManager; this.guiManager = guiManager;
this.nickService = nickService; this.nickService = nickService;
this.rankService = rankService; this.rankService = rankService;
this.profileCache = profileCache;
this.placeholderService = placeholderService; this.placeholderService = placeholderService;
this.nametagService = nametagService; this.nametagService = nametagService;
} }

View File

@@ -9,9 +9,6 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import java.util.Objects; import java.util.Objects;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* Intercepts player commands and replaces nick names with real names before dispatch. * Intercepts player commands and replaces nick names with real names before dispatch.
@@ -25,14 +22,9 @@ import java.util.regex.Pattern;
public final class CommandPreprocessListener implements Listener { public final class CommandPreprocessListener implements Listener {
private final NameOverrideService nameOverrideService; private final NameOverrideService nameOverrideService;
private final Logger logger;
/** Pattern to split command into parts while preserving structure. */ public CommandPreprocessListener(NameOverrideService nameOverrideService) {
private static final Pattern WORD_BOUNDARY = Pattern.compile("\\s+");
public CommandPreprocessListener(NameOverrideService nameOverrideService, Logger logger) {
this.nameOverrideService = Objects.requireNonNull(nameOverrideService); this.nameOverrideService = Objects.requireNonNull(nameOverrideService);
this.logger = Objects.requireNonNull(logger);
} }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)

View File

@@ -1,11 +1,8 @@
package com.nickcore.paper.listener; package com.nickcore.paper.listener;
import com.nickcore.common.model.NickProfile; import com.nickcore.common.model.NickProfile;
import com.nickcore.common.validation.InputSanitizer;
import com.nickcore.paper.service.*; import com.nickcore.paper.service.*;
import com.nickcore.paper.scheduler.SchedulerAdapter; import com.nickcore.paper.scheduler.SchedulerAdapter;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@@ -29,7 +26,6 @@ public final class PlayerConnectionListener implements Listener {
private final NameOverrideService nameOverrideService; private final NameOverrideService nameOverrideService;
private final SchedulerAdapter scheduler; private final SchedulerAdapter scheduler;
private final Logger logger; private final Logger logger;
private final MiniMessage mm = MiniMessage.miniMessage();
public PlayerConnectionListener(Plugin plugin, NickService nickService, public PlayerConnectionListener(Plugin plugin, NickService nickService,
SkinService skinService, PlaceholderService placeholderService, SkinService skinService, PlaceholderService placeholderService,

View File

@@ -4,7 +4,6 @@ import com.nickcore.common.model.NickProfile;
import com.nickcore.paper.cache.ProfileCache; import com.nickcore.paper.cache.ProfileCache;
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@@ -28,7 +27,6 @@ import java.util.concurrent.ConcurrentHashMap;
public final class NameOverrideService { public final class NameOverrideService {
private final ProfileCache profileCache; private final ProfileCache profileCache;
private final MiniMessage miniMessage = MiniMessage.miniMessage();
/** nick (lowercase) -> real player UUID */ /** nick (lowercase) -> real player UUID */
private final ConcurrentHashMap<String, UUID> nickToUuid = new ConcurrentHashMap<>(512); private final ConcurrentHashMap<String, UUID> nickToUuid = new ConcurrentHashMap<>(512);