use of com.herocraftonline.heroes.characters.Hero 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;
}
use of com.herocraftonline.heroes.characters.Hero in project MagicPlugin by elBukkit.
the class HeroesManager method getSkillList.
public List<String> getSkillList(Player player, boolean showUnuseable, boolean showPassive) {
if (skills == null)
return emptySkillList;
Hero hero = getHero(player);
if (hero == null)
return emptySkillList;
HeroClass heroClass = hero.getHeroClass();
HeroClass secondClass = hero.getSecondClass();
Set<String> primarySkills = new HashSet<>();
Set<String> secondarySkills = new HashSet<>();
addSkills(hero, heroClass, primarySkills, showUnuseable, showPassive);
addSkills(hero, secondClass, secondarySkills, showUnuseable, showPassive);
secondarySkills.removeAll(primarySkills);
Multimap<Integer, Skill> primaryMap = mapSkillsByLevel(hero, primarySkills);
Multimap<Integer, Skill> secondaryMap = mapSkillsByLevel(hero, secondarySkills);
List<String> skillNames = new ArrayList<>();
for (Skill skill : primaryMap.values()) {
skillNames.add(skill.getName());
}
for (Skill skill : secondaryMap.values()) {
skillNames.add(skill.getName());
}
return skillNames;
}
use of com.herocraftonline.heroes.characters.Hero in project MagicPlugin by elBukkit.
the class HeroesManager method getSkillLevel.
public int getSkillLevel(Player player, String skillName) {
Skill skill = skills.getSkill(skillName);
if (skill == null)
return 0;
Hero hero = getHero(player);
if (hero == null)
return 0;
return SkillConfigManager.getUseSetting(hero, skill, SkillSetting.LEVEL, 1, true);
}
use of com.herocraftonline.heroes.characters.Hero in project MagicPlugin by elBukkit.
the class HeroesManager method clearCooldown.
public void clearCooldown(Player player) {
Hero hero = getHero(player);
if (hero == null)
return;
hero.clearCooldowns();
}
use of com.herocraftonline.heroes.characters.Hero 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);
}
Aggregations