use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class CommandCombatTimer method checkOther.
private void checkOther(Player player, Player target) {
ICombatLogX plugin = getCombatLogX();
ICombatManager combatManager = plugin.getCombatManager();
LanguageManager languageManager = getLanguageManager();
if (combatManager.isInCombat(target)) {
double timeLeftMillis = combatManager.getTimerLeftMillis(target);
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-other", replacer, true);
return;
}
sendMessageWithPrefix(player, "error.target-not-in-combat", null, true);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class HookPlaceholderAPI method getNewbieHelperPVPStatus.
private String getNewbieHelperPVPStatus(Player player) {
ICombatLogX plugin = this.expansion.getPlugin();
LanguageManager languageManager = plugin.getLanguageManager();
boolean pvp = true;
Expansion expansion = getNewbieHelper();
if (expansion != null) {
NewbieHelperExpansion newbieHelperExpansion = (NewbieHelperExpansion) expansion;
PVPManager pvpManager = newbieHelperExpansion.getPVPManager();
pvp = !pvpManager.isDisabled(player);
}
String messagePath = ("placeholder.pvp-status." + (pvp ? "enabled" : "disabled"));
return languageManager.getMessage(player, messagePath, null, true);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class ProtectionStonesListener method onCreateRegion.
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onCreateRegion(PSCreateEvent e) {
Player player = e.getPlayer();
if (!isInCombat(player))
return;
e.setCancelled(true);
LanguageManager languageManager = getLanguageManager();
languageManager.sendMessage(player, "expansion.region-protection.protectionstones.prevent-area-creation", null, true);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class ProtectionManager method isProtected.
public boolean isProtected(Player player) {
Validate.notNull(player, "player must not be null!");
if (player.hasMetadata("NPC")) {
return false;
}
ICombatLogX plugin = this.expansion.getPlugin();
PlayerDataManager playerDataManager = plugin.getPlayerDataManager();
YamlConfiguration configuration = playerDataManager.get(player);
if (!configuration.getBoolean("newbie-helper.protected")) {
return false;
}
long expireTime = configuration.getLong("newbie-helper.protection-expire-time", 0L);
long systemTime = System.currentTimeMillis();
if (systemTime < expireTime) {
return true;
}
setProtected(player, false);
LanguageManager languageManager = this.expansion.getPlugin().getLanguageManager();
languageManager.sendMessage(player, "expansion.newbie-helper.protection-disabled.expired", null, true);
return false;
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class ListenerLands method disableNewbieProtection.
private void disableNewbieProtection(Player player) {
NewbieHelperExpansion newbieHelperExpansion = getNewbieHelperExpansion();
ProtectionManager protectionManager = newbieHelperExpansion.getProtectionManager();
PVPManager pvpManager = newbieHelperExpansion.getPVPManager();
if (protectionManager.isProtected(player) || pvpManager.isDisabled(player)) {
protectionManager.setProtected(player, false);
pvpManager.setPVP(player, true);
LanguageManager languageManager = getLanguageManager();
languageManager.sendMessage(player, "expansion.region-protection.lands.war-disable-newbie-protection", null, true);
}
}
Aggregations