refactor(player): encapsulate game state behind PlayerSettings, clear VisibilityModifier and HiddenField
- ParkourUser/ParkourPlayer/GeneratorState public mutable fields -> private + short accessors - per-player settings extracted to player/data/PlayerSettings (ParkourPlayer 188 -> 96 lines, PMD-counted methods 20 -> 9); this is what fixed the TooManyMethods violation that the encapsulation itself introduced — by decomposition, not by lowering the threshold - disk storage reads and writes the same canonical 12-key map as the SQL JSON column; legacy key names normalized on read, @Expose dropped from domain classes - 39 settings call sites rewritten across 7 files - HiddenField backlog cleared (Config, ObstacleGenerator, GhostService, Leaderboard, PagedMenu, Reward, ParticleData, World) - checkstyle ratchet: VisibilityModifier, HiddenField, EmptyLineSeparator and MissingDeprecated flipped to error once their counters hit zero; suppressions.xml empty - javac -Xmaxwarns raised so NullAway/Error Prone counts are honest (baseline 165/289, now 164/265) checkstyle 0 errors / 135 warnings, PMD 0 violations, tests 94/0 fail, ./gradlew check green. TODO.md: items 30 and 107 updated, new items 167-170, ПРОГРЕСС-6/7 recorded.
This commit is contained in:
parent
c120309663
commit
02e2947f47
90 changed files with 1103 additions and 660 deletions
|
|
@ -5,6 +5,7 @@ import dev.loki.loparkour.schematic.core.SchematicManager;
|
|||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
|
|
@ -16,16 +17,16 @@ public final class SchematicDifficultyConfig {
|
|||
}
|
||||
|
||||
public static void setDifficulty(@NotNull String fileStem, double difficulty) throws IOException {
|
||||
if (Config.SCHEMATICS.path == null) {
|
||||
final File configFile = Config.SCHEMATICS.path();
|
||||
if (configFile == null) {
|
||||
throw new IOException("Schematics config path is not initialized");
|
||||
}
|
||||
|
||||
final YamlConfiguration yaml = YamlConfiguration.loadConfiguration(Config.SCHEMATICS.path);
|
||||
final YamlConfiguration yaml = YamlConfiguration.loadConfiguration(configFile);
|
||||
final String key = SchematicManager.configKey(fileStem);
|
||||
yaml.set("difficulty." + key, difficulty);
|
||||
yaml.save(Config.SCHEMATICS.path);
|
||||
yaml.save(configFile);
|
||||
|
||||
Config.SCHEMATICS.fileConfiguration = YamlConfiguration.loadConfiguration(Config.SCHEMATICS.path);
|
||||
Config.SCHEMATICS.load();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue