use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class CombatListener 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.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class CombatLogCommand 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.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class CommandCombatLogXToggle method toggleValue.
private void toggleValue(Player player, String value) {
ICombatLogX plugin = getCombatLogX();
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
LanguageManager languageManager = getLanguageManager();
YamlConfiguration playerData = playerDataManager.get(player);
boolean currentValue = playerData.getBoolean(value, true);
playerData.set(value, !currentValue);
playerDataManager.save(player);
boolean status = playerData.getBoolean(value, true);
String statusPath = ("placeholder.toggle." + (status ? "enabled" : "disabled"));
String statusString = languageManager.getMessage(player, statusPath, null, true);
Replacer replacer = message -> message.replace("{status}", statusString);
String messagePath = ("command.combatlogx.toggle-" + value);
sendMessageWithPrefix(player, messagePath, replacer, true);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class ListenerDamage method getName.
private String getName(Entity entity) {
ICombatLogX plugin = getCombatLogX();
if (entity == null) {
CommandSender console = Bukkit.getConsoleSender();
LanguageManager languageManager = plugin.getLanguageManager();
return languageManager.getMessage(console, "placeholder.unknown-enemy", null, true);
}
MultiVersionHandler multiVersionHandler = plugin.getMultiVersionHandler();
EntityHandler entityHandler = multiVersionHandler.getEntityHandler();
return entityHandler.getName(entity);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class CombatManager method getEntityName.
private String getEntityName(Player player, LivingEntity entity) {
if (entity == null) {
LanguageManager languageManager = this.plugin.getLanguageManager();
return languageManager.getMessage(player, "placeholder.unknown-enemy", null, true);
}
MultiVersionHandler multiVersionHandler = this.plugin.getMultiVersionHandler();
EntityHandler entityHandler = multiVersionHandler.getEntityHandler();
return entityHandler.getName(entity);
}
Aggregations