mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
My OCD made me do it.
This commit is contained in:
@ -33,7 +33,7 @@ public class Axes {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void axesBonus(Player attacker, EntityDamageByEntityEvent event) {
|
||||
if(attacker == null)
|
||||
if (attacker == null)
|
||||
return;
|
||||
|
||||
final int MAX_BONUS = advancedConfig.getBonusDamageAxesBonusMax();
|
||||
@ -57,7 +57,7 @@ public class Axes {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event) {
|
||||
if(attacker == null)
|
||||
if (attacker == null)
|
||||
return;
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
@ -95,10 +95,10 @@ public class Axes {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
if (chance > random.nextInt(randomChance) && !entity.isDead()){
|
||||
if (chance > random.nextInt(randomChance) && !entity.isDead()) {
|
||||
int damage = event.getDamage();
|
||||
|
||||
if (entity instanceof Player){
|
||||
if (entity instanceof Player) {
|
||||
event.setDamage((int) (damage * PVP_MODIFIER));
|
||||
((Player) entity).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
|
||||
}
|
||||
@ -118,7 +118,7 @@ public class Axes {
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void impact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||
if(attacker == null)
|
||||
if (attacker == null)
|
||||
return;
|
||||
|
||||
/*
|
||||
@ -140,7 +140,7 @@ public class Axes {
|
||||
}
|
||||
else {
|
||||
for (ItemStack armor : targetPlayer.getInventory().getArmorContents()) {
|
||||
if(Math.random() * 100 > 75) {
|
||||
if (Math.random() * 100 > 75) {
|
||||
int lowerdamage = 0;
|
||||
for (int i = 0; i <= durabilityDamage; i ++) {
|
||||
if (armor.containsEnchantment(Enchantment.DURABILITY)) {
|
||||
@ -172,7 +172,7 @@ public class Axes {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||
if(attacker == null)
|
||||
if (attacker == null)
|
||||
return;
|
||||
|
||||
final int GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance();
|
||||
@ -203,7 +203,7 @@ public class Axes {
|
||||
* @return true if the player has armor, false otherwise
|
||||
*/
|
||||
private static boolean hasArmor(Player player) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
|
@ -38,7 +38,7 @@ public class Excavation {
|
||||
* @param player The player who broke the block
|
||||
*/
|
||||
public static void excavationProcCheck(Block block, Player player) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Material type = block.getType();
|
||||
@ -128,7 +128,7 @@ public class Excavation {
|
||||
* @param block The block to check
|
||||
*/
|
||||
public static void gigaDrillBreaker(Player player, Block block) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());
|
||||
|
@ -84,7 +84,7 @@ public class Herbalism {
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
final PlayerProfile profile = Users.getProfile(player);
|
||||
@ -396,7 +396,7 @@ public class Herbalism {
|
||||
}
|
||||
}
|
||||
|
||||
if(Config.getInstance().getHerbalismAFKDisabled() && player.isInsideVehicle())
|
||||
if (Config.getInstance().getHerbalismAFKDisabled() && player.isInsideVehicle())
|
||||
return;
|
||||
|
||||
Skills.xpProcessing(player, profile, SkillType.HERBALISM, xp);
|
||||
|
@ -275,13 +275,13 @@ public class WoodCutting {
|
||||
|
||||
byte data = currentBlock.getData();
|
||||
|
||||
if((data & 0x4) == 0x4)
|
||||
if ((data & 0x4) == 0x4)
|
||||
data ^= 0x4;
|
||||
|
||||
if((data & 0x8) == 0x8)
|
||||
if ((data & 0x8) == 0x8)
|
||||
data ^= 0x8;
|
||||
|
||||
if(TreeSpecies.getByData(data) == TreeSpecies.JUNGLE) {
|
||||
if (TreeSpecies.getByData(data) == TreeSpecies.JUNGLE) {
|
||||
Block corner1 = currentBlock.getRelative(1, 0, 1);
|
||||
Block corner2 = currentBlock.getRelative(1, 0, -1);
|
||||
Block corner3 = currentBlock.getRelative(-1, 0, 1);
|
||||
@ -307,7 +307,7 @@ public class WoodCutting {
|
||||
}
|
||||
|
||||
if (BlockChecks.treeFellerCompatible(yPositive)) {
|
||||
if(!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) {
|
||||
if (!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) {
|
||||
processTreeFelling(yPositive, toBeFelled);
|
||||
}
|
||||
}
|
||||
@ -345,10 +345,10 @@ public class WoodCutting {
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.WOODCUTTING);
|
||||
byte type = block.getData();
|
||||
|
||||
if((type & 0x4) == 0x4)
|
||||
if ((type & 0x4) == 0x4)
|
||||
type ^= 0x4;
|
||||
|
||||
if((type & 0x8) == 0x8)
|
||||
if ((type & 0x8) == 0x8)
|
||||
type ^= 0x8;
|
||||
|
||||
Material mat = Material.getMaterial(block.getTypeId());
|
||||
@ -442,17 +442,17 @@ public class WoodCutting {
|
||||
else {
|
||||
byte type = block.getData();
|
||||
|
||||
if((type & 0x4) == 0x4)
|
||||
if ((type & 0x4) == 0x4)
|
||||
type ^= 0x4;
|
||||
|
||||
if((type & 0x8) == 0x8)
|
||||
if ((type & 0x8) == 0x8)
|
||||
type ^= 0x8;
|
||||
|
||||
TreeSpecies species = TreeSpecies.getByData(type);
|
||||
|
||||
//Apparently species can be null in certain cases (custom server mods?)
|
||||
//https://github.com/mcMMO-Dev/mcMMO/issues/229
|
||||
if(species == null)
|
||||
if (species == null)
|
||||
return;
|
||||
|
||||
switch (species) {
|
||||
|
@ -90,7 +90,7 @@ public class Repair {
|
||||
* @param is Item being repaired
|
||||
*/
|
||||
protected static void addEnchants(Player player, ItemStack is) {
|
||||
if(Permissions.arcaneBypass(player)) {
|
||||
if (Permissions.arcaneBypass(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect"));
|
||||
return;
|
||||
}
|
||||
@ -210,7 +210,7 @@ public class Repair {
|
||||
*/
|
||||
protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
|
||||
float bonus;
|
||||
if(skillLevel >= REPAIR_MASTERY_MAX_BONUS_LEVEL) bonus = ((float) REPAIR_MASTERY_CHANCE_MAX / 100F);
|
||||
if (skillLevel >= REPAIR_MASTERY_MAX_BONUS_LEVEL) bonus = ((float) REPAIR_MASTERY_CHANCE_MAX / 100F);
|
||||
else bonus = (((float) skillLevel) / ((float) REPAIR_MASTERY_MAX_BONUS_LEVEL)) * (((float) REPAIR_MASTERY_CHANCE_MAX) / 100F);
|
||||
|
||||
if (Permissions.repairMastery(player)) {
|
||||
@ -222,7 +222,7 @@ public class Repair {
|
||||
repairAmount = (int) (repairAmount * 2D);
|
||||
}
|
||||
|
||||
if(repairAmount <= 0 || repairAmount > 32767)
|
||||
if (repairAmount <= 0 || repairAmount > 32767)
|
||||
repairAmount = 32767;
|
||||
|
||||
durability -= repairAmount;
|
||||
@ -249,7 +249,7 @@ public class Repair {
|
||||
|
||||
if (Permissions.luckyRepair(player)) randomChance = (int) (randomChance * 0.75);
|
||||
|
||||
if (chance > random.nextInt(randomChance) && Permissions.repairBonus(player)){
|
||||
if (chance > random.nextInt(randomChance) && Permissions.repairBonus(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
|
||||
return true;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class Salvage {
|
||||
return;
|
||||
}
|
||||
|
||||
if(player.getGameMode() == GameMode.SURVIVAL) {
|
||||
if (player.getGameMode() == GameMode.SURVIVAL) {
|
||||
final PlayerProfile profile = Users.getProfile(player);
|
||||
final int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
|
||||
final int unlockLevel = configInstance.getSalvageUnlockLevel();
|
||||
|
@ -24,7 +24,7 @@ public class CounterAttackEventHandler {
|
||||
}
|
||||
|
||||
protected boolean isHoldingSword() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
return ItemChecks.isSword(player.getItemInHand());
|
||||
@ -39,7 +39,7 @@ public class CounterAttackEventHandler {
|
||||
}
|
||||
|
||||
protected void sendAbilityMessages() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Countered"));
|
||||
|
@ -19,7 +19,7 @@ public class SerratedStrikesEventHandler {
|
||||
}
|
||||
|
||||
protected void applyAbilityEffects() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS);
|
||||
|
@ -26,7 +26,7 @@ public class SwordsManager {
|
||||
* @param defender The defending entity
|
||||
*/
|
||||
public void bleedCheck(LivingEntity defender) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.swordsBleed(player)) {
|
||||
@ -53,7 +53,7 @@ public class SwordsManager {
|
||||
}
|
||||
|
||||
public void counterAttackChecks(LivingEntity attacker, int damage) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.counterAttack(player)) {
|
||||
@ -82,7 +82,7 @@ public class SwordsManager {
|
||||
}
|
||||
|
||||
public void serratedStrikes(LivingEntity target, int damage) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.serratedStrikes(player)) {
|
||||
|
@ -19,7 +19,7 @@ public class BeastLoreEventHandler {
|
||||
}
|
||||
|
||||
protected void sendInspectMessage() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
String message = LocaleLoader.getString("Combat.BeastLore") + " ";
|
||||
|
@ -28,14 +28,14 @@ public class CallOfTheWildEventHandler {
|
||||
}
|
||||
|
||||
protected void sendInsufficientAmountMessage() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.GRAY + Misc.prettyItemString(inHand.getTypeId()));
|
||||
}
|
||||
|
||||
protected boolean nearbyEntityExists() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
boolean entityExists = false;
|
||||
@ -51,7 +51,7 @@ public class CallOfTheWildEventHandler {
|
||||
}
|
||||
|
||||
protected void sendFailureMessage() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (type == EntityType.OCELOT) {
|
||||
@ -63,7 +63,7 @@ public class CallOfTheWildEventHandler {
|
||||
}
|
||||
|
||||
protected void spawnCreature() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
|
||||
@ -80,7 +80,7 @@ public class CallOfTheWildEventHandler {
|
||||
}
|
||||
|
||||
protected void processResourceCost() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
int newAmount = inHand.getAmount() - summonAmount;
|
||||
@ -94,7 +94,7 @@ public class CallOfTheWildEventHandler {
|
||||
}
|
||||
|
||||
protected void sendSuccessMessage() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
||||
|
@ -18,7 +18,7 @@ public class EnvironmentallyAwareEventHandler {
|
||||
}
|
||||
|
||||
protected void teleportWolf() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (event.getDamage() > wolf.getHealth()) {
|
||||
@ -29,7 +29,7 @@ public class EnvironmentallyAwareEventHandler {
|
||||
}
|
||||
|
||||
protected void sendAbilityMessage() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf"));
|
||||
|
@ -34,7 +34,7 @@ public class TamingManager {
|
||||
* @param damage The damage being absorbed by the wolf
|
||||
*/
|
||||
public void fastFoodService(Wolf wolf, int damage) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.fastFoodService(player)) {
|
||||
@ -62,7 +62,7 @@ public class TamingManager {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void sharpenedClaws(EntityDamageEvent event) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.sharpenedClaws(player)) {
|
||||
@ -82,7 +82,7 @@ public class TamingManager {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void gore(EntityDamageEvent event) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.gore(player)) {
|
||||
@ -160,7 +160,7 @@ public class TamingManager {
|
||||
* @param livingEntity The entity to examine
|
||||
*/
|
||||
public void beastLore(LivingEntity livingEntity) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.beastLore(player)) {
|
||||
@ -179,7 +179,7 @@ public class TamingManager {
|
||||
* @param summonAmount The amount of material needed to summon the entity
|
||||
*/
|
||||
private void callOfTheWild(EntityType type, int summonAmount) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.callOfTheWild(player)) {
|
||||
@ -213,7 +213,7 @@ public class TamingManager {
|
||||
* @param cause The damage cause of the event
|
||||
*/
|
||||
private void environmentallyAware(EntityDamageEvent event, DamageCause cause) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.environmentallyAware(player)) {
|
||||
@ -248,7 +248,7 @@ public class TamingManager {
|
||||
* @param cause The damage cause of the event
|
||||
*/
|
||||
private void thickFur(EntityDamageEvent event, DamageCause cause) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.thickFur(player)) {
|
||||
@ -268,7 +268,7 @@ public class TamingManager {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
private void shockProof(EntityDamageEvent event) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.shockProof(player)) {
|
||||
|
@ -25,7 +25,7 @@ public class UnarmedManager {
|
||||
* @param defender The defending player
|
||||
*/
|
||||
public void disarmCheck(Player defender) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.disarm(player)) {
|
||||
@ -62,7 +62,7 @@ public class UnarmedManager {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void deflectCheck(EntityDamageEvent event) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.deflect(player)) {
|
||||
@ -92,7 +92,7 @@ public class UnarmedManager {
|
||||
* @param event The event to modify.
|
||||
*/
|
||||
public void bonusDamage(EntityDamageEvent event) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.unarmedBonus(player)) {
|
||||
@ -112,7 +112,7 @@ public class UnarmedManager {
|
||||
* @return true if the defender was not disarmed, false otherwise
|
||||
*/
|
||||
private boolean hasIronGrip(Player defender) {
|
||||
if(defender == null)
|
||||
if (defender == null)
|
||||
return false;
|
||||
|
||||
if (!Permissions.ironGrip(defender)) {
|
||||
|
Reference in New Issue
Block a user