Search in sources :

Example 21 with Expansion

use of com.github.sirblobman.combatlogx.api.expansion.Expansion in project CombatLogX by SirBlobman.

the class HookPlaceholderAPI method getNewbieHelperPVPStatus.

private String getNewbieHelperPVPStatus(Player player) {
    ICombatLogX plugin = this.expansion.getPlugin();
    LanguageManager languageManager = plugin.getLanguageManager();
    boolean pvp = true;
    Expansion expansion = getNewbieHelper();
    if (expansion != null) {
        NewbieHelperExpansion newbieHelperExpansion = (NewbieHelperExpansion) expansion;
        PVPManager pvpManager = newbieHelperExpansion.getPVPManager();
        pvp = !pvpManager.isDisabled(player);
    }
    String messagePath = ("placeholder.pvp-status." + (pvp ? "enabled" : "disabled"));
    return languageManager.getMessage(player, messagePath, null, true);
}
Also used : NewbieHelperExpansion(combatlogx.expansion.newbie.helper.NewbieHelperExpansion) PVPManager(combatlogx.expansion.newbie.helper.manager.PVPManager) LanguageManager(com.github.sirblobman.api.language.LanguageManager) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) NewbieHelperExpansion(combatlogx.expansion.newbie.helper.NewbieHelperExpansion) PlaceholderExpansion(me.clip.placeholderapi.expansion.PlaceholderExpansion) Expansion(com.github.sirblobman.combatlogx.api.expansion.Expansion)

Example 22 with Expansion

use of com.github.sirblobman.combatlogx.api.expansion.Expansion in project CombatLogX by SirBlobman.

the class HookPlaceholderAPI method getNewbieHelperProtected.

private String getNewbieHelperProtected(Player player) {
    boolean isProtected = false;
    Expansion expansion = getNewbieHelper();
    if (expansion != null) {
        NewbieHelperExpansion newbieHelperExpansion = (NewbieHelperExpansion) expansion;
        ProtectionManager protectionManager = newbieHelperExpansion.getProtectionManager();
        isProtected = protectionManager.isProtected(player);
    }
    return Boolean.toString(isProtected);
}
Also used : NewbieHelperExpansion(combatlogx.expansion.newbie.helper.NewbieHelperExpansion) ProtectionManager(combatlogx.expansion.newbie.helper.manager.ProtectionManager) NewbieHelperExpansion(combatlogx.expansion.newbie.helper.NewbieHelperExpansion) PlaceholderExpansion(me.clip.placeholderapi.expansion.PlaceholderExpansion) Expansion(com.github.sirblobman.combatlogx.api.expansion.Expansion)

Example 23 with Expansion

use of com.github.sirblobman.combatlogx.api.expansion.Expansion 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 24 with Expansion

use of com.github.sirblobman.combatlogx.api.expansion.Expansion 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 25 with Expansion

use of com.github.sirblobman.combatlogx.api.expansion.Expansion in project CombatLogX by SirBlobman.

the class ListenerLands method getNewbieHelperExpansion.

private NewbieHelperExpansion getNewbieHelperExpansion() {
    ICombatLogX combatLogX = getCombatLogX();
    ExpansionManager expansionManager = combatLogX.getExpansionManager();
    Optional<Expansion> optionalExpansion = expansionManager.getExpansion("NewbieHelper");
    if (!optionalExpansion.isPresent()) {
        throw new IllegalArgumentException("NewbieHelper expansion is missing.");
    }
    Expansion expansion = optionalExpansion.get();
    if (!(expansion instanceof NewbieHelperExpansion)) {
        throw new IllegalArgumentException("NewbieHelper expansion is not a proper instance.");
    }
    return (NewbieHelperExpansion) expansion;
}
Also used : NewbieHelperExpansion(combatlogx.expansion.newbie.helper.NewbieHelperExpansion) ExpansionManager(com.github.sirblobman.combatlogx.api.expansion.ExpansionManager) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) Expansion(com.github.sirblobman.combatlogx.api.expansion.Expansion) LandsExpansion(combatlogx.expansion.compatibility.region.lands.LandsExpansion) NewbieHelperExpansion(combatlogx.expansion.newbie.helper.NewbieHelperExpansion)

Aggregations

Expansion (com.github.sirblobman.combatlogx.api.expansion.Expansion)32 ConfigurationManager (com.github.sirblobman.api.configuration.ConfigurationManager)19 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)9 ICombatLogX (com.github.sirblobman.combatlogx.api.ICombatLogX)8 ExpansionManager (com.github.sirblobman.combatlogx.api.expansion.ExpansionManager)8 NewbieHelperExpansion (combatlogx.expansion.newbie.helper.NewbieHelperExpansion)7 LoggerExpansion (combatlogx.expansion.logger.LoggerExpansion)4 State (com.github.sirblobman.combatlogx.api.expansion.Expansion.State)3 PlaceholderExpansion (me.clip.placeholderapi.expansion.PlaceholderExpansion)3 LanguageManager (com.github.sirblobman.api.language.LanguageManager)2 RegionExpansion (com.github.sirblobman.combatlogx.api.expansion.region.RegionExpansion)2 MobTaggerExpansion (combatlogx.expansion.mob.tagger.MobTaggerExpansion)2 PVPManager (combatlogx.expansion.newbie.helper.manager.PVPManager)2 ProtectionManager (combatlogx.expansion.newbie.helper.manager.ProtectionManager)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 HashSet (java.util.HashSet)2 Replacer (com.github.sirblobman.api.language.Replacer)1 MessageUtility (com.github.sirblobman.api.utility.MessageUtility)1 CombatLogCommand (com.github.sirblobman.combatlogx.api.command.CombatLogCommand)1