Delete src/main/java/de/lasertag/config/ConfigManager.java via Git Manager GUI
This commit is contained in:
@@ -1,178 +0,0 @@
|
||||
package de.lasertag.config;
|
||||
|
||||
import de.lasertag.LasertagPlugin;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
/**
|
||||
* Zentraler Zugriffspunkt für alle config.yml-Werte.
|
||||
* Alle Getter lesen live aus dem Config-Objekt → /ltadmin reload wirkt sofort.
|
||||
*/
|
||||
public class ConfigManager {
|
||||
|
||||
private final LasertagPlugin plugin;
|
||||
|
||||
public ConfigManager(LasertagPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.saveDefaultConfig();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
plugin.reloadConfig();
|
||||
}
|
||||
|
||||
// ── Allgemein ─────────────────────────────────────────────────────────────
|
||||
|
||||
public String getPrefix() {
|
||||
return c().getString("messages.prefix", "§8[§b§lLASERTAG§8] §r");
|
||||
}
|
||||
|
||||
public Location getLobbyLocation() {
|
||||
return (Location) c().get("lobby.location");
|
||||
}
|
||||
|
||||
public void setLobbyLocation(Location loc) {
|
||||
c().set("lobby.location", loc);
|
||||
plugin.saveConfig();
|
||||
}
|
||||
|
||||
// ── Spiel-Grundeinstellungen ──────────────────────────────────────────────
|
||||
|
||||
public int getGameDuration() { return c().getInt("game.game-duration", 300); }
|
||||
public int getCountdown() { return c().getInt("game.countdown", 10); }
|
||||
public int getMinPlayers() { return c().getInt("game.min-players", 2); }
|
||||
public int getMaxPlayersPerTeam() { return c().getInt("game.max-players-per-team", 4); }
|
||||
public int getEndDisplayTime() { return c().getInt("game.end-display-time", 8); }
|
||||
|
||||
// ── Heal / Hit-Mechanik ───────────────────────────────────────────────────
|
||||
|
||||
public int getBaseHealTime() { return c().getInt("heal.base-heal-time", 2); }
|
||||
public double getBaseRadius() { return c().getDouble("heal.base-radius", 4.0); }
|
||||
public boolean isInvincibleAfterHeal() { return c().getBoolean("heal.invincible-after-heal", true); }
|
||||
public int getInvincibleDuration() { return c().getInt("heal.invincible-duration", 60); }
|
||||
|
||||
// ── Punkte-System ─────────────────────────────────────────────────────────
|
||||
|
||||
public int getKillPoints() { return c().getInt("scoring.kill-points", 100); }
|
||||
public int getBaseAttackPoints() { return c().getInt("scoring.base-attack-points", 60); }
|
||||
public int getBaseDestroyBonus() { return c().getInt("scoring.base-destroy-bonus", 200); }
|
||||
public int getStreak3Bonus() { return c().getInt("scoring.streak-3-bonus", 50); }
|
||||
public int getStreak5Bonus() { return c().getInt("scoring.streak-5-bonus", 100); }
|
||||
public int getStreak10Bonus() { return c().getInt("scoring.streak-10-bonus", 250); }
|
||||
|
||||
// ── Basen ─────────────────────────────────────────────────────────────────
|
||||
|
||||
public int getBaseHealth() { return c().getInt("base.health", 5); }
|
||||
public int getBaseWarnHp() { return c().getInt("base.warn-at-hp", 2); }
|
||||
public boolean isBaseRegenerate() { return c().getBoolean("base.regenerate", false); }
|
||||
public int getBaseRegenInterval() { return c().getInt("base.regenerate-interval", 60); }
|
||||
|
||||
// ── Anti-Camp ─────────────────────────────────────────────────────────────
|
||||
|
||||
public boolean isAntiCampEnabled() { return c().getBoolean("anti-camp.enabled", true); }
|
||||
public int getCampMaxIdleSecs() { return c().getInt("anti-camp.max-idle-seconds", 15); }
|
||||
public double getCampIdleRadius() { return c().getDouble("anti-camp.idle-radius", 5.0); }
|
||||
public String getCampAction() { return c().getString("anti-camp.action", "WARN_THEN_PUNISH"); }
|
||||
public String getCampWarnMsg() { return c().getString("anti-camp.warn-message", "§c⚠ CAMPEN VERBOTEN!"); }
|
||||
public int getCampScorePenalty() { return c().getInt("anti-camp.score-penalty", 10); }
|
||||
public int getCampWarnDuration() { return c().getInt("anti-camp.warn-duration", 5); }
|
||||
public double getCampExcludeRadius() { return c().getDouble("anti-camp.exclude-base-radius", 8.0); }
|
||||
|
||||
public Sound getCampWarnSound() {
|
||||
try { return Sound.valueOf(c().getString("anti-camp.warn-sound", "BLOCK_NOTE_BLOCK_BASS")); }
|
||||
catch (Exception e) { return Sound.BLOCK_NOTE_BLOCK_BASS; }
|
||||
}
|
||||
public float getCampWarnSoundPitch() { return (float) c().getDouble("anti-camp.warn-sound-pitch", 0.5); }
|
||||
|
||||
// ── Mod-Schutz ────────────────────────────────────────────────────────────
|
||||
|
||||
public boolean isModProtectionEnabled() { return c().getBoolean("mod-protection.enabled", true); }
|
||||
public boolean isFogOfWarEnabled() { return c().getBoolean("mod-protection.fog-of-war", true); }
|
||||
public int getFogRadius() { return c().getInt("mod-protection.fog-radius", 48); }
|
||||
public boolean isArenaBarrierEnabled() { return c().getBoolean("mod-protection.arena-barrier", true); }
|
||||
public boolean isHideCoordinates() { return c().getBoolean("mod-protection.hide-coordinates",true); }
|
||||
public boolean isHideFromTab() { return c().getBoolean("mod-protection.hide-from-tab", true); }
|
||||
public boolean isHideNametags() { return c().getBoolean("mod-protection.hide-nametags", true); }
|
||||
public boolean isStrictInvisibility() { return c().getBoolean("mod-protection.strict-invisibility", true); }
|
||||
|
||||
// ── Join-Schild ───────────────────────────────────────────────────────────
|
||||
|
||||
public String getSignTriggerLine() { return c().getString("join-sign.trigger-line", "[Lasertag]"); }
|
||||
public String getSignColorWaiting() { return c().getString("join-sign.color-waiting", "§a"); }
|
||||
public String getSignColorStarting(){ return c().getString("join-sign.color-starting","§e"); }
|
||||
public String getSignColorRunning() { return c().getString("join-sign.color-running", "§c"); }
|
||||
public String getSignColorFull() { return c().getString("join-sign.color-full", "§8"); }
|
||||
public int getSignUpdateInterval(){ return c().getInt("join-sign.update-interval", 20); }
|
||||
|
||||
// ── Waffen (dynamisch aus config lesen) ───────────────────────────────────
|
||||
|
||||
public int getWeaponDamage(String key) { return c().getInt("weapons." + key + ".damage", 25); }
|
||||
public int getWeaponRange(String key) { return c().getInt("weapons." + key + ".range", 30); }
|
||||
public int getWeaponCooldown(String key) { return c().getInt("weapons." + key + ".cooldown-ms", 300); }
|
||||
public int getWeaponPellets(String key) { return c().getInt("weapons." + key + ".pellets", 1); }
|
||||
public String getWeaponName(String key) { return c().getString("weapons." + key + ".display-name", "§fWaffe"); }
|
||||
public boolean isWeaponEnabled(String key) { return c().getBoolean("weapons." + key + ".enabled", true); }
|
||||
public String getWeaponDesc(String key) { return c().getString("weapons." + key + ".description", ""); }
|
||||
|
||||
public Particle getWeaponParticle(String key) {
|
||||
try { return Particle.valueOf(c().getString("weapons." + key + ".particle", "CRIT")); }
|
||||
catch (Exception e) { return Particle.CRIT; }
|
||||
}
|
||||
|
||||
// ── Sounds ────────────────────────────────────────────────────────────────
|
||||
|
||||
public boolean isSoundsEnabled() { return c().getBoolean("sounds.enabled", true); }
|
||||
|
||||
public Sound getSound(String key, Sound fallback) {
|
||||
if (!isSoundsEnabled()) return null;
|
||||
try { return Sound.valueOf(c().getString("sounds." + key, fallback.name())); }
|
||||
catch (Exception e) { return fallback; }
|
||||
}
|
||||
|
||||
public float getSoundPitch(String key, float fallback) {
|
||||
return (float) c().getDouble("sounds." + key, fallback);
|
||||
}
|
||||
|
||||
public float getSoundVolume(String key, float fallback) {
|
||||
return (float) c().getDouble("sounds." + key, fallback);
|
||||
}
|
||||
|
||||
// ── Partikel ──────────────────────────────────────────────────────────────
|
||||
|
||||
public boolean isParticlesEnabled() { return c().getBoolean("particles.enabled", true); }
|
||||
public boolean isLaserTrailEnabled() { return c().getBoolean("particles.laser-trail", true); }
|
||||
public boolean isHitEffectEnabled() { return c().getBoolean("particles.hit-effect", true); }
|
||||
public int getHitParticleCount() { return c().getInt("particles.hit-particle-count", 15); }
|
||||
public boolean isHealEffectEnabled() { return c().getBoolean("particles.heal-effect", true); }
|
||||
|
||||
// ── Scoreboard ────────────────────────────────────────────────────────────
|
||||
|
||||
public boolean isScoreboardEnabled() { return c().getBoolean("scoreboard.enabled", true); }
|
||||
public String getScoreboardTitle() { return c().getString("scoreboard.title", "§b§l⚡ LASERTAG"); }
|
||||
public boolean showTeamScores() { return c().getBoolean("scoreboard.show-team-scores", true); }
|
||||
public boolean showBaseHealth() { return c().getBoolean("scoreboard.show-base-health", true); }
|
||||
public boolean showKillStreak() { return c().getBoolean("scoreboard.show-kill-streak", true); }
|
||||
public int getScoreboardInterval() { return c().getInt("scoreboard.update-interval", 20); }
|
||||
|
||||
// ── Texte / Nachrichten ───────────────────────────────────────────────────
|
||||
|
||||
public String getText(String key, String fallback) {
|
||||
return getPrefix() + c().getString("text." + key, fallback);
|
||||
}
|
||||
|
||||
/** Ersetzt Platzhalter wie {player}, {team}, {pts} etc. */
|
||||
public String getText(String key, String fallback, Object... replacements) {
|
||||
String s = getText(key, fallback);
|
||||
for (int i = 0; i + 1 < replacements.length; i += 2) {
|
||||
s = s.replace("{" + replacements[i] + "}", String.valueOf(replacements[i + 1]));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
// ── Intern ───────────────────────────────────────────────────────────────
|
||||
|
||||
private org.bukkit.configuration.file.FileConfiguration c() {
|
||||
return plugin.getConfig();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user