use of com.github.sirblobman.api.language.Replacer in project CombatLogX by SirBlobman.
the class CommandTogglePVP method sendAdminToggleMessage.
private void sendAdminToggleMessage(CommandSender sender, Player target) {
LanguageManager languageManager = getLanguageManager();
PVPManager pvpManager = this.expansion.getPVPManager();
boolean pvpEnabled = !pvpManager.isDisabled(target);
String targetName = target.getName();
String pvpStatus = languageManager.getMessage(sender, "placeholder.toggle." + (pvpEnabled ? "enabled" : "disabled"), null, true);
Replacer replacer = message -> message.replace("{target}", targetName).replace("{status}", pvpStatus);
sendMessageWithPrefix(sender, "expansion.newbie-helper.togglepvp.admin", replacer, true);
}
use of com.github.sirblobman.api.language.Replacer in project CombatLogX by SirBlobman.
the class CommandTogglePVP method sendCooldownMessage.
private void sendCooldownMessage(Player player) {
if (!hasCooldown(player)) {
return;
}
long expireMillis = getCooldownExpireMillis(player);
long systemTimeMillis = System.currentTimeMillis();
long subtractMillis = (expireMillis - systemTimeMillis);
long subtractSeconds = TimeUnit.MILLISECONDS.toSeconds(subtractMillis);
String timeLeftString = Long.toString(subtractSeconds);
Replacer replacer = message -> message.replace("{time_left}", timeLeftString);
sendMessageWithPrefix(player, "expansion.newbie-helper.togglepvp.cooldown", replacer, true);
}
use of com.github.sirblobman.api.language.Replacer in project CombatLogX by SirBlobman.
the class CommandTogglePVP method sendToggleMessage.
private void sendToggleMessage(Player player) {
LanguageManager languageManager = getLanguageManager();
PVPManager pvpManager = this.expansion.getPVPManager();
boolean pvpEnabled = !pvpManager.isDisabled(player);
String pvpStatus = languageManager.getMessage(player, "placeholder.toggle." + (pvpEnabled ? "enabled" : "disabled"), null, true);
Replacer replacer = message -> message.replace("{status}", pvpStatus);
sendMessageWithPrefix(player, "expansion.newbie-helper.togglepvp.self", replacer, true);
}
use of com.github.sirblobman.api.language.Replacer 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.Replacer in project CombatLogX by SirBlobman.
the class CommandCombatTimer method checkSelf.
private void checkSelf(Player player) {
ICombatLogX plugin = getCombatLogX();
ICombatManager combatManager = plugin.getCombatManager();
LanguageManager languageManager = getLanguageManager();
if (combatManager.isInCombat(player)) {
double timeLeftMillis = combatManager.getTimerLeftMillis(player);
double timeLeftSeconds = (timeLeftMillis / 1_000.0D);
String decimalFormatString = languageManager.getMessage(player, "decimal-format", null, false);
DecimalFormat decimalFormat = new DecimalFormat(decimalFormatString);
String timeLeftString = decimalFormat.format(timeLeftSeconds);
Replacer replacer = message -> message.replace("{time_left}", timeLeftString);
sendMessageWithPrefix(player, "command.combat-timer.time-left-self", replacer, true);
return;
}
sendMessageWithPrefix(player, "error.self-not-in-combat", null, true);
}
Aggregations