Better boolean handling.

This commit is contained in:
GJ 2013-05-21 11:44:16 -04:00
parent 0b6372a6ea
commit 92ec04bd46

View File

@ -186,11 +186,7 @@ public class SkillUtils {
return isLocalizedSkill(skillName); return isLocalizedSkill(skillName);
} }
if (SkillType.getSkill(skillName) != null) { return SkillType.getSkill(skillName) != null;
return true;
}
return false;
} }
private static boolean isLocalizedSkill(String skillName) { private static boolean isLocalizedSkill(String skillName) {
@ -218,15 +214,11 @@ public class SkillUtils {
* @return true if the player has combat skills, false otherwise * @return true if the player has combat skills, false otherwise
*/ */
public static boolean hasCombatSkills(Player player) { public static boolean hasCombatSkills(Player player) {
if (Permissions.skillEnabled(player, SkillType.AXES) return Permissions.skillEnabled(player, SkillType.AXES)
|| Permissions.skillEnabled(player, SkillType.ARCHERY) || Permissions.skillEnabled(player, SkillType.ARCHERY)
|| Permissions.skillEnabled(player, SkillType.SWORDS) || Permissions.skillEnabled(player, SkillType.SWORDS)
|| Permissions.skillEnabled(player, SkillType.TAMING) || Permissions.skillEnabled(player, SkillType.TAMING)
|| Permissions.skillEnabled(player, SkillType.UNARMED)) { || Permissions.skillEnabled(player, SkillType.UNARMED);
return true;
}
return false;
} }
/** /**
@ -236,15 +228,11 @@ public class SkillUtils {
* @return true if the player has gathering skills, false otherwise * @return true if the player has gathering skills, false otherwise
*/ */
public static boolean hasGatheringSkills(Player player) { public static boolean hasGatheringSkills(Player player) {
if (Permissions.skillEnabled(player, SkillType.EXCAVATION) return Permissions.skillEnabled(player, SkillType.EXCAVATION)
|| Permissions.skillEnabled(player, SkillType.FISHING) || Permissions.skillEnabled(player, SkillType.FISHING)
|| Permissions.skillEnabled(player, SkillType.HERBALISM) || Permissions.skillEnabled(player, SkillType.HERBALISM)
|| Permissions.skillEnabled(player, SkillType.MINING) || Permissions.skillEnabled(player, SkillType.MINING)
|| Permissions.skillEnabled(player, SkillType.WOODCUTTING)) { || Permissions.skillEnabled(player, SkillType.WOODCUTTING);
return true;
}
return false;
} }
/** /**
@ -254,13 +242,9 @@ public class SkillUtils {
* @return true if the player has misc skills, false otherwise * @return true if the player has misc skills, false otherwise
*/ */
public static boolean hasMiscSkills(Player player) { public static boolean hasMiscSkills(Player player) {
if (Permissions.skillEnabled(player, SkillType.ACROBATICS) return Permissions.skillEnabled(player, SkillType.ACROBATICS)
|| Permissions.skillEnabled(player, SkillType.SMELTING) || Permissions.skillEnabled(player, SkillType.SMELTING)
|| Permissions.skillEnabled(player, SkillType.REPAIR)) { || Permissions.skillEnabled(player, SkillType.REPAIR);
return true;
}
return false;
} }
/** /**
@ -492,11 +476,7 @@ public class SkillUtils {
FakeBlockBreakEvent breakEvent = new FakeBlockBreakEvent(block, player); FakeBlockBreakEvent breakEvent = new FakeBlockBreakEvent(block, player);
pluginManger.callEvent(breakEvent); pluginManger.callEvent(breakEvent);
if (!damageEvent.isCancelled() && !breakEvent.isCancelled()) { return !damageEvent.isCancelled() && !breakEvent.isCancelled();
return true;
}
return false;
} }
public static boolean activationSuccessful(Player player, SkillType skill, double maxChance, int maxLevel) { public static boolean activationSuccessful(Player player, SkillType skill, double maxChance, int maxLevel) {