Search in sources :

Example 36 with ConfigurationManager

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

the class ListenerConfiguration method checkBypass.

private boolean checkBypass(Player player) {
    ConfigurationManager configurationManager = getPluginConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    String bypassPermissionName = configuration.getString("bypass-permission");
    if (bypassPermissionName == null || bypassPermissionName.isEmpty())
        return false;
    Permission bypassPermission = new Permission(bypassPermissionName, "CombatLogX Bypass Permission", PermissionDefault.FALSE);
    return player.hasPermission(bypassPermission);
}
Also used : Permission(org.bukkit.permissions.Permission) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 37 with ConfigurationManager

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

the class ListenerConfiguration method checkDisabledWorld.

private boolean checkDisabledWorld(Player player) {
    ConfigurationManager configurationManager = getPluginConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    List<String> disabledWorldList = configuration.getStringList("disabled-world-list");
    boolean inverted = configuration.getBoolean("disabled-world-list-inverted");
    World world = player.getWorld();
    String worldName = world.getName();
    boolean contains = disabledWorldList.contains(worldName);
    return (inverted != contains);
}
Also used : YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) World(org.bukkit.World) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 38 with ConfigurationManager

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

the class ListenerConfiguration method checkEnemyDeathUntag.

private void checkEnemyDeathUntag(LivingEntity enemy) {
    ConfigurationManager configurationManager = getPluginConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    if (!configuration.getBoolean("untag-on-enemy-death"))
        return;
    ICombatManager combatManager = getCombatManager();
    OfflinePlayer offlinePlayer = combatManager.getByEnemy(enemy);
    if (offlinePlayer == null || !offlinePlayer.isOnline())
        return;
    Player player = offlinePlayer.getPlayer();
    if (player != null && combatManager.isInCombat(player))
        combatManager.untag(player, UntagReason.ENEMY_DEATH);
}
Also used : Player(org.bukkit.entity.Player) OfflinePlayer(org.bukkit.OfflinePlayer) ICombatManager(com.github.sirblobman.combatlogx.api.manager.ICombatManager) OfflinePlayer(org.bukkit.OfflinePlayer) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 39 with ConfigurationManager

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

the class CombatPlugin method onLoad.

@Override
public void onLoad() {
    ConfigurationChecker configurationChecker = new ConfigurationChecker(this);
    configurationChecker.checkVersion();
    ConfigurationManager configurationManager = getConfigurationManager();
    configurationManager.saveDefault("config.yml");
    configurationManager.saveDefault("commands.yml");
    configurationManager.saveDefault("punish.yml");
    LanguageManager languageManager = getLanguageManager();
    languageManager.saveDefaultLanguages();
    languageManager.reloadLanguages();
    ExpansionManager expansionManager = getExpansionManager();
    expansionManager.loadExpansions();
    broadcastLoadMessage();
}
Also used : ConfigurationChecker(com.github.sirblobman.combatlogx.configuration.ConfigurationChecker) ExpansionManager(com.github.sirblobman.combatlogx.api.expansion.ExpansionManager) LanguageManager(com.github.sirblobman.api.language.LanguageManager) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager)

Example 40 with ConfigurationManager

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

the class RewardExpansion method useMVdWPlaceholderAPI.

public boolean useMVdWPlaceholderAPI() {
    ConfigurationManager configurationManager = getConfigurationManager();
    YamlConfiguration configuration = configurationManager.get("config.yml");
    boolean useMVdWPlaceholderAPI = configuration.getBoolean("hooks.mvdwplaceholderapi");
    if (useMVdWPlaceholderAPI) {
        PluginManager pluginManager = Bukkit.getPluginManager();
        return pluginManager.isPluginEnabled("MVdWPlaceholderAPI");
    }
    return false;
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) 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