Merge pull request #4039 from Mixpa/master

simply if code
This commit is contained in:
Robert A. C 2019-08-26 14:34:36 -06:00 committed by GitHub
commit e4d081f14b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 27 deletions

View File

@ -24,10 +24,7 @@ public class DatabaseAPI {
public boolean doesPlayerExistInDB(UUID uuid) { public boolean doesPlayerExistInDB(UUID uuid) {
PlayerProfile playerProfile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid); PlayerProfile playerProfile = mcMMO.getDatabaseManager().loadPlayerProfile(uuid);
if(playerProfile.isLoaded()) return playerProfile.isLoaded();
return true;
else
return false;
} }
} }

View File

@ -491,10 +491,7 @@ public class McMMOPlayer {
if(hasReachedPowerLevelCap()) if(hasReachedPowerLevelCap())
return true; return true;
if(getSkillLevel(primarySkillType) >= Config.getInstance().getLevelCap(primarySkillType)) return getSkillLevel(primarySkillType) >= Config.getInstance().getLevelCap(primarySkillType);
return true;
return false;
} }
/** /**

View File

@ -62,10 +62,7 @@ public class EventUtils {
* @return true if damage is NOT from an unnatural mcMMO skill (such as bleed DOTs) * @return true if damage is NOT from an unnatural mcMMO skill (such as bleed DOTs)
*/ */
public static boolean isDamageFromMcMMOComplexBehaviour(Event event) { public static boolean isDamageFromMcMMOComplexBehaviour(Event event) {
if (event instanceof FakeEntityDamageEvent) { return event instanceof FakeEntityDamageEvent;
return true;
}
return false;
} }
/** /**

View File

@ -80,10 +80,7 @@ public class RandomChanceUtil
public static boolean rollDice(double chanceOfSuccess, int bound) { public static boolean rollDice(double chanceOfSuccess, int bound) {
Random random = new Random(); Random random = new Random();
if (chanceOfSuccess > random.nextInt(bound)) return chanceOfSuccess > random.nextInt(bound);
return true;
else
return false;
} }
/** /**

View File

@ -777,18 +777,14 @@ public final class CombatUtils {
} }
// It may seem a bit redundant but we need a check here to prevent bleed from being applied in applyAbilityAoE() // It may seem a bit redundant but we need a check here to prevent bleed from being applied in applyAbilityAoE()
if (getFakeDamageFinalResult(player, entity, 1.0) == 0) { return getFakeDamageFinalResult(player, entity, 1.0) != 0;
return false;
}
} }
else if (entity instanceof Tameable) { else if (entity instanceof Tameable) {
if (isFriendlyPet(player, (Tameable) entity)) { if (isFriendlyPet(player, (Tameable) entity)) {
// isFriendlyPet ensures that the Tameable is: Tamed, owned by a player, and the owner is in the same party // isFriendlyPet ensures that the Tameable is: Tamed, owned by a player, and the owner is in the same party
// So we can make some assumptions here, about our casting and our check // So we can make some assumptions here, about our casting and our check
Player owner = (Player) ((Tameable) entity).getOwner(); Player owner = (Player) ((Tameable) entity).getOwner();
if (!(Permissions.friendlyFire(player) && Permissions.friendlyFire(owner))) { return Permissions.friendlyFire(player) && Permissions.friendlyFire(owner);
return false;
}
} }
} }
@ -850,11 +846,7 @@ public final class CombatUtils {
public static boolean canDamage(Entity attacker, Entity target, DamageCause damageCause, double damage) { public static boolean canDamage(Entity attacker, Entity target, DamageCause damageCause, double damage) {
EntityDamageEvent damageEvent = sendEntityDamageEvent(attacker, target, damageCause, damage); EntityDamageEvent damageEvent = sendEntityDamageEvent(attacker, target, damageCause, damage);
if (damageEvent.isCancelled()) { return !damageEvent.isCancelled();
return false;
}
return true;
} }
public static EntityDamageEvent sendEntityDamageEvent(Entity attacker, Entity target, DamageCause damageCause, double damage) { public static EntityDamageEvent sendEntityDamageEvent(Entity attacker, Entity target, DamageCause damageCause, double damage) {