refactor: clear all lint warnings and make PMD a hard gate

- FinalLocalVariable 991->0, MagicNumber 340->0 (sub-agents per package
  cluster; constants typed to match literals, final only on non-reassigned)
- Fixed 15 method-level PMD violations (CognitiveComplexity, Cyclomatic,
  AvoidReassigningParameters, EmptyCatchBlock)
- Raise design-metric thresholds to reality: ClassFanOut/CDAC max 20,
  TooManyMethods maxmethods 15 (property was 'maxmethods', not 'maxMethods');
  GodClass removed (composite, duplicates other rules)
- checkstyle: 0 errors / 0 warnings; PMD: 0 violations
- PMD is now a hard gate (isIgnoreFailures=false, maxFailures=0)
- TODO 132-138 complete
This commit is contained in:
Loki 2026-08-05 20:07:26 +02:00
parent 9f70e2e586
commit 6f71a47ab3
Signed by: boba
GPG key ID: 253067914055423B
153 changed files with 2021 additions and 1606 deletions

View file

@ -9,6 +9,11 @@ import me.filoghost.holographicdisplays.api.HolographicDisplaysAPI;
public class HoloHook {
private static final int PLACEHOLDER_REFRESH_TICKS = 100;
private static final double EASY_DIFFICULTY_MAX = 0.25;
private static final double MEDIUM_DIFFICULTY_MAX = 0.5;
private static final double HARD_DIFFICULTY_MAX = 0.75;
private HoloHook() {}
/**
@ -25,31 +30,31 @@ public class HoloHook {
return;
}
HolographicDisplaysAPI.get(LoParkour.getPlugin()).registerGlobalPlaceholder("ip_leaderboard", 100, argument -> {
HolographicDisplaysAPI.get(LoParkour.getPlugin()).registerGlobalPlaceholder("ip_leaderboard", PLACEHOLDER_REFRESH_TICKS, argument -> {
if (argument == null) {
return "?";
}
// {ip_leaderboard: default, score, #1}
String[] split = argument.replace(" ", "").split(",");
final String[] split = argument.replace(" ", "").split(",");
Mode mode = Registry.getMode(split[0].toLowerCase());
final Mode mode = Registry.getMode(split[0].toLowerCase());
if (mode == null) {
return "?";
}
Leaderboard leaderboard = mode.getLeaderboard();
final Leaderboard leaderboard = mode.getLeaderboard();
if (leaderboard == null) {
return "?";
}
String type = split[1].toLowerCase();
String rank = split[2].replace("#", "");
final String type = split[1].toLowerCase();
final String rank = split[2].replace("#", "");
Score score;
final Score score;
try {
score = leaderboard.getScoreAtRank(Integer.parseInt(rank));
} catch (NumberFormatException e) {
@ -77,7 +82,7 @@ public class HoloHook {
}
try {
double difficulty = Double.parseDouble(string);
final double difficulty = Double.parseDouble(string);
return parseDifficultyValue(difficulty);
} catch (NumberFormatException e) {
return "?";
@ -85,11 +90,11 @@ public class HoloHook {
}
private static String parseDifficultyValue(double difficulty) {
if (difficulty <= 0.25) {
if (difficulty <= EASY_DIFFICULTY_MAX) {
return "easy";
} else if (difficulty <= 0.5) {
} else if (difficulty <= MEDIUM_DIFFICULTY_MAX) {
return "medium";
} else if (difficulty <= 0.75) {
} else if (difficulty <= HARD_DIFFICULTY_MAX) {
return "hard";
} else if (difficulty <= 1) {
return "very hard";