use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class CommandTogglePVP method commandCheck.
private boolean commandCheck(CommandSender sender, String[] args) {
if (args.length < 1) {
return false;
}
Player target = findTarget(sender, args[0]);
if (target == null) {
return true;
}
String targetName = target.getName();
LanguageManager languageManager = getLanguageManager();
NewbieHelperExpansion expansion = getExpansion();
ProtectionManager protectionManager = expansion.getProtectionManager();
PVPManager pvpManager = expansion.getPVPManager();
boolean targetProtected = protectionManager.isProtected(target);
boolean targetPvpStatus = !pvpManager.isDisabled(target);
String placeholderPath0 = ("placeholder.toggle.");
String placeholderPath1 = (placeholderPath0 + (targetProtected ? "enabled" : "disabled"));
String placeholderPath2 = (placeholderPath0 + (targetPvpStatus ? "enabled" : "disabled"));
String protectedString = languageManager.getMessage(sender, placeholderPath1, null, true);
String pvpStatusString = languageManager.getMessage(sender, placeholderPath2, null, true);
Replacer replacer = message -> message.replace("{target}", targetName).replace("{protected}", protectedString).replace("{pvp}", pvpStatusString);
sendMessageWithPrefix(sender, "expansion.newbie-helper.check-format", replacer, true);
return true;
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class CustomScoreboard method getLines.
private List<String> getLines() {
Player player = getPlayer();
LanguageManager languageManager = getLanguageManager();
String lines = languageManager.getMessage(player, "expansion.scoreboard.lines", null, true);
String[] split = lines.split("\n");
List<String> lineList = new ArrayList<>();
for (String line : split) {
String replaced = replacePlaceholders(line);
lineList.add(replaced);
}
return lineList;
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class CustomScoreboard method createObjective.
private void createObjective() {
Player player = getPlayer();
LanguageManager languageManager = getLanguageManager();
String title = languageManager.getMessage(player, "expansion.scoreboard.title", null, true);
String titleReplaced = replacePlaceholders(title);
ICombatLogX plugin = this.expansion.getPlugin();
MultiVersionHandler multiVersionHandler = plugin.getMultiVersionHandler();
ScoreboardHandler scoreboardHandler = multiVersionHandler.getScoreboardHandler();
Scoreboard scoreboard = getScoreboard();
this.objective = scoreboardHandler.createObjective(scoreboard, "combatlogx", "dummy", titleReplaced);
this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class CombatPlugin method broadcastEnableMessage.
private void broadcastEnableMessage() {
ConfigurationManager configurationManager = getConfigurationManager();
YamlConfiguration configuration = configurationManager.get("config.yml");
if (!configuration.getBoolean("broadcast.on-enable")) {
return;
}
LanguageManager languageManager = getLanguageManager();
languageManager.broadcastMessage("broadcast.on-enable", null, true);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class CombatPlugin method onLoad.
@Override
public void onLoad() {
ConfigurationChecker configurationChecker = new ConfigurationChecker(this);
configurationChecker.checkVersion();
ConfigurationManager configurationManager = getConfigurationManager();
configurationManager.saveDefault("config.yml");
configurationManager.saveDefault("commands.yml");
configurationManager.saveDefault("punish.yml");
LanguageManager languageManager = getLanguageManager();
languageManager.saveDefaultLanguages();
languageManager.reloadLanguages();
ExpansionManager expansionManager = getExpansionManager();
expansionManager.loadExpansions();
broadcastLoadMessage();
}
Aggregations