Search in sources :

Example 1 with LanguageManager

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);
}
Also used : MultiVersionHandler(com.github.sirblobman.api.nms.MultiVersionHandler) LanguageManager(com.github.sirblobman.api.language.LanguageManager) CommandSender(org.bukkit.command.CommandSender) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) EntityHandler(com.github.sirblobman.api.nms.EntityHandler)

Example 2 with LanguageManager

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);
}
Also used : NewbieHelperExpansion(combatlogx.expansion.newbie.helper.NewbieHelperExpansion) PVPManager(combatlogx.expansion.newbie.helper.manager.PVPManager) LanguageManager(com.github.sirblobman.api.language.LanguageManager) ICombatLogX(com.github.sirblobman.combatlogx.api.ICombatLogX) NewbieHelperExpansion(combatlogx.expansion.newbie.helper.NewbieHelperExpansion) Expansion(com.github.sirblobman.combatlogx.api.expansion.Expansion)

Example 3 with LanguageManager

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);
}
Also used : Player(org.bukkit.entity.Player) LanguageManager(com.github.sirblobman.api.language.LanguageManager) YamlConfiguration(org.bukkit.configuration.file.YamlConfiguration) ConfigurationManager(com.github.sirblobman.api.configuration.ConfigurationManager) EventHandler(org.bukkit.event.EventHandler)

Example 4 with LanguageManager

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);
}
Also used : LanguageManager(com.github.sirblobman.api.language.LanguageManager) CommandSender(org.bukkit.command.CommandSender) UUID(java.util.UUID) EventHandler(org.bukkit.event.EventHandler)

Example 5 with LanguageManager

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;
    }
}
Also used : Player(org.bukkit.entity.Player) ICombatManager(com.github.sirblobman.combatlogx.api.manager.ICombatManager) LanguageManager(com.github.sirblobman.api.language.LanguageManager) IUser(net.ess3.api.IUser) CommandSource(com.earth2me.essentials.CommandSource) EventHandler(org.bukkit.event.EventHandler)

Aggregations

LanguageManager (com.github.sirblobman.api.language.LanguageManager)34 ICombatLogX (com.github.sirblobman.combatlogx.api.ICombatLogX)12 Player (org.bukkit.entity.Player)11 ConfigurationManager (com.github.sirblobman.api.configuration.ConfigurationManager)9 YamlConfiguration (org.bukkit.configuration.file.YamlConfiguration)9 ICombatManager (com.github.sirblobman.combatlogx.api.manager.ICombatManager)7 Replacer (com.github.sirblobman.api.language.Replacer)6 Collections (java.util.Collections)6 List (java.util.List)6 CommandSender (org.bukkit.command.CommandSender)6 NewbieHelperExpansion (combatlogx.expansion.newbie.helper.NewbieHelperExpansion)5 PVPManager (combatlogx.expansion.newbie.helper.manager.PVPManager)5 Set (java.util.Set)5 MultiVersionHandler (com.github.sirblobman.api.nms.MultiVersionHandler)4 DecimalFormat (java.text.DecimalFormat)4 ArrayList (java.util.ArrayList)4 Arrays (java.util.Arrays)4 Locale (java.util.Locale)4 UUID (java.util.UUID)4 EventHandler (org.bukkit.event.EventHandler)4