use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class CombatListener method isWorldDisabled.
protected final boolean isWorldDisabled(World world) {
ICombatLogX plugin = getCombatLogX();
ConfigurationManager configurationManager = plugin.getConfigurationManager();
YamlConfiguration configuration = configurationManager.get("config.yml");
List<String> disabledWorldList = configuration.getStringList("disabled-world-list");
boolean inverted = configuration.getBoolean("disabled-world-list-inverted");
String worldName = world.getName();
boolean contains = disabledWorldList.contains(worldName);
return (inverted != contains);
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class CombatLogCommand method isWorldDisabled.
protected final boolean isWorldDisabled(World world) {
ICombatLogX plugin = getCombatLogX();
ConfigurationManager configurationManager = plugin.getConfigurationManager();
YamlConfiguration configuration = configurationManager.get("config.yml");
List<String> disabledWorldList = configuration.getStringList("disabled-world-list");
boolean inverted = configuration.getBoolean("disabled-world-list-inverted");
String worldName = world.getName();
boolean contains = disabledWorldList.contains(worldName);
return (inverted != contains);
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class CombatLogPlayerCommand method getMessageWithPrefix.
protected final String getMessageWithPrefix(@Nullable CommandSender sender, @NotNull String key, @Nullable Replacer replacer, boolean color) {
ICombatLogX plugin = getCombatLogX();
LanguageManager languageManager = plugin.getLanguageManager();
String message = languageManager.getMessage(sender, key, replacer, color);
if (message.isEmpty())
return "";
String prefix = languageManager.getMessage(sender, "prefix", null, true);
return (prefix.isEmpty() ? message : String.format(Locale.US, "%s %s", prefix, message));
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class ActionBarUpdater method getPlayerHandler.
private PlayerHandler getPlayerHandler() {
ICombatLogX combatLogX = getCombatLogX();
MultiVersionHandler multiVersionHandler = combatLogX.getMultiVersionHandler();
return multiVersionHandler.getPlayerHandler();
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class ActionBarUpdater method getBars.
private String getBars(Player player, long timeLeftMillis) {
ConfigurationManager configurationManager = this.expansion.getConfigurationManager();
YamlConfiguration configuration = configurationManager.get("config.yml");
int scale = configuration.getInt("scale");
String leftColorString = configuration.getString("left-color", "GREEN");
String leftSymbol = configuration.getString("left-symbol", "|");
String rightColorString = configuration.getString("right-color", "RED");
String rightSymbol = configuration.getString("right-symbol", "|");
ChatColor leftColor = getChatColor(leftColorString);
ChatColor rightColor = getChatColor(rightColorString);
ICombatLogX plugin = getCombatLogX();
ICombatManager combatManager = plugin.getCombatManager();
double timerMaxMillis = (combatManager.getMaxTimerSeconds(player) * 1_000L);
double progressPercent = ((double) timeLeftMillis / timerMaxMillis);
long leftBarsCount = Math.round(scale * progressPercent);
long rightBarsCount = (scale - leftBarsCount);
StringBuilder builder = new StringBuilder();
builder.append(leftColor);
for (long i = 0; i < leftBarsCount; i++) {
builder.append(leftSymbol);
}
builder.append(rightColor);
for (long i = 0; i < rightBarsCount; i++) {
builder.append(rightSymbol);
}
String barsString = builder.toString();
return MessageUtility.color(barsString);
}
Aggregations