use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.
the class ListenerDeath method getRandomDeathMessage.
private String getRandomDeathMessage(Player player) {
ConfigurationManager configurationManager = getPluginConfigurationManager();
YamlConfiguration configuration = configurationManager.get("punish.yml");
List<String> customDeathMessageList = configuration.getStringList("custom-death-message-list");
if (customDeathMessageList.isEmpty()) {
return null;
}
ThreadLocalRandom random = ThreadLocalRandom.current();
int customDeathMessageListSize = customDeathMessageList.size();
int customDeathMessageIndex = random.nextInt(customDeathMessageListSize);
String customDeathMessage = customDeathMessageList.get(customDeathMessageIndex);
String playerName = player.getName();
return customDeathMessage.replace("{player}", playerName);
}
use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.
the class ListenerPunish method shouldPunishForReason.
private boolean shouldPunishForReason(UntagReason reason) {
ConfigurationManager configurationManager = getPluginConfigurationManager();
YamlConfiguration configuration = configurationManager.get("punish.yml");
if (reason.isExpire()) {
return configuration.getBoolean("on-expire");
}
if (reason == UntagReason.KICK) {
return configuration.getBoolean("on-kick");
}
if (reason == UntagReason.QUIT) {
return configuration.getBoolean("on-disconnect");
}
return false;
}
use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.
the class ListenerUntag method runUntagCommands.
private void runUntagCommands(Player player, LivingEntity previousEnemy) {
ConfigurationManager configurationManager = getPluginConfigurationManager();
YamlConfiguration configuration = configurationManager.get("commands.yml");
List<String> untagCommandList = configuration.getStringList("untag-command-list");
if (untagCommandList.isEmpty()) {
return;
}
ICombatLogX plugin = getCombatLogX();
ICombatManager combatManager = getCombatManager();
for (String untagCommand : untagCommandList) {
String replacedCommand = combatManager.replaceVariables(player, previousEnemy, untagCommand);
if (replacedCommand.startsWith("[PLAYER]")) {
String command = replacedCommand.substring("[PLAYER]".length());
CommandHelper.runAsPlayer(plugin, player, command);
continue;
}
if (replacedCommand.startsWith("[OP]")) {
String command = replacedCommand.substring("[OP]".length());
CommandHelper.runAsOperator(plugin, player, command);
continue;
}
CommandHelper.runAsConsole(plugin, replacedCommand);
}
}
use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.
the class ListenerUntag method isKickReasonIgnored.
private boolean isKickReasonIgnored(String kickReason) {
ICombatLogX plugin = getCombatLogX();
ConfigurationManager configurationManager = plugin.getConfigurationManager();
YamlConfiguration configuration = configurationManager.get("punish.yml");
List<String> kickIgnoreList = configuration.getStringList("kick-ignore-list");
if (kickIgnoreList.isEmpty()) {
return false;
}
for (String kickIgnoreMessage : kickIgnoreList) {
if (kickReason.contains(kickIgnoreMessage)) {
return true;
}
}
return false;
}
use of com.github.sirblobman.api.configuration.ConfigurationManager in project CombatLogX by SirBlobman.
the class CombatManager method getGlobalTimerSeconds.
private int getGlobalTimerSeconds() {
ConfigurationManager configurationManager = this.plugin.getConfigurationManager();
YamlConfiguration configuration = configurationManager.get("config.yml");
return configuration.getInt("timer.default-timer", 10);
}
Aggregations