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);
}
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);
}
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);
}
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("_");
}
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;
}
Aggregations