101 lines
2.7 KiB
Java
101 lines
2.7 KiB
Java
package com.smartcraft.notifier.config;
|
|
|
|
import org.bukkit.configuration.file.FileConfiguration;
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
import java.io.File;
|
|
|
|
public class ConfigManager {
|
|
|
|
private final Plugin plugin;
|
|
private final FileConfiguration config;
|
|
private FileConfiguration messageConfig;
|
|
|
|
public ConfigManager(Plugin plugin) {
|
|
this.plugin = plugin;
|
|
this.config = plugin.getConfig();
|
|
loadMessages();
|
|
}
|
|
|
|
private void loadMessages() {
|
|
File messageFile = new File(plugin.getDataFolder(), "messages.yml");
|
|
if (!messageFile.exists()) {
|
|
plugin.saveResource("messages.yml", false);
|
|
}
|
|
this.messageConfig = YamlConfiguration.loadConfiguration(messageFile);
|
|
}
|
|
|
|
// 🧠 Global settings
|
|
public boolean isDebugMode() {
|
|
return config.getBoolean("debug", false);
|
|
}
|
|
|
|
public boolean isBungeeCordEnabled() {
|
|
return config.getBoolean("bungeecord.enabled", false);
|
|
}
|
|
|
|
// ✅ Gotify settings
|
|
public boolean isGotifyEnabled() {
|
|
return config.getBoolean("gotify.enabled", false);
|
|
}
|
|
|
|
public String getGotifyUrl() {
|
|
return config.getString("gotify.serverUrl", "NOT SET");
|
|
}
|
|
|
|
public String getGotifyToken() {
|
|
return config.getString("gotify.appToken", "");
|
|
}
|
|
|
|
public int getDefaultPriority() {
|
|
return config.getInt("gotify.defaultPriority", 1);
|
|
}
|
|
|
|
// 📢 Core Event toggles
|
|
public boolean logJoins() {
|
|
return config.getBoolean("events.logJoins", true);
|
|
}
|
|
|
|
public boolean logLeaves() {
|
|
return config.getBoolean("events.logLeaves", true);
|
|
}
|
|
|
|
public boolean logAdvancements() {
|
|
return config.getBoolean("events.logAdvancements", true);
|
|
}
|
|
|
|
public boolean logServerSwitches() {
|
|
return config.getBoolean("events.logServerSwitch", false);
|
|
}
|
|
|
|
public String getEventMessage(String key) {
|
|
return messageConfig.getString("events." + key, "{player} triggered " + key);
|
|
}
|
|
|
|
// 🔨 LiteBans Integration
|
|
public boolean isLiteBansEnabled() {
|
|
return config.getBoolean("litebans.enabled", false);
|
|
}
|
|
|
|
public boolean logBans() {
|
|
return config.getBoolean("litebans.logBans", true);
|
|
}
|
|
|
|
public boolean logMutes() {
|
|
return config.getBoolean("litebans.logMutes", true);
|
|
}
|
|
|
|
public boolean logKicks() {
|
|
return config.getBoolean("litebans.logKicks", true);
|
|
}
|
|
|
|
public boolean logWarns() {
|
|
return config.getBoolean("litebans.logWarns", true);
|
|
}
|
|
|
|
public String getLiteBansMessage(String type) {
|
|
return messageConfig.getString("litebans." + type,
|
|
"🔔 {player} received a " + type + ": {reason}");
|
|
}
|
|
} |