mdbd/src/main/java/dev/loki/config/GameConfig.java
loki5512344 2a2b9f4b5b Add map templates, multi-config system, &#rrggbb colors
- MapTemplate: Save/load structures via Bukkit Structure API (.nbt files)
- TemplateManager: Manage templates and presets
- MapBuilder: Build/clear map with generators, hooks, pallets, etc.
- SetupCommand: /dbdsetup wand/save/load/set/build for map editing
- MessagesConfig: All messages with &#rrggbb color support via MiniMessage
- SkillCheckConfig: Skill check colors, zones, rotation settings
- Update GameConfig with color codes
- ConfigManager: Load/save all 4 config files
- Update plugin.yml with dbdsetup command
- Add methods to Generator for template integration
2026-05-31 21:05:25 +02:00

185 lines
5.8 KiB
Java

package dev.loki.config;
import org.bukkit.configuration.file.FileConfiguration;
public class GameConfig {
private final FileConfiguration config;
public GameConfig(FileConfiguration config) {
this.config = config;
setDefaults();
}
private void setDefaults() {
// Lobby settings
setDefault("lobby.min-players", 5);
setDefault("lobby.max-players", 5);
setDefault("lobby.countdown-seconds", 60);
setDefault("lobby.role-assign-delay", 5);
// Generator settings
setDefault("generators.total-count", 7);
setDefault("generators.required-count", 5);
setDefault("generators.repair-seconds", 80);
setDefault("generators.regression-rate", 0.25);
setDefault("generators.kick-regression-rate", 2.5);
setDefault("generators.kick-duration-seconds", 30);
// Skill check settings (legacy - moved to skillcheck.yml)
setDefault("skillcheck.zone-size", 0.15);
setDefault("skillcheck.rotation-speed", 3.0);
setDefault("skillcheck.success-bonus", 5.0);
setDefault("skillcheck.fail-penalty", 10.0);
// Colors for UI (&#rrggbb format support)
setDefault("colors.progress-bar-complete", "&#00FF00");
setDefault("colors.progress-bar-incomplete", "&#FF0000");
setDefault("colors.progress-bar-background", "&#333333");
setDefault("colors.hp-healthy", "&#00FF00");
setDefault("colors.hp-injured", "&#FFA500");
setDefault("colors.hp-downed", "&#FF0000");
setDefault("colors.hp-dead", "&#8B0000");
// Hook settings
setDefault("hooks.stage1-seconds", 60);
setDefault("hooks.stage2-seconds", 60);
setDefault("hooks.struggle-interval", 2);
setDefault("hooks.max-hooks", 3);
// Movement speeds (% of normal)
setDefault("movement.killer", 115);
setDefault("movement.killer-carry", 92);
setDefault("movement.survivor-walk", 100);
setDefault("movement.survivor-sprint", 150);
setDefault("movement.survivor-crawl", 30);
setDefault("movement.exhaustion-duration", 3);
setDefault("movement.exhaustion-cooldown", 5);
// Healing settings
setDefault("healing.self-heal-seconds", 30);
setDefault("healing.other-heal-seconds", 16);
setDefault("healing.medkit-bonus", 0.5);
// Killer settings
setDefault("killer.attack-cooldown", 2.5);
setDefault("killer.attack-range", 3.0);
setDefault("killer.pallet-stun-seconds", 2.5);
setDefault("killer.pallet-break-seconds", 3.0);
setDefault("killer.terror-radius", 32);
// Window vault
setDefault("window.vault-survivor-fast", 1.0);
setDefault("window.vault-survivor-slow", 1.5);
setDefault("window.vault-killer", 1.5);
// Endgame
setDefault("endgame.gate-open-seconds", 20);
setDefault("endgame.collapse-seconds", 120);
setDefault("endgame.chest-open-seconds", 3);
// Hatch
setDefault("hatch.min-survivors-for-open", 1);
}
private void setDefault(String path, Object value) {
if (!config.contains(path)) {
config.set(path, value);
}
}
public int getMinPlayers() {
return config.getInt("lobby.min-players", 5);
}
public int getMaxPlayers() {
return config.getInt("lobby.max-players", 5);
}
public int getLobbyCountdown() {
return config.getInt("lobby.countdown-seconds", 60);
}
public int getRoleAssignDelay() {
return config.getInt("lobby.role-assign-delay", 5);
}
public int getGeneratorTotal() {
return config.getInt("generators.total-count", 7);
}
public int getGeneratorRequired() {
return config.getInt("generators.required-count", 5);
}
public int getGeneratorRepairSeconds() {
return config.getInt("generators.repair-seconds", 80);
}
public double getRegressionRate() {
return config.getDouble("generators.regression-rate", 0.25);
}
public double getKickRegressionRate() {
return config.getDouble("generators.kick-regression-rate", 2.5);
}
public int getKickDuration() {
return config.getInt("generators.kick-duration-seconds", 30);
}
public int getStage1Seconds() {
return config.getInt("hooks.stage1-seconds", 60);
}
public int getStage2Seconds() {
return config.getInt("hooks.stage2-seconds", 60);
}
public int getMaxHooks() {
return config.getInt("hooks.max-hooks", 3);
}
public double getKillerSpeed() {
return config.getDouble("movement.killer", 115) / 100.0;
}
public double getKillerCarrySpeed() {
return config.getDouble("movement.killer-carry", 92) / 100.0;
}
public double getSurvivorWalkSpeed() {
return config.getDouble("movement.survivor-walk", 100) / 100.0;
}
public double getSurvivorSprintSpeed() {
return config.getDouble("movement.survivor-sprint", 150) / 100.0;
}
public double getSurvivorCrawlSpeed() {
return config.getDouble("movement.survivor-crawl", 30) / 100.0;
}
public int getAttackCooldown() {
return (int) (config.getDouble("killer.attack-cooldown", 2.5) * 20);
}
public double getAttackRange() {
return config.getDouble("killer.attack-range", 3.0);
}
public int getPalletStunTicks() {
return (int) (config.getDouble("killer.pallet-stun-seconds", 2.5) * 20);
}
public int getPalletBreakTicks() {
return (int) (config.getDouble("killer.pallet-break-seconds", 3.0) * 20);
}
public int getTerrorRadius() {
return config.getInt("killer.terror-radius", 32);
}
public FileConfiguration getConfig() {
return config;
}
}