Search in sources :

Example 1 with FPlayer

use of com.massivecraft.factions.FPlayer in project WildLoaders by BG-Software-LLC.

the class ClaimsProvider_FactionsUUID method hasClaimAccess.

@Override
public boolean hasClaimAccess(UUID player, Chunk chunk) {
    FPlayer fPlayer = FPlayers.getInstance().getById(player.toString());
    FLocation fLocation = new FLocation(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
    Faction faction = Board.getInstance().getFactionAt(fLocation);
    return !faction.isWilderness() && faction.getFPlayers().contains(fPlayer);
}
Also used : FPlayer(com.massivecraft.factions.FPlayer) FLocation(com.massivecraft.factions.FLocation) Faction(com.massivecraft.factions.Faction)

Example 2 with FPlayer

use of com.massivecraft.factions.FPlayer in project SilkSpawners by timbru31.

the class SilkSpawnersPlayerListener method checkIfFactionsPermitsBlockInteractions.

public boolean checkIfFactionsPermitsBlockInteractions(final Player player, final Block block) {
    if (plugin.config.getBoolean("factionsSupport", false) && su.isPluginEnabled("Factions")) {
        try {
            final MPlayer mp = MPlayer.get(player);
            final Faction blockFaction = BoardColl.get().getFactionAt(PS.valueOf(block.getLocation()));
            if (!blockFaction.isNone() && !mp.isInOwnTerritory()) {
                su.sendMessage(player, ChatColor.translateAlternateColorCodes('\u0026', plugin.localization.getString("changingDeniedFactions")));
                return false;
            }
        } catch (@SuppressWarnings("unused") final NoClassDefFoundError e) {
            // Try for legacy 1.6 factions, e.g. FactionsUUID
            final FPlayers fPlayers = FPlayers.getInstance();
            final FPlayer fPlayer = fPlayers.getByPlayer(player);
            final Board board = Board.getInstance();
            final com.massivecraft.factions.Faction blockFaction = board.getFactionAt(new FLocation(block.getLocation()));
            if (!blockFaction.isWilderness() && !fPlayer.isInOwnTerritory()) {
                su.sendMessage(player, ChatColor.translateAlternateColorCodes('\u0026', plugin.localization.getString("changingDeniedFactions")));
                return false;
            }
        }
    }
    return true;
}
Also used : FPlayer(com.massivecraft.factions.FPlayer) FPlayers(com.massivecraft.factions.FPlayers) Board(com.massivecraft.factions.Board) FLocation(com.massivecraft.factions.FLocation) MPlayer(com.massivecraft.factions.entity.MPlayer) Faction(com.massivecraft.factions.entity.Faction)

Example 3 with FPlayer

use of com.massivecraft.factions.FPlayer in project UltimateChat by FabioZumbi12.

the class UCSFactionsHook method formatFac.

@Override
public String formatFac(String text, Player sender, Object receiver) {
    FPlayer fp = FPlayers.getInstance().getByPlayer(sender);
    if (!fp.getFaction().isWilderness()) {
        Faction fac = fp.getFaction();
        text = text.replace("{fac-id}", fac.getId()).replace("{fac-name}", fac.getTag()).replace("{fac-description}", fac.getDescription());
        // Saber doesn't have MOTD support
        if (receiver instanceof Player) {
            FPlayer recmp = FPlayers.getInstance().getByPlayer((Player) receiver);
            text = text.replace("{fac-relation-name}", fac.getTag(recmp)).replace("{fac-relation-color}", fac.getColorTo(recmp).toString());
        }
    }
    return text;
}
Also used : FPlayer(com.massivecraft.factions.FPlayer) Player(org.bukkit.entity.Player) FPlayer(com.massivecraft.factions.FPlayer) Faction(com.massivecraft.factions.Faction)

Example 4 with FPlayer

use of com.massivecraft.factions.FPlayer in project Histeria by zelytra.

the class ChatListener method onPlayerChat.

@EventHandler
public void onPlayerChat(AsyncChatEvent e) {
    e.setCancelled(true);
    if (CustomPlayer.getCustomPlayer(e.getPlayer().getName()).isMute()) {
        Mute mute = CustomPlayer.getCustomPlayer(e.getPlayer().getName()).getMute();
        LangMessage.sendMessage(e.getPlayer(), Message.HISTBAN.getMsg() + "§c", "command.playerMute", "§c " + mute.getReason());
        return;
    }
    if (PlainComponentSerializer.plain().serialize(e.message()).startsWith("!") && Utils.canByPass(e.getPlayer())) {
        for (Player player : Bukkit.getOnlinePlayers()) if (Utils.canByPass(player))
            player.sendMessage("§6[§eSTAFF§6] §e" + e.getPlayer().getName() + "§6 > §f" + PlainComponentSerializer.plain().serialize(e.message()).substring(1));
        Histeria.log("§6[§eSTAFF§6] §e" + e.getPlayer().getName() + "§6 > §f" + PlainComponentSerializer.plain().serialize(e.message()).substring(1), LogType.INFO);
        return;
    }
    if (Histeria.isSaberFaction()) {
        FPlayer fplayer = FPlayers.getInstance().getByPlayer(e.getPlayer());
        if (fplayer.getChatMode() == ChatMode.ALLIANCE || fplayer.getChatMode() == ChatMode.FACTION) {
            new DiscordLog(WebHookType.CHAT, fplayer.getChatMode().name() + " " + e.getPlayer().getName() + " > " + PlainComponentSerializer.plain().serialize(e.message()));
            return;
        }
    }
    ChatManager chatManager = new ChatManager(e.getPlayer(), PlainComponentSerializer.plain().serialize(e.message()));
    Bukkit.broadcast(chatManager.getProcessMessage());
    new DiscordLog(WebHookType.CHAT, e.getPlayer().getName() + " > " + PlainComponentSerializer.plain().serialize(e.message()));
}
Also used : FPlayer(com.massivecraft.factions.FPlayer) CustomPlayer(fr.zelytra.histeria.managers.player.CustomPlayer) Player(org.bukkit.entity.Player) FPlayer(com.massivecraft.factions.FPlayer) DiscordLog(fr.zelytra.histeria.managers.logs.discord.DiscordLog) Mute(fr.zelytra.histeria.commands.moderation.Mute.Mute) EventHandler(org.bukkit.event.EventHandler)

Example 5 with FPlayer

use of com.massivecraft.factions.FPlayer in project Histeria by zelytra.

the class ChatManager method getProcessMessage.

public TextComponent getProcessMessage() {
    GroupFX groupFX = GroupFX.getByName(this.group);
    TextComponent.Builder processMessage;
    processMessage = Component.text().content(groupFX.getBadge().toString() + " ").color(NamedTextColor.WHITE);
    if (Histeria.isSaberFaction()) {
        FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
        processMessage.append(Component.text().content("§7[" + (fplayer.getFaction().getTag().equalsIgnoreCase("§2wilderness") ? "" : fplayer.getFaction().getTag()) + "] "));
    }
    processMessage.append(Component.text().content(player.getName()).color(groupFX.getNameColor())).append(Component.text().content(groupFX.getSplitter()).color(groupFX.getSplittercolor()));
    if (canUseEmote)
        processMessage = processEmote(processMessage);
    else
        for (String word : message.split(" ")) processMessage.append(Component.text().content(word + " ").color(groupFX.getMessageColor()));
    return processMessage.build();
}
Also used : TextComponent(net.kyori.adventure.text.TextComponent) FPlayer(com.massivecraft.factions.FPlayer)

Aggregations

FPlayer (com.massivecraft.factions.FPlayer)7 Player (org.bukkit.entity.Player)3 FLocation (com.massivecraft.factions.FLocation)2 Faction (com.massivecraft.factions.Faction)2 CustomPlayer (fr.zelytra.histeria.managers.player.CustomPlayer)2 EventHandler (org.bukkit.event.EventHandler)2 Board (com.massivecraft.factions.Board)1 FPlayers (com.massivecraft.factions.FPlayers)1 Faction (com.massivecraft.factions.entity.Faction)1 MPlayer (com.massivecraft.factions.entity.MPlayer)1 Mute (fr.zelytra.histeria.commands.moderation.Mute.Mute)1 DiscordLog (fr.zelytra.histeria.managers.logs.discord.DiscordLog)1 TextComponent (net.kyori.adventure.text.TextComponent)1