Search in sources :

Example 96 with ConfigurationManager

use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.

the class PVPManager method isDisabled.

public boolean isDisabled(Player player) {
    Validate.notNull(player, "player must not be null!");
    if (player.hasMetadata("NPC")) {
        return false;
    }
    ConfigurationManager configurationManager = this.expansion.getConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    boolean defaultPvpState = configuration.getBoolean("pvp-toggle-default-status", true);
    ICombatLogX plugin = this.expansion.getPlugin();
    PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
    YamlConfiguration playerData = playerDataManager.get(player);
    return !playerData.getBoolean("newbie-helper.pvp-toggle", defaultPvpState);
}
Also used : ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager) PlayerDataManager(com.github.sirblobman.api.configuration.PlayerDataManager)

Example 97 with ConfigurationManager

use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.

the class ListenerLogger method isDisabled.

private boolean isDisabled(String path) {
    Expansion expansion = getExpansion();
    ConfigurationManager configurationManager = expansion.getConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    return !configuration.getBoolean("log-options." + path);
}
Also used : YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) Expansion(com.github.sirblobman.combatlogx.api.expansion.Expansion) LoggerExpansion(combatlogx.expansion.logger.LoggerExpansion) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 98 with ConfigurationManager

use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.

the class ListenerLogger method getLogFileName.

private String getLogFileName() {
    Expansion expansion = getExpansion();
    ConfigurationManager configurationManager = expansion.getConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    String fileNameOption = configuration.getString("log-file-info.file-name");
    if (fileNameOption == null)
        fileNameOption = "logger";
    String fileExtraFormatOption = configuration.getString("log-file-info.file-extra.format");
    if (fileExtraFormatOption == null)
        fileExtraFormatOption = "yyyy.MM.dd";
    String fileExtensionOption = configuration.getString("log-file-info.file-extension");
    if (fileExtensionOption == null)
        fileExtensionOption = "log";
    SimpleDateFormat format = new SimpleDateFormat(fileExtraFormatOption);
    Date currentDate = new Date(System.currentTimeMillis());
    String fileNameExtra = format.format(currentDate);
    String preFileName = (fileNameOption + "-" + fileNameExtra + "." + fileExtensionOption);
    Matcher matcher = this.fileNameRegex.matcher(preFileName);
    return matcher.replaceAll("_");
}
Also used : Matcher(java.util.regex.Matcher) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) Expansion(com.github.sirblobman.combatlogx.api.expansion.Expansion) LoggerExpansion(combatlogx.expansion.logger.LoggerExpansion) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 99 with ConfigurationManager

use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.

the class VanishNoPacketExpansion method onLoad.

@Override
public void onLoad() {
    ConfigurationManager configurationManager = getConfigurationManager();
    configurationManager.saveDefault("config.yml");
}
Also used : ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 100 with ConfigurationManager

use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.

the class VanishNoPacketExpansion method reloadConfig.

@Override
public void reloadConfig() {
    ConfigurationManager configurationManager = getConfigurationManager();
    configurationManager.reload("config.yml");
}
Also used : ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Aggregations

ConfigurationManager (com.github.sirblobman.api.configuration.ConfigurationManager)117 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)62 Expansion (com.github.sirblobman.combatlogx.api.expansion.Expansion)20 ICombatLogX (com.github.sirblobman.combatlogx.api.ICombatLogX)10 PlayerDataManager (com.github.sirblobman.api.configuration.PlayerDataManager)6 LanguageManager (com.github.sirblobman.api.language.LanguageManager)6 Player (org.bukkit.entity.Player)6 EventHandler (org.bukkit.event.EventHandler)6 ICombatManager (com.github.sirblobman.combatlogx.api.manager.ICombatManager)5 Entity (org.bukkit.entity.Entity)4 LoggerExpansion (combatlogx.expansion.logger.LoggerExpansion)3 LivingEntity (org.bukkit.entity.LivingEntity)3 PluginManager (org.bukkit.plugin.PluginManager)3 ExpansionManager (com.github.sirblobman.combatlogx.api.expansion.ExpansionManager)2 IDeathListener (com.github.sirblobman.combatlogx.api.listener.IDeathListener)2 MobTaggerExpansion (combatlogx.expansion.mob.tagger.MobTaggerExpansion)2 ScoreboardExpansion (combatlogx.expansion.scoreboard.ScoreboardExpansion)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 UUID (java.util.UUID)2