use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class ListenerLogger method getEntityName.
private String getEntityName(Entity entity) {
if (entity == null) {
CommandSender console = Bukkit.getConsoleSender();
LanguageManager languageManager = getLanguageManager();
return languageManager.getMessage(console, "placeholder.unknown-enemy", null, true);
}
ICombatLogX combatLogX = getCombatLogX();
MultiVersionHandler multiVersionHandler = combatLogX.getMultiVersionHandler();
EntityHandler entityHandler = multiVersionHandler.getEntityHandler();
return entityHandler.getName(entity);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class HookMVdWPlaceholderAPI 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 ListenerPreciousStones method beforeFieldCreation.
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void beforeFieldCreation(FieldPreCreationEvent e) {
Player player = e.getPlayer();
if (!isInCombat(player))
return;
ConfigurationManager configurationManager = getExpansionConfigurationManager();
YamlConfiguration configuration = configurationManager.get("config.yml");
if (!configuration.getBoolean("prevent-field-creation"))
return;
e.setCancelled(true);
LanguageManager languageManager = getLanguageManager();
languageManager.sendMessage(player, "expansion.region-protection.preciousstones.prevent-field-creation", null, true);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class ListenerJoin method beforeLogin.
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void beforeLogin(AsyncPlayerPreLoginEvent e) {
printDebug("Detected AsyncPlayerPreLoginEvent...");
UUID uuid = e.getUniqueId();
printDebug("Checking if player with uuid=" + uuid + " can login...");
if (shouldAllowLogin(uuid)) {
printDebug("Login allowed, ignoring event.");
return;
}
CommandSender console = Bukkit.getConsoleSender();
LanguageManager languageManager = getLanguageManager();
String npcMessage = languageManager.getMessage(console, "expansion.citizens-compatibility.prevent-join", null, true);
e.disallow(Result.KICK_OTHER, npcMessage);
}
use of com.github.sirblobman.api.language.LanguageManager in project CombatLogX by SirBlobman.
the class ListenerEssentials method onTeleportRequest.
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onTeleportRequest(TPARequestEvent e) {
if (isTeleportRequestEnabled())
return;
ICombatManager combatManager = getCombatManager();
LanguageManager languageManager = getLanguageManager();
CommandSource requester = e.getRequester();
Player player = requester.getPlayer();
if (player == null)
return;
if (combatManager.isInCombat(player)) {
sendMessageWithPrefix(player, "expansion.essentials-compatibility.prevent-teleport-request-self", null, true);
e.setCancelled(true);
return;
}
IUser targetUser = e.getTarget();
Player target = targetUser.getBase();
if (target == null)
return;
if (combatManager.isInCombat(target)) {
sendMessageWithPrefix(player, "expansion.essentials-compatibility.prevent-teleport-request-other", null, true);
e.setCancelled(true);
// return;
}
}
Aggregations