Search in sources :

Example 1 with HeroParty

use of com.herocraftonline.heroes.characters.party.HeroParty in project MyPet by xXKeyleXx.

the class HeroesHook method canHurt.

@Override
public boolean canHurt(Player attacker, Player defender) {
    try {
        Hero heroAttacker = heroes.getCharacterManager().getHero(attacker);
        Hero heroDefender = heroes.getCharacterManager().getHero(defender);
        int attackerLevel = heroAttacker.getTieredLevel(false);
        int defenderLevel = heroDefender.getTieredLevel(false);
        if (Math.abs(attackerLevel - defenderLevel) > Heroes.properties.pvpLevelRange) {
            return false;
        }
        if ((defenderLevel < Heroes.properties.minPvpLevel) || (attackerLevel < Heroes.properties.minPvpLevel)) {
            return false;
        }
        HeroParty party = heroDefender.getParty();
        if ((party != null) && (party.isNoPvp()) && party.isPartyMember(heroAttacker)) {
            return false;
        }
    } catch (Throwable ignored) {
    }
    return true;
}
Also used : HeroParty(com.herocraftonline.heroes.characters.party.HeroParty) Hero(com.herocraftonline.heroes.characters.Hero)

Example 2 with HeroParty

use of com.herocraftonline.heroes.characters.party.HeroParty in project MagicPlugin by elBukkit.

the class HeroesManager method isInParty.

public boolean isInParty(Player source, Player check, boolean pvpCheck) {
    Hero sourceHero = getHero(source);
    Hero checkHero = getHero(check);
    if (sourceHero == null || checkHero == null)
        return false;
    HeroParty party = sourceHero.getParty();
    if (party == null || (pvpCheck && !party.isNoPvp()))
        return false;
    return party.getMembers().contains(checkHero);
}
Also used : HeroParty(com.herocraftonline.heroes.characters.party.HeroParty) Hero(com.herocraftonline.heroes.characters.Hero)

Aggregations

Hero (com.herocraftonline.heroes.characters.Hero)2 HeroParty (com.herocraftonline.heroes.characters.party.HeroParty)2