build: two-tier checkstyle gate, empty suppressions, fix baseline
Checkstyle is now a ratchet: severity="error" only for rules that are at zero violations, design-debt rules report as warnings and must be flipped to error as soon as their backlog hits zero (tracked in TODO.md). - thresholds tightened: MethodLength 80->40, CyclomaticComplexity 20->15, NestedIfDepth 3->2, ParameterNumber 7->5; new rules ReturnCount(5), FinalClass, HiddenField, VisibilityModifier; MagicNumber and FinalLocalVariable promoted from warning to error (both clean) - suppressions.xml emptied: 45 legacy entries removed, never add back - fixed 102 baseline violations (431->329): FinalClass in 37 classes, WhitespaceAround in 11 files - TODO.md: Task 1 done (lolib removed, smoke test passed) and Task 2 baseline recorded (red report, per-package list, next steps)
This commit is contained in:
parent
4d999c89a8
commit
e8b6569ccf
46 changed files with 279 additions and 147 deletions
|
|
@ -6,7 +6,7 @@ package dev.loki.loparkour.adaptive.core.model;
|
|||
*
|
||||
* Thread-safe: Stateless, all methods are pure functions.
|
||||
*/
|
||||
public class DifficultyWeights {
|
||||
public final class DifficultyWeights {
|
||||
|
||||
private static final double[] LEVEL_THRESHOLDS = {0.3, 0.6, 0.8};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
* Cached configuration for the adaptive difficulty system.
|
||||
* Loads settings from config.yml and caches them for performance.
|
||||
*/
|
||||
public class AdaptiveConfig {
|
||||
public final class AdaptiveConfig {
|
||||
|
||||
private AdaptiveConfig() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ public class SQLStatsStorage implements StatsRepository {
|
|||
flushBatch();
|
||||
}
|
||||
|
||||
private static class PendingUpdate {
|
||||
private static final class PendingUpdate {
|
||||
int jumps = 0;
|
||||
int falls = 0;
|
||||
int longestStreak = 0;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
* <li>For jump structures, see {@link dev.loki.loparkour.schematic.core.ParkourSchematic}</li>
|
||||
* </ul>
|
||||
*/
|
||||
public class ParkourAPI {
|
||||
public final class ParkourAPI {
|
||||
|
||||
private ParkourAPI() throws IllegalAccessException {
|
||||
throw new IllegalAccessException("Initializing API class");
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
class CommandTabCompleter {
|
||||
final class CommandTabCompleter {
|
||||
|
||||
private static final int THREE_ARGS = 3;
|
||||
private static final int FOUR_ARGS = 4;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.util.Map;
|
|||
/**
|
||||
* Admin schematic tools: wand, create, list, paste, reload.
|
||||
*/
|
||||
public class SchematicCommandHandler {
|
||||
public final class SchematicCommandHandler {
|
||||
|
||||
private static final int COOLDOWN_MS = 2500;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.util.logging.Logger;
|
|||
/**
|
||||
* Handles loading, updating, and basic validation of configuration files.
|
||||
*/
|
||||
public class ConfigLoader {
|
||||
public final class ConfigLoader {
|
||||
|
||||
private ConfigLoader() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.util.logging.Logger;
|
|||
* preserving user values while adding any new keys from the template.
|
||||
* Uses full YAML paths (e.g. "sql.enabled") to avoid key collisions.
|
||||
*/
|
||||
public class ConfigUpdater {
|
||||
public final class ConfigUpdater {
|
||||
|
||||
private final Logger logger;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import java.util.stream.Stream;
|
|||
/**
|
||||
* Loads locale files from disk with validation and auto-fix.
|
||||
*/
|
||||
public class LocaleLoader {
|
||||
public final class LocaleLoader {
|
||||
|
||||
private LocaleLoader() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import java.util.regex.Pattern;
|
|||
* Facade for locale system: loading, caching, and access.
|
||||
* Delegates to LocaleLoader and LocaleCache.
|
||||
*/
|
||||
public class Locales {
|
||||
public final class Locales {
|
||||
|
||||
private Locales() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import java.util.function.BiFunction;
|
|||
* Facade for all config-derived constants.
|
||||
* Delegates to specialized option classes in config.options package.
|
||||
*/
|
||||
public class Option {
|
||||
public final class Option {
|
||||
|
||||
private Option() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.util.Map;
|
|||
/**
|
||||
* General configuration options (heading, border, leads, go-back location, parkour options).
|
||||
*/
|
||||
public class OptionGeneral {
|
||||
public final class OptionGeneral {
|
||||
|
||||
private static final int MAX_LEAD = 128;
|
||||
private static final int MIN_AXIS_VALUES = 4;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import dev.loki.loparkour.config.core.Config;
|
|||
/**
|
||||
* Generation-related configuration options (validation, memory).
|
||||
*/
|
||||
public class OptionGeneration {
|
||||
public final class OptionGeneration {
|
||||
|
||||
private static final double DEFAULT_MAX_JUMP_DISTANCE = 5.0;
|
||||
private static final double DEFAULT_MAX_HORIZONTAL_DISTANCE = 4.0;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import org.bukkit.Sound;
|
|||
/**
|
||||
* Particle and sound configuration options.
|
||||
*/
|
||||
public class OptionParticles {
|
||||
public final class OptionParticles {
|
||||
|
||||
private static final int PARTICLE_SIZE = 10;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import dev.loki.loparkour.config.core.Config;
|
|||
/**
|
||||
* SQL database configuration options.
|
||||
*/
|
||||
public class OptionSQL {
|
||||
public final class OptionSQL {
|
||||
|
||||
private OptionSQL() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import java.util.function.BiFunction;
|
|||
/**
|
||||
* Style initialization utilities.
|
||||
*/
|
||||
public class OptionStyles {
|
||||
public final class OptionStyles {
|
||||
|
||||
private OptionStyles() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class GeneratorState {
|
|||
public final Map<BlockData, Double> specialChances = new HashMap<>();
|
||||
public final Map<ParkourGenerator.BlockGenerationType, Double> defaultChances = new HashMap<>();
|
||||
|
||||
public GeneratorState() {}
|
||||
public GeneratorState() { }
|
||||
|
||||
public void resetScore() {
|
||||
score = 0;
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ public class GeneratorCleanup {
|
|||
case SOUTH -> blockSpawn.add(0, 0, FIRST_BLOCK_OFFSET);
|
||||
case WEST -> blockSpawn.add(-FIRST_BLOCK_OFFSET, 0, 0);
|
||||
case EAST -> blockSpawn.add(FIRST_BLOCK_OFFSET, 0, 0);
|
||||
default -> {}
|
||||
default -> { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ package dev.loki.loparkour.hook.floodgate;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.geysermc.floodgate.api.FloodgateApi;
|
||||
|
||||
public class FloodgateHook {
|
||||
public final class FloodgateHook {
|
||||
|
||||
private FloodgateHook() {}
|
||||
private FloodgateHook() { }
|
||||
|
||||
/**
|
||||
* Whether this player is a bedrock player.
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ import dev.loki.loparkour.leaderboard.model.Score;
|
|||
import dev.loki.loparkour.mode.base.Mode;
|
||||
import me.filoghost.holographicdisplays.api.HolographicDisplaysAPI;
|
||||
|
||||
public class HoloHook {
|
||||
public final 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() {}
|
||||
private HoloHook() { }
|
||||
|
||||
/**
|
||||
* Initializes this hook.
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ import org.bukkit.Bukkit;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
public class VaultHook {
|
||||
public final class VaultHook {
|
||||
|
||||
private VaultHook() {}
|
||||
private VaultHook() { }
|
||||
|
||||
private static Economy economy;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,5 +4,5 @@ package dev.loki.loparkour.menu.core;
|
|||
* Placeholder during menu migration; real flows use {@link Menus} / InventoryGui.
|
||||
*/
|
||||
public final class MenuStub {
|
||||
private MenuStub() {}
|
||||
private MenuStub() { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,5 +84,5 @@ public abstract class DynamicMenu {
|
|||
int id,
|
||||
BiFunction<@NotNull Player, @Nullable ParkourUser, dev.loki.loparkour.menu.gui.MenuItem> item,
|
||||
Predicate<Player> predicate
|
||||
) {}
|
||||
) { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,6 +173,6 @@ public class GravityShiftMode implements Mode {
|
|||
return Modes.GRAVITY_SHIFT;
|
||||
}
|
||||
|
||||
private record EffectConfig(int amplifier, int durationTicks) {}
|
||||
private record EffectConfig(int amplifier, int durationTicks) { }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import java.util.Map;
|
|||
/**
|
||||
* Class that reads the rewards-v2.yml file and puts them in the variables listed below.
|
||||
*/
|
||||
public class Rewards {
|
||||
public final class Rewards {
|
||||
|
||||
private Rewards() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import java.io.File;
|
|||
/**
|
||||
* Ensures the schematics folder exists; structures are loaded by {@link SchematicManager}.
|
||||
*/
|
||||
public class Schematics {
|
||||
public final class Schematics {
|
||||
|
||||
private Schematics() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import java.util.function.Function;
|
|||
* Refactored Session using composition pattern.
|
||||
* Coordinates player management and state management.
|
||||
*/
|
||||
public class Session {
|
||||
public final class Session {
|
||||
|
||||
public ParkourGenerator generator;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.util.UUID;
|
|||
* @author loki
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public class Storage {
|
||||
public final class Storage {
|
||||
|
||||
private Storage() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import java.util.UUID;
|
|||
*
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public class StorageDisk {
|
||||
public final class StorageDisk {
|
||||
|
||||
private StorageDisk() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import java.util.UUID;
|
|||
/**
|
||||
* Maps data between Java objects and SQL result sets.
|
||||
*/
|
||||
public class SQLDataMapper {
|
||||
public final class SQLDataMapper {
|
||||
|
||||
private static final int SCORE_PARAM_INDEX = 3;
|
||||
private static final int TIME_PARAM_INDEX = 4;
|
||||
|
|
@ -134,7 +134,7 @@ public class SQLDataMapper {
|
|||
}
|
||||
|
||||
private static void deserializeSettings(@NotNull ParkourPlayer player, @NotNull String settings) {
|
||||
final Type type = new TypeToken<Map<String, Object>>() {}.getType();
|
||||
final Type type = new TypeToken<Map<String, Object>>() { }.getType();
|
||||
final Map<String, Object> parsed = LoParkour.getGson().fromJson(settings, type);
|
||||
if (parsed == null) {
|
||||
player.setSettings(new HashMap<>());
|
||||
|
|
@ -166,5 +166,5 @@ public class SQLDataMapper {
|
|||
String styleName,
|
||||
String settings,
|
||||
long lastSeen
|
||||
) {}
|
||||
) { }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import java.util.logging.Logger;
|
|||
* Facade for SQL storage. Coordinates connection lifecycle and delegates
|
||||
* CRUD to dedicated repository classes.
|
||||
*/
|
||||
public class StorageSQL {
|
||||
public final class StorageSQL {
|
||||
|
||||
private StorageSQL() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull;
|
|||
/**
|
||||
* Builds SQL queries for parkour storage operations.
|
||||
*/
|
||||
public class SQLQueryBuilder {
|
||||
public final class SQLQueryBuilder {
|
||||
|
||||
private SQLQueryBuilder() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import java.util.logging.Logger;
|
|||
/**
|
||||
* CRUD for player data.
|
||||
*/
|
||||
public class SQLPlayerRepository {
|
||||
public final class SQLPlayerRepository {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(SQLPlayerRepository.class.getName());
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import java.util.logging.Logger;
|
|||
/**
|
||||
* CRUD for leaderboard scores.
|
||||
*/
|
||||
public class SQLScoreRepository {
|
||||
public final class SQLScoreRepository {
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(SQLScoreRepository.class.getName());
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import java.sql.SQLException;
|
|||
/**
|
||||
* Creates the database schema (DDL) for parkour storage.
|
||||
*/
|
||||
public class SQLSchemaManager {
|
||||
public final class SQLSchemaManager {
|
||||
|
||||
private static final String ADAPTIVE_STATS_TABLE = """
|
||||
CREATE TABLE IF NOT EXISTS loparkour_player_stats (
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import java.util.Locale;
|
|||
*/
|
||||
public final class Materials {
|
||||
|
||||
private Materials() {}
|
||||
private Materials() { }
|
||||
|
||||
@Nullable
|
||||
public static Material parse(@Nullable String name) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||
/**
|
||||
* Probability utilities (replacement for vilib Probs)
|
||||
*/
|
||||
public class Probs {
|
||||
public final class Probs {
|
||||
|
||||
private Probs() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import org.bukkit.inventory.meta.SkullMeta;
|
|||
/**
|
||||
* Utility for setting player heads
|
||||
*/
|
||||
public class SkullSetter {
|
||||
public final class SkullSetter {
|
||||
|
||||
private SkullSetter() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import org.bukkit.util.BoundingBox;
|
|||
* Utility class for particle effects
|
||||
* Replaces vilib Particles
|
||||
*/
|
||||
public class ParticleUtil {
|
||||
public final class ParticleUtil {
|
||||
|
||||
private ParticleUtil() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import java.util.regex.Pattern;
|
|||
* <p>Project standard: {@code &#RRGGBB} and {@code &l} etc. — see {@code .cursor/rules/locale-and-colors.mdc}.
|
||||
* MiniMessage tags are legacy-only; do not use in new locale or Java strings.
|
||||
*/
|
||||
public class ColorUtil {
|
||||
public final class ColorUtil {
|
||||
|
||||
private ColorUtil() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import org.bukkit.Location;
|
|||
/**
|
||||
* Location utilities (replacement for vilib Locations)
|
||||
*/
|
||||
public class Locations {
|
||||
public final class Locations {
|
||||
|
||||
private Locations() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import java.util.stream.IntStream;
|
|||
* @author loki
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public class Divider {
|
||||
public final class Divider {
|
||||
|
||||
private Divider() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import java.nio.file.Path;
|
|||
import java.util.Comparator;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class World {
|
||||
public final class World {
|
||||
|
||||
private static final int WORLD_BORDER_SIZE = 10_000_000;
|
||||
private static final int CLEAR_WEATHER_DURATION_TICKS = 1000000;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue