Search in sources :

Example 6 with FPlayer

use of com.massivecraft.factions.FPlayer in project PvPManager by ChanceSD.

the class FactionsUUIDHook method canAttack.

@Override
public final boolean canAttack(final Player attacker, final Player defender) {
    final FPlayer fAttacker = FPlayers.getInstance().getByPlayer(attacker);
    final FPlayer fDefender = FPlayers.getInstance().getByPlayer(defender);
    return fAttacker.getRelationTo(fDefender).isAtMost(Relation.NEUTRAL);
}
Also used : FPlayer(com.massivecraft.factions.FPlayer)

Example 7 with FPlayer

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

the class PvPLogger method onPlayerDamage.

@EventHandler
public void onPlayerDamage(EntityDamageByEntityEvent e) {
    if (!(e.getEntity() instanceof Player && e.getDamager() instanceof Player))
        return;
    Player player = (Player) e.getEntity();
    Player damager = (Player) e.getDamager();
    if (HGuard.getByLocation(damager.getLocation()) != null)
        if (!HGuard.getByLocation(damager.getLocation()).isPvp())
            return;
    if (Histeria.isSaberFaction()) {
        FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
        FPlayer fdamager = FPlayers.getInstance().getByPlayer(damager);
        if (fplayer.getTag().equalsIgnoreCase(fdamager.getTag())) {
            if (!fplayer.getFaction().isWilderness()) {
                return;
            }
        }
    }
    CustomPlayer.getCustomPlayer(player.getName()).getPvp().setPvP();
    CustomPlayer.getCustomPlayer(damager.getName()).getPvp().setPvP();
}
Also used : FPlayer(com.massivecraft.factions.FPlayer) CustomPlayer(fr.zelytra.histeria.managers.player.CustomPlayer) Player(org.bukkit.entity.Player) FPlayer(com.massivecraft.factions.FPlayer) EventHandler(org.bukkit.event.EventHandler)

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