diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java index 23362d213..14c27601c 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AcrobaticsCommand.java @@ -44,24 +44,24 @@ public class AcrobaticsCommand extends SkillCommand { float gracefulRollChanceF; // DODGE - if(skillValue >= dodgeMaxBonusLevel) dodgeChanceF = dodgeChanceMax; + if (skillValue >= dodgeMaxBonusLevel) dodgeChanceF = dodgeChanceMax; else dodgeChanceF = (float) (((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * skillValue); dodgeChance = df.format(dodgeChanceF); - if(dodgeChanceF + dodgeChanceF * 0.3333D >= 100D) dodgeChanceLucky = df.format(100D); + if (dodgeChanceF + dodgeChanceF * 0.3333D >= 100D) dodgeChanceLucky = df.format(100D); else dodgeChanceLucky = df.format(dodgeChanceF + dodgeChanceF * 0.3333D); // ROLL - if(skillValue >= rollMaxBonusLevel) rollChanceF = rollChanceMax; + if (skillValue >= rollMaxBonusLevel) rollChanceF = rollChanceMax; else rollChanceF = (float) (((double) rollChanceMax / (double) rollMaxBonusLevel) * skillValue); rollChance = df.format(rollChanceF); - if(rollChanceF + rollChanceF * 0.3333D >= 100D) rollChanceLucky = df.format(100D); + if (rollChanceF + rollChanceF * 0.3333D >= 100D) rollChanceLucky = df.format(100D); else rollChanceLucky = df.format(rollChanceF + rollChanceF * 0.3333D); // GRACEFULROLL - if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChanceF = gracefulRollChanceMax; + if (skillValue >= gracefulRollMaxBonusLevel) gracefulRollChanceF = gracefulRollChanceMax; else gracefulRollChanceF = (float) (((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * skillValue); gracefulRollChance = df.format(gracefulRollChanceF); - if(gracefulRollChanceF + gracefulRollChanceF * 0.3333D >= 100D) gracefulRollChanceLucky = df.format(100D); + if (gracefulRollChanceF + gracefulRollChanceF * 0.3333D >= 100D) gracefulRollChanceLucky = df.format(100D); else gracefulRollChanceLucky = df.format(gracefulRollChanceF + gracefulRollChanceF * 0.3333D); } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java index ecb9cb49f..1f35ae1ea 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ArcheryCommand.java @@ -50,17 +50,17 @@ public class ArcheryCommand extends SkillCommand { else skillShotBonus = percent.format(bonus); // Daze - if(skillValue >= dazeMaxBonusLevel) dazeChanceF = dazeBonusMax; + if (skillValue >= dazeMaxBonusLevel) dazeChanceF = dazeBonusMax; else dazeChanceF = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillValue); dazeChance = df.format(dazeChanceF); - if(dazeChanceF + dazeChanceF * 0.3333D >= 100D) dazeChanceLucky = df.format(100D); + if (dazeChanceF + dazeChanceF * 0.3333D >= 100D) dazeChanceLucky = df.format(100D); else dazeChanceLucky = df.format(dazeChanceF + dazeChanceF * 0.3333D); // Retrieve - if(skillValue >= retrieveMaxBonusLevel) retrieveChanceF = retrieveBonusMax; + if (skillValue >= retrieveMaxBonusLevel) retrieveChanceF = retrieveBonusMax; else retrieveChanceF = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillValue); retrieveChance = df.format(retrieveChanceF); - if(retrieveChanceF + retrieveChanceF * 0.3333D >= 100D) retrieveChanceLucky = df.format(100D); + if (retrieveChanceF + retrieveChanceF * 0.3333D >= 100D) retrieveChanceLucky = df.format(100D); else retrieveChanceLucky = df.format(retrieveChanceF + retrieveChanceF * 0.3333D); } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java index ab28750da..9712a0fc1 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/AxesCommand.java @@ -56,7 +56,7 @@ public class AxesCommand extends SkillCommand { if (skillValue >= critMaxBonusLevel) critChanceF = (float) critMaxChance; else critChanceF = (float) ((critMaxChance / critMaxBonusLevel) * skillCheck); critChance = df.format(critChanceF); - if(critChanceF + critChanceF * 0.3333D >= 100D) critChanceLucky = df.format(100D); + if (critChanceF + critChanceF * 0.3333D >= 100D) critChanceLucky = df.format(100D); else critChanceLucky = df.format(critChanceF + critChanceF * 0.3333D); //Axe Mastery if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax); @@ -125,7 +125,7 @@ public class AxesCommand extends SkillCommand { player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", new Object[] {greaterImpactDamage}) })); } - if (canCritical){ + if (canCritical) { if (player.hasPermission("mcmmo.perks.lucky.axes")) player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { critChanceLucky })); else diff --git a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java index 67f64a6c4..90b55fa38 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java @@ -45,12 +45,12 @@ public class FishingCommand extends SkillCommand { int dropChance = Fishing.getShakeChance(lootTier); shakeChance = df.format(dropChance); - if(dropChance + (dropChance * 0.3333D) >= 100D) shakeChanceLucky = df.format(100D); + if (dropChance + (dropChance * 0.3333D) >= 100D) shakeChanceLucky = df.format(100D); else shakeChanceLucky = df.format(dropChance + (dropChance * 0.3333D)); shakeUnlockLevel = advancedConfig.getShakeUnlockLevel(); //Fishermans Diet - if(skillValue >= fishermansDietRankMaxLevel) fishermansDietRank = "5"; + if (skillValue >= fishermansDietRankMaxLevel) fishermansDietRank = "5"; else fishermansDietRank = String.valueOf((int) ((double) skillValue / (double) fishermansDietRankChange)); } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java index 2140e7a05..62629dd64 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/HerbalismCommand.java @@ -51,22 +51,22 @@ public class HerbalismCommand extends SkillCommand { float doubleDropChanceF; greenTerraLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); //FARMERS DIET - if(skillValue >= farmersDietMaxLevel) farmersDietRank = "5"; + if (skillValue >= farmersDietMaxLevel) farmersDietRank = "5"; else farmersDietRank = String.valueOf((int) ((double) skillValue / (double) farmersDietRankChange)); //GREEN THUMB - if(skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4"; + if (skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4"; else greenThumbStage = String.valueOf((int) ((double) skillValue / (double) greenThumbStageChange)); - if(skillValue >= greenThumbMaxLevel) greenThumbChanceF = (float) (greenThumbMaxBonus); + if (skillValue >= greenThumbMaxLevel) greenThumbChanceF = (float) (greenThumbMaxBonus); else greenThumbChanceF = (float) ((greenThumbMaxBonus / greenThumbMaxLevel) * skillValue); greenThumbChance = df.format(greenThumbChanceF); - if(greenThumbChanceF + greenThumbChanceF * 0.3333D >= 100D) greenThumbChanceLucky = df.format(100D); + if (greenThumbChanceF + greenThumbChanceF * 0.3333D >= 100D) greenThumbChanceLucky = df.format(100D); else greenThumbChanceLucky = df.format(greenThumbChanceF + greenThumbChanceF * 0.3333D); //DOUBLE DROPS - if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus); + if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus); else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); doubleDropChance = df.format(doubleDropChanceF); - if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D); + if (doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D); else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D); } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java index dc3ad1e1e..be476cc6d 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/MiningCommand.java @@ -53,10 +53,10 @@ public class MiningCommand extends SkillCommand { //Super Breaker superBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); //Double Drops - if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus); + if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus); else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); doubleDropChance = df.format(doubleDropChanceF); - if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D); + if (doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D); else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D); //Blast Mining diff --git a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java index 652fa87fb..9eed9d992 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/RepairCommand.java @@ -67,13 +67,13 @@ public class RepairCommand extends SkillCommand { salvageLevel = Config.getInstance().getSalvageUnlockLevel(); - if(skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryMaxBonus); + if (skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryMaxBonus); else repairMasteryBonus = df.format(((double) repairMasteryMaxBonus / (double) repairMasteryMaxBonusLevel) * skillValue); - if(skillValue >= superRepairMaxBonusLevel) superRepairChanceF = superRepairChanceMax; + if (skillValue >= superRepairMaxBonusLevel) superRepairChanceF = superRepairChanceMax; else superRepairChanceF = (float) (((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * skillValue); superRepairChance = df.format(superRepairChanceF); - if(superRepairChanceF + superRepairChanceF * 0.3333D >= 100D) superRepairChanceLucky = df.format(100D); + if (superRepairChanceF + superRepairChanceF * 0.3333D >= 100D) superRepairChanceLucky = df.format(100D); else superRepairChanceLucky = df.format(superRepairChanceF + superRepairChanceF * 0.3333D); arcaneForgingRank = Repair.getArcaneForgingRank(profile); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java index eb430dcc2..6a5d2d5fa 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java @@ -48,16 +48,16 @@ public class SwordsCommand extends SkillCommand { if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks); else bleedLength = String.valueOf(bleedBaseTicks); - if(skillValue >= bleedMaxLevel) bleedChanceF = bleedChanceMax; + if (skillValue >= bleedMaxLevel) bleedChanceF = bleedChanceMax; else bleedChanceF = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * skillValue); bleedChance = df.format(bleedChanceF); - if(bleedChanceF + bleedChanceF * 0.3333D >= 100D) bleedChanceLucky = df.format(100D); + if (bleedChanceF + bleedChanceF * 0.3333D >= 100D) bleedChanceLucky = df.format(100D); else bleedChanceLucky = df.format(bleedChanceF + bleedChanceF * 0.3333D); - if(skillValue >= counterMaxLevel) counterAttackChanceF = counterChanceMax; + if (skillValue >= counterMaxLevel) counterAttackChanceF = counterChanceMax; else counterAttackChanceF = (float) (((double) counterChanceMax / (double) counterMaxLevel) * skillValue); counterAttackChance = df.format(counterAttackChanceF); - if(counterAttackChanceF + counterAttackChanceF * 0.3333D >= 100D) counterAttackChanceLucky = df.format(100D); + if (counterAttackChanceF + counterAttackChanceF * 0.3333D >= 100D) counterAttackChanceLucky = df.format(100D); else counterAttackChanceLucky = df.format(counterAttackChanceF + counterAttackChanceF * 0.3333D); } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java index 0335e41a0..8ebbcb4a8 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/TamingCommand.java @@ -43,10 +43,10 @@ public class TamingCommand extends SkillCommand { protected void dataCalculations() { DecimalFormat df = new DecimalFormat("0.0"); float goreChanceF; - if(skillValue >= goreMaxLevel) goreChanceF = (goreChanceMax); + if (skillValue >= goreMaxLevel) goreChanceF = (goreChanceMax); else goreChanceF = (float) (((double) goreChanceMax / (double) goreMaxLevel) * skillValue); goreChance = df.format(goreChanceF); - if(goreChanceF + goreChanceF * 0.3333D >= 100D) goreChanceLucky = df.format(100D); + if (goreChanceF + goreChanceF * 0.3333D >= 100D) goreChanceLucky = df.format(100D); else goreChanceLucky = df.format(goreChanceF + goreChanceF * 0.3333D); } diff --git a/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java index 110b989a5..eb49a5829 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/UnarmedCommand.java @@ -44,16 +44,16 @@ public class UnarmedCommand extends SkillCommand { float deflectChanceF; berserkLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); - if(skillValue >= disarmMaxLevel) disarmChanceF = disarmChanceMax; + if (skillValue >= disarmMaxLevel) disarmChanceF = disarmChanceMax; else disarmChanceF = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * skillValue); disarmChance = df.format(disarmChanceF); - if(disarmChanceF + disarmChanceF * 0.3333D >= 100D) disarmChanceLucky = df.format(100D); + if (disarmChanceF + disarmChanceF * 0.3333D >= 100D) disarmChanceLucky = df.format(100D); else disarmChanceLucky = df.format(disarmChanceF + disarmChanceF * 0.3333D); - if(skillValue >= deflectMaxLevel) deflectChanceF = deflectChanceMax; + if (skillValue >= deflectMaxLevel) deflectChanceF = deflectChanceMax; else deflectChanceF = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * skillValue); deflectChance = df.format(deflectChanceF); - if(deflectChanceF + deflectChanceF * 0.3333D >= 100D) deflectChanceLucky = df.format(100D); + if (deflectChanceF + deflectChanceF * 0.3333D >= 100D) deflectChanceLucky = df.format(100D); else deflectChanceLucky = df.format(deflectChanceF + deflectChanceF * 0.3333D); if (skillValue >= 250) ironArmBonus = String.valueOf(ironArmMaxBonus); diff --git a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java index cfa8ed32a..447be4ed3 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/WoodcuttingCommand.java @@ -38,10 +38,10 @@ public class WoodcuttingCommand extends SkillCommand { float doubleDropChanceF; treeFellerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); - if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus); + if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus); else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); doubleDropChance = df.format(doubleDropChanceF); - if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D); + if (doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D); else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D); } diff --git a/src/main/java/com/gmail/nossr50/config/ConfigLoader.java b/src/main/java/com/gmail/nossr50/config/ConfigLoader.java index a3dcc9f86..0ab8bb066 100644 --- a/src/main/java/com/gmail/nossr50/config/ConfigLoader.java +++ b/src/main/java/com/gmail/nossr50/config/ConfigLoader.java @@ -16,13 +16,13 @@ public abstract class ConfigLoader { protected File configFile; protected FileConfiguration config; - public ConfigLoader(String relativePath, String fileName){ + public ConfigLoader(String relativePath, String fileName) { this.fileName = fileName; configFile = new File(plugin.getDataFolder(), relativePath + File.separator + fileName); loadFile(); } - public ConfigLoader(String fileName){ + public ConfigLoader(String fileName) { this.fileName = fileName; configFile = new File(plugin.getDataFolder(), fileName); loadFile(); diff --git a/src/main/java/com/gmail/nossr50/config/TreasuresConfig.java b/src/main/java/com/gmail/nossr50/config/TreasuresConfig.java index cbe0b50a5..e8add1e40 100644 --- a/src/main/java/com/gmail/nossr50/config/TreasuresConfig.java +++ b/src/main/java/com/gmail/nossr50/config/TreasuresConfig.java @@ -202,11 +202,11 @@ public class TreasuresConfig extends ConfigLoader{ int dropLevel = fTreasure.getDropLevel(); int maxLevel = fTreasure.getMaxLevel(); - if(dropLevel <= Config.getInstance().getFishingTierLevelsTier1() && maxLevel >= Config.getInstance().getFishingTierLevelsTier1()) { + if (dropLevel <= Config.getInstance().getFishingTierLevelsTier1() && maxLevel >= Config.getInstance().getFishingTierLevelsTier1()) { fishingRewardsTier1.add(fTreasure); } - if(dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) { + if (dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) { fishingRewardsTier2.add(fTreasure); } diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java index 356e55412..e5ddb9058 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomArmorConfig.java @@ -49,7 +49,7 @@ public class CustomArmorConfig extends ConfigLoader{ private void loadArmor(String armorType, List idList) { ConfigurationSection armorSection = config.getConfigurationSection(armorType); - if(armorSection == null) + if (armorSection == null) return; Set armorConfigSet = armorSection.getKeys(false); @@ -88,7 +88,7 @@ public class CustomArmorConfig extends ConfigLoader{ } public List getLoadedRepairables() { - if(repairables == null) return new ArrayList(); + if (repairables == null) return new ArrayList(); return repairables; } } diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomBlocksConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomBlocksConfig.java index 0b1051efe..af40425b7 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomBlocksConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomBlocksConfig.java @@ -49,7 +49,7 @@ public class CustomBlocksConfig extends ConfigLoader { private void loadBlocks(String skillType, List blockList) { ConfigurationSection skillSection = config.getConfigurationSection(skillType); - if(skillSection == null) + if (skillSection == null) return; Set skillConfigSet = skillSection.getKeys(false); diff --git a/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java b/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java index a32f772bb..460ab5a52 100644 --- a/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java +++ b/src/main/java/com/gmail/nossr50/config/mods/CustomToolsConfig.java @@ -53,7 +53,7 @@ public class CustomToolsConfig extends ConfigLoader { private void loadTool(String toolType, List idList) { ConfigurationSection toolSection = config.getConfigurationSection(toolType); - if(toolSection == null) + if (toolSection == null) return; Set toolConfigSet = toolSection.getKeys(false); @@ -95,7 +95,7 @@ public class CustomToolsConfig extends ConfigLoader { } public List getLoadedRepairables() { - if(repairables == null) return new ArrayList(); + if (repairables == null) return new ArrayList(); return repairables; } } diff --git a/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java index c6c3d9a84..03c666164 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/McMMOPlayer.java @@ -120,9 +120,9 @@ public class McMMOPlayer { * @param newvalue The amount of XP to add */ public void addXP(SkillType skillType, int newValue) { - if(player == null) + if (player == null) return; - else if(player.getGameMode() == null) + else if (player.getGameMode() == null) return; if (player.getGameMode().equals(GameMode.CREATIVE)) { diff --git a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java index f9cb87fb2..bb03f5836 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java +++ b/src/main/java/com/gmail/nossr50/datatypes/PlayerProfile.java @@ -297,7 +297,7 @@ public class PlayerProfile { public void save(boolean override) { Long timestamp = System.currentTimeMillis(); - if(timestamp < (lastSave + ((long) Config.getInstance().getSaveInterval() * 60000)) && !override) + if (timestamp < (lastSave + ((long) Config.getInstance().getSaveInterval() * 60000)) && !override) return; // if we are using mysql save to database diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 7ec207eaf..95f14cdde 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -128,7 +128,7 @@ public class BlockListener implements Listener { int id = block.getTypeId(); Material type = block.getType(); - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC /* Code to prevent issues with placed falling Sand/Gravel not being tracked */ if (type.equals(Material.SAND) || type.equals(Material.GRAVEL)) { @@ -171,7 +171,7 @@ public class BlockListener implements Listener { Player player = event.getPlayer(); - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC PlayerProfile profile = Users.getProfile(player); @@ -258,7 +258,7 @@ public class BlockListener implements Listener { if ((relativeType == Material.SAND || relativeType == Material.GRAVEL) && mcMMO.placeStore.isTrue(relative)) { mcMMO.placeStore.setFalse(relative); } - else if (!BlockChecks.shouldBeWatched(relative) && mcMMO.placeStore.isTrue(relative)){ + else if (!BlockChecks.shouldBeWatched(relative) && mcMMO.placeStore.isTrue(relative)) { mcMMO.placeStore.setFalse(relative); } else { @@ -284,7 +284,7 @@ public class BlockListener implements Listener { Player player = event.getPlayer(); - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC PlayerProfile profile = Users.getProfile(player); diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 2d55ea05c..71ccc65e8 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -60,13 +60,13 @@ public class EntityListener implements Listener { if (event instanceof FakeEntityDamageByEntityEvent) return; - if(event.getDamage() <= 0) + if (event.getDamage() <= 0) return; Entity attacker = event.getDamager(); Entity defender = event.getEntity(); - if(attacker.hasMetadata("NPC") || defender.hasMetadata("NPC")) return; // Check if either players is are Citizens NPCs + if (attacker.hasMetadata("NPC") || defender.hasMetadata("NPC")) return; // Check if either players is are Citizens NPCs if (attacker instanceof Projectile) { attacker = ((Projectile) attacker).getShooter(); @@ -118,7 +118,7 @@ public class EntityListener implements Listener { Entity entity = event.getEntity(); DamageCause cause = event.getCause(); - if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (!(entity instanceof LivingEntity)) { return; @@ -179,7 +179,7 @@ public class EntityListener implements Listener { public void onEntityDeath(EntityDeathEvent event) { LivingEntity entity = event.getEntity(); - if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC entity.setFireTicks(0); BleedTimer.remove(entity); @@ -211,7 +211,7 @@ public class EntityListener implements Listener { public void onExplosionPrime(ExplosionPrimeEvent event) { Entity entity = event.getEntity(); - if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (entity instanceof TNTPrimed) { int id = entity.getEntityId(); @@ -236,9 +236,9 @@ public class EntityListener implements Listener { public void onEnitityExplode(EntityExplodeEvent event) { Entity entity = event.getEntity(); - if(entity == null) return; + if (entity == null) return; - if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (entity instanceof TNTPrimed) { int id = entity.getEntityId(); @@ -263,7 +263,7 @@ public class EntityListener implements Listener { if (event.getEntity() instanceof Player) { Player player = (Player) event.getEntity(); - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC PlayerProfile profile = Users.getProfile(player); int currentFoodLevel = player.getFoodLevel(); @@ -399,7 +399,7 @@ public class EntityListener implements Listener { public void onEntityTame(EntityTameEvent event) { Player player = (Player) event.getOwner(); - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (Permissions.taming(player) && !mcMMO.placeStore.isSpawnedPet(event.getEntity())) { PlayerProfile profile = Users.getProfile(player); diff --git a/src/main/java/com/gmail/nossr50/listeners/HardcoreListener.java b/src/main/java/com/gmail/nossr50/listeners/HardcoreListener.java index 12b8cace7..c700eda60 100644 --- a/src/main/java/com/gmail/nossr50/listeners/HardcoreListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/HardcoreListener.java @@ -21,7 +21,7 @@ public class HardcoreListener implements Listener { public void onPlayerDeath(PlayerDeathEvent event) { Player player = event.getEntity(); //Note this returns a Player object for this subevent - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (!Permissions.hardcoremodeBypass(player)) { if (player.getKiller() != null && Config.getInstance().getHardcoreVampirismEnabled()) { diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 027a53ee6..8a925ba6b 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -63,7 +63,7 @@ public class PlayerListener implements Listener { public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) { Player player = event.getPlayer(); - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC PlayerProfile profile = Users.getProfile(player); @@ -97,7 +97,7 @@ public class PlayerListener implements Listener { int shakeUnlockLevel = advancedConfig.getShakeUnlockLevel(); Player player = event.getPlayer(); - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC if (Permissions.fishing(player)) { State state = event.getState(); @@ -131,7 +131,7 @@ public class PlayerListener implements Listener { @EventHandler(ignoreCancelled = true) public void onPlayerPickupItem(PlayerPickupItemEvent event) { - if(event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC PlayerProfile profile = Users.getProfile(event.getPlayer()); @@ -151,7 +151,7 @@ public class PlayerListener implements Listener { */ @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerLogin(PlayerLoginEvent event) { - if(event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC Users.addUser(event.getPlayer()).getProfile().actualizeRespawnATS(); } @@ -164,7 +164,7 @@ public class PlayerListener implements Listener { public void onPlayerQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC /* GARBAGE COLLECTION */ @@ -181,7 +181,7 @@ public class PlayerListener implements Listener { public void onPlayerJoin(PlayerJoinEvent event) { Player player = event.getPlayer(); - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC //TODO: Locale ALL the things. if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) { @@ -287,7 +287,7 @@ public class PlayerListener implements Listener { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerRespawn(PlayerRespawnEvent event) { - if(event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC PlayerProfile profile = Users.getProfile(event.getPlayer()); if (profile != null) { @@ -303,7 +303,7 @@ public class PlayerListener implements Listener { @EventHandler(priority = EventPriority.LOW) public void onPlayerInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC Action action = event.getAction(); Block block = event.getClickedBlock(); ItemStack inHand = player.getItemInHand(); @@ -427,7 +427,7 @@ public class PlayerListener implements Listener { public void onPlayerChat(AsyncPlayerChatEvent event) { Player player = event.getPlayer(); - if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC + if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC PlayerProfile profile = Users.getProfile(player); diff --git a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java index 01bcea59a..0636e33cb 100644 --- a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java @@ -19,7 +19,7 @@ public class SelfListener implements Listener { public void onPlayerXpGain(McMMOPlayerXpGainEvent event) { int xp = event.getXpGained(); - if(xp < 0) { + if (xp < 0) { try { throw new Exception("Gained negative XP!"); } diff --git a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java index bd44a463f..dbdb30b2a 100644 --- a/src/main/java/com/gmail/nossr50/listeners/WorldListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/WorldListener.java @@ -20,11 +20,11 @@ public class WorldListener implements Listener { @EventHandler public void onWorldInit(WorldInitEvent event) { File dataDir = new File(event.getWorld().getWorldFolder(), "mcmmo_data"); - if(!dataDir.exists()) { + if (!dataDir.exists()) { return; } - if(mcMMO.p == null) + if (mcMMO.p == null) return; mcMMO.p.getLogger().info("Converting block storage for " + event.getWorld().getName() + " to a new format."); @@ -50,7 +50,7 @@ public class WorldListener implements Listener { @EventHandler public void onChunkLoad(ChunkLoadEvent event) { - if(event.getChunk().getEntities().length > 0) + if (event.getChunk().getEntities().length > 0) mcMMO.placeStore.loadChunk(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld()); } } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index 90bdf68c5..b3cad00e4 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -146,7 +146,7 @@ public class mcMMO extends JavaPlugin { repairManager.registerRepairables(repairables); //Check if Repair Anvil and Salvage Anvil have different itemID's - if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()){ + if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()) { getLogger().warning("Can't use the same itemID for Repair/Salvage Anvils!"); } diff --git a/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java b/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java index 7395b6181..44340fb30 100644 --- a/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java +++ b/src/main/java/com/gmail/nossr50/runnables/ChunkletUnloader.java @@ -42,7 +42,7 @@ public class ChunkletUnloader implements Runnable { //Chunklets are unloaded only if their chunk has been unloaded for minimumInactiveTime if (inactiveTime >= minimumInactiveTime) { - if(mcMMO.placeStore == null) + if (mcMMO.placeStore == null) continue; mcMMO.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld()); diff --git a/src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java b/src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java index 568f7c98f..66253dd75 100644 --- a/src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java +++ b/src/main/java/com/gmail/nossr50/runnables/GreenThumbTimer.java @@ -23,7 +23,7 @@ public class GreenThumbTimer implements Runnable { @Override public void run() { - if(this.block.getType() != this.type) + if (this.block.getType() != this.type) this.block.setType(this.type); int skillLevel = this.profile.getSkillLevel(SkillType.HERBALISM); diff --git a/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionMain.java b/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionMain.java index ac9d166c9..00ee437e0 100755 --- a/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionMain.java +++ b/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionMain.java @@ -25,7 +25,7 @@ public class BlockStoreConversionMain implements Runnable { } public void start() { - if(this.taskID >= 0) + if (this.taskID >= 0) return; this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1); @@ -34,18 +34,18 @@ public class BlockStoreConversionMain implements Runnable { @Override public void run() { - if(!this.dataDir.exists()) { + if (!this.dataDir.exists()) { softStop(); return; } - if(!this.dataDir.isDirectory()) { + if (!this.dataDir.isDirectory()) { this.dataDir.delete(); softStop(); return; } - if(this.dataDir.listFiles().length <= 0) { + if (this.dataDir.listFiles().length <= 0) { this.dataDir.delete(); softStop(); return; @@ -54,7 +54,7 @@ public class BlockStoreConversionMain implements Runnable { this.xDirs = this.dataDir.listFiles(); for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.xDirs.length); this.i++) { - if(this.converters[this.i] == null) + if (this.converters[this.i] == null) this.converters[this.i] = new BlockStoreConversionXDirectory(); this.converters[this.i].start(this.world, this.xDirs[this.i]); @@ -64,7 +64,7 @@ public class BlockStoreConversionMain implements Runnable { } public void stop() { - if(this.taskID < 0) + if (this.taskID < 0) return; this.scheduler.cancelTask(this.taskID); @@ -74,7 +74,7 @@ public class BlockStoreConversionMain implements Runnable { public void softStop() { stop(); - if(this.dataDir.exists() || this.dataDir.isDirectory()) { + if (this.dataDir.exists() || this.dataDir.isDirectory()) { start(); return; } diff --git a/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionXDirectory.java b/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionXDirectory.java index 31895092c..edbea1ffd 100755 --- a/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionXDirectory.java +++ b/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionXDirectory.java @@ -26,7 +26,7 @@ public class BlockStoreConversionXDirectory implements Runnable { this.converters = new BlockStoreConversionZDirectory[HiddenConfig.getInstance().getConversionRate()]; this.dataDir = dataDir; - if(this.taskID >= 0) + if (this.taskID >= 0) return; this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1); @@ -35,18 +35,18 @@ public class BlockStoreConversionXDirectory implements Runnable { @Override public void run() { - if(!this.dataDir.exists()) { + if (!this.dataDir.exists()) { stop(); return; } - if(!this.dataDir.isDirectory()) { + if (!this.dataDir.isDirectory()) { this.dataDir.delete(); stop(); return; } - if(this.dataDir.listFiles().length <= 0) { + if (this.dataDir.listFiles().length <= 0) { this.dataDir.delete(); stop(); return; @@ -55,7 +55,7 @@ public class BlockStoreConversionXDirectory implements Runnable { this.zDirs = this.dataDir.listFiles(); for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.zDirs.length); this.i++) { - if(this.converters[this.i] == null) + if (this.converters[this.i] == null) this.converters[this.i] = new BlockStoreConversionZDirectory(); this.converters[this.i].start(this.world, this.dataDir, this.zDirs[this.i]); @@ -65,7 +65,7 @@ public class BlockStoreConversionXDirectory implements Runnable { } public void stop() { - if(this.taskID < 0) + if (this.taskID < 0) return; this.scheduler.cancelTask(this.taskID); diff --git a/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionZDirectory.java b/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionZDirectory.java index fce62fb22..794dd471d 100755 --- a/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionZDirectory.java +++ b/src/main/java/com/gmail/nossr50/runnables/blockstoreconversion/BlockStoreConversionZDirectory.java @@ -40,7 +40,7 @@ public class BlockStoreConversionZDirectory implements Runnable { this.dataDir = dataDir; this.xDir = xDir; - if(this.taskID >= 0) + if (this.taskID >= 0) return; this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1); @@ -49,18 +49,18 @@ public class BlockStoreConversionZDirectory implements Runnable { @Override public void run() { - if(!this.dataDir.exists()) { + if (!this.dataDir.exists()) { stop(); return; } - if(!this.dataDir.isDirectory()) { + if (!this.dataDir.isDirectory()) { this.dataDir.delete(); stop(); return; } - if(this.dataDir.listFiles().length <= 0) { + if (this.dataDir.listFiles().length <= 0) { this.dataDir.delete(); stop(); return; @@ -112,7 +112,7 @@ public class BlockStoreConversionZDirectory implements Runnable { for(this.y2 = (64 * this.y); this.y2 < (64 * this.y + 64); this.y2++) { try { - if(!this.manager.isTrue(this.cxPos, this.y2, this.czPos, this.world)) + if (!this.manager.isTrue(this.cxPos, this.y2, this.czPos, this.world)) continue; this.newManager.setTrue(this.cxPos, this.y2, this.czPos, this.world); @@ -130,16 +130,16 @@ public class BlockStoreConversionZDirectory implements Runnable { for(this.x = 0; this.x < 16; this.x++) { for(this.z = 0; this.z < 16; this.z++) { - if(this.primitiveChunklet != null) + if (this.primitiveChunklet != null) this.oldArray = this.primitiveChunklet.store[x][z]; - if(this.primitiveExChunklet != null) + if (this.primitiveExChunklet != null) this.oldArray = this.primitiveExChunklet.store[x][z]; else return; this.newArray = this.currentChunk.store[x][z]; - if(this.oldArray.length < 64) + if (this.oldArray.length < 64) return; - else if(this.newArray.length < ((this.y * 64) + 64)) + else if (this.newArray.length < ((this.y * 64) + 64)) return; System.arraycopy(this.oldArray, 0, this.newArray, (this.y * 64), 64); } @@ -150,7 +150,7 @@ public class BlockStoreConversionZDirectory implements Runnable { this.newManager.unloadChunk(this.cx, this.cz, this.world); for(File yFile : dataDir.listFiles()) { - if(!yFile.exists()) + if (!yFile.exists()) continue; yFile.delete(); @@ -160,7 +160,7 @@ public class BlockStoreConversionZDirectory implements Runnable { } public void stop() { - if(this.taskID < 0) + if (this.taskID < 0) return; this.scheduler.cancelTask(taskID); diff --git a/src/main/java/com/gmail/nossr50/skills/combat/Axes.java b/src/main/java/com/gmail/nossr50/skills/combat/Axes.java index dd5313872..625fa8963 100644 --- a/src/main/java/com/gmail/nossr50/skills/combat/Axes.java +++ b/src/main/java/com/gmail/nossr50/skills/combat/Axes.java @@ -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(); diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java b/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java index 04704e635..8c735470f 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Excavation.java @@ -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()); diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java index 155db7d1a..4a7163194 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/Herbalism.java @@ -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); diff --git a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java index 53696e3ee..065f2003d 100644 --- a/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java +++ b/src/main/java/com/gmail/nossr50/skills/gathering/WoodCutting.java @@ -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) { diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java index 7739a469e..992a9baac 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Repair.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Repair.java @@ -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; } diff --git a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java index 470281c21..8c3884232 100644 --- a/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java +++ b/src/main/java/com/gmail/nossr50/skills/repair/Salvage.java @@ -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(); diff --git a/src/main/java/com/gmail/nossr50/skills/swords/CounterAttackEventHandler.java b/src/main/java/com/gmail/nossr50/skills/swords/CounterAttackEventHandler.java index e36936c17..8549d0b26 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/CounterAttackEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/CounterAttackEventHandler.java @@ -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")); diff --git a/src/main/java/com/gmail/nossr50/skills/swords/SerratedStrikesEventHandler.java b/src/main/java/com/gmail/nossr50/skills/swords/SerratedStrikesEventHandler.java index c61c553fa..a2ede56ae 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/SerratedStrikesEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/SerratedStrikesEventHandler.java @@ -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); diff --git a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java index fcd23b30e..a8e862a4b 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java @@ -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)) { diff --git a/src/main/java/com/gmail/nossr50/skills/taming/BeastLoreEventHandler.java b/src/main/java/com/gmail/nossr50/skills/taming/BeastLoreEventHandler.java index c66db5045..0efd8de0a 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/BeastLoreEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/BeastLoreEventHandler.java @@ -19,7 +19,7 @@ public class BeastLoreEventHandler { } protected void sendInspectMessage() { - if(player == null) + if (player == null) return; String message = LocaleLoader.getString("Combat.BeastLore") + " "; diff --git a/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java b/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java index 53b611e5b..22fb213d1 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/CallOfTheWildEventHandler.java @@ -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")); diff --git a/src/main/java/com/gmail/nossr50/skills/taming/EnvironmentallyAwareEventHandler.java b/src/main/java/com/gmail/nossr50/skills/taming/EnvironmentallyAwareEventHandler.java index 07c8a3fa1..096e65962 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/EnvironmentallyAwareEventHandler.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/EnvironmentallyAwareEventHandler.java @@ -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")); diff --git a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java index 7a55739e5..855be7eb7 100644 --- a/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/taming/TamingManager.java @@ -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)) { diff --git a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java index 4cd22c3a1..b254eaf61 100644 --- a/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java +++ b/src/main/java/com/gmail/nossr50/skills/unarmed/UnarmedManager.java @@ -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)) { diff --git a/src/main/java/com/gmail/nossr50/util/BlockChecks.java b/src/main/java/com/gmail/nossr50/util/BlockChecks.java index e11509630..15c9f8ee0 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockChecks.java +++ b/src/main/java/com/gmail/nossr50/util/BlockChecks.java @@ -173,7 +173,7 @@ public class BlockChecks { * @param block Block to check * @return true if the block is affected, false otherwise */ - public static boolean canBeGreenTerra(Block block){ + public static boolean canBeGreenTerra(Block block) { switch (block.getType()) { case BROWN_MUSHROOM: case CACTUS: @@ -297,7 +297,7 @@ public class BlockChecks { } } - public static boolean isLog (Block block){ + public static boolean isLog (Block block) { if (block.getType().equals(Material.LOG) || (customBlocksEnabled && ModChecks.isCustomLogBlock(block))) { return true; } diff --git a/src/main/java/com/gmail/nossr50/util/Database.java b/src/main/java/com/gmail/nossr50/util/Database.java index 84a2c2353..c918fd27b 100644 --- a/src/main/java/com/gmail/nossr50/util/Database.java +++ b/src/main/java/com/gmail/nossr50/util/Database.java @@ -66,10 +66,10 @@ public class Database { mcMMO.p.getLogger().info("Connection to MySQL was a success!"); } catch (SQLException ex) { connection = null; - if(reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("Connection to MySQL failed!"); + if (reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("Connection to MySQL failed!"); } catch (ClassNotFoundException ex) { connection = null; - if(reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("MySQL database driver not found!"); + if (reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("MySQL database driver not found!"); } } @@ -155,7 +155,7 @@ public class Database { PreparedStatement statement = null; try { - if(!checkConnected()) return; + if (!checkConnected()) return; statement = connection.prepareStatement(sql); resultSet = statement.executeQuery(); diff --git a/src/main/java/com/gmail/nossr50/util/Leaderboard.java b/src/main/java/com/gmail/nossr50/util/Leaderboard.java index 36c862838..30c9ae94d 100644 --- a/src/main/java/com/gmail/nossr50/util/Leaderboard.java +++ b/src/main/java/com/gmail/nossr50/util/Leaderboard.java @@ -301,7 +301,7 @@ public class Leaderboard { } } - if(!inserted) { + if (!inserted) { writer.append(ps.name + ":" + ps.statVal).append("\r\n"); } diff --git a/src/main/java/com/gmail/nossr50/util/Page.java b/src/main/java/com/gmail/nossr50/util/Page.java index 353060206..ed7c488e0 100644 --- a/src/main/java/com/gmail/nossr50/util/Page.java +++ b/src/main/java/com/gmail/nossr50/util/Page.java @@ -13,7 +13,7 @@ public class Page { public static int getTotalPageNumber(String address) { String[] addressSplit = LocaleLoader.getString(address).split("\n"); - if(addressSplit.length <= 8) + if (addressSplit.length <= 8) return 1; return (addressSplit.length/8)+1; @@ -24,7 +24,7 @@ public class Page { int pageIndexStart = 0; //Determine what string to start at - if(pagenum > 1) + if (pagenum > 1) { pageIndexStart = 8*(pagenum-1); } @@ -36,9 +36,9 @@ public class Page { //Add targeted strings - while(allStrings.size() < 9) + while (allStrings.size() < 9) { - if(pageIndexStart+allStrings.size() > split.length) + if (pageIndexStart+allStrings.size() > split.length) allStrings.add(""); else allStrings.add(split[pageIndexStart+allStrings.size()-1]); @@ -62,19 +62,19 @@ public class Page { player.sendMessage(ChatColor.DARK_AQUA+"Guide for "+capitalized+" available type /"+skilltype.toString().toLowerCase()+" ? [Page#]"); //TODO: Needs more locale. if (args.length >= 1) { - if(args[0].equals("?")) + if (args[0].equals("?")) { String address = "Guides."+capitalized; - if(args.length > 1 && Misc.isInt(args[1]) && Misc.getInt(args[1]) <= Page.getTotalPageNumber(address)) + if (args.length > 1 && Misc.isInt(args[1]) && Misc.getInt(args[1]) <= Page.getTotalPageNumber(address)) { Page.clearChat(player); for(String target : Page.grabPageContents(capitalized+" Guide", address, Misc.getInt(args[1]))) { player.sendMessage(target); } - } else if(args.length == 1) + } else if (args.length == 1) { Page.clearChat(player); for(String target : Page.grabPageContents(capitalized+" Guide", address, 1)) @@ -82,11 +82,11 @@ public class Page { player.sendMessage(target); } } - else if(args.length > 1 && Misc.getInt(args[1]) > Page.getTotalPageNumber(address)) + else if (args.length > 1 && Misc.getInt(args[1]) > Page.getTotalPageNumber(address)) { player.sendMessage("That page doesn't exist, there are only "+Page.getTotalPageNumber(address)+" total pages"); //TODO: Needs more locale. } - else if(args.length > 1 && !Misc.isInt(args[1])) + else if (args.length > 1 && !Misc.isInt(args[1])) { player.sendMessage("Not a valid page number!"); //TODO: Needs more locale. } diff --git a/src/main/java/com/gmail/nossr50/util/Permissions.java b/src/main/java/com/gmail/nossr50/util/Permissions.java index c976b7b5b..e81ee04cb 100644 --- a/src/main/java/com/gmail/nossr50/util/Permissions.java +++ b/src/main/java/com/gmail/nossr50/util/Permissions.java @@ -6,7 +6,7 @@ import org.bukkit.entity.Player; public class Permissions { public static boolean hasPermission(CommandSender sender, String perm) { - if(sender.hasPermission(perm)) + if (sender.hasPermission(perm)) return true; return false; @@ -14,7 +14,7 @@ public class Permissions { public static boolean hasPermission(Player sender, String perm) { - if(sender.hasPermission(perm)) + if (sender.hasPermission(perm)) return true; return false; diff --git a/src/main/java/com/gmail/nossr50/util/Skills.java b/src/main/java/com/gmail/nossr50/util/Skills.java index 894eaf020..69621adfc 100644 --- a/src/main/java/com/gmail/nossr50/util/Skills.java +++ b/src/main/java/com/gmail/nossr50/util/Skills.java @@ -38,7 +38,7 @@ public class Skills { * @param player The player whose cooldown is being checked * @return true if the cooldown is over, false otherwise */ - public static boolean cooldownOver(long oldTime, int cooldown, Player player){ + public static boolean cooldownOver(long oldTime, int cooldown, Player player) { long currentTime = System.currentTimeMillis(); int adjustedCooldown = cooldown; @@ -92,7 +92,7 @@ public class Skills { * @param ability The ability to watch cooldowns for */ public static void watchCooldown(Player player, PlayerProfile profile, AbilityType ability) { - if(player == null || profile == null || ability == null) + if (player == null || profile == null || ability == null) return; if (!profile.getAbilityInformed(ability) && cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) { @@ -510,14 +510,14 @@ public class Skills { * @param xp the amount of XP to gain */ public static void xpProcessing(Player player, PlayerProfile profile, SkillType type, int xp) { - if(player == null) + if (player == null) return; if (type.getPermissions(player)) { - if(Users.getPlayer(player) == null) + if (Users.getPlayer(player) == null) return; - if((type.getMaxLevel() < profile.getSkillLevel(type) + 1) || (Misc.getPowerLevelCap() < Users.getPlayer(player).getPowerLevel() + 1)) + if ((type.getMaxLevel() < profile.getSkillLevel(type) + 1) || (Misc.getPowerLevelCap() < Users.getPlayer(player).getPowerLevel() + 1)) return; Users.getPlayer(player).addXP(type, xp); diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManagerFactory.java b/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManagerFactory.java index b09e95eed..39f8732d3 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManagerFactory.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/ChunkletManagerFactory.java @@ -6,7 +6,7 @@ public class ChunkletManagerFactory { public static ChunkletManager getChunkletManager() { HiddenConfig hConfig = HiddenConfig.getInstance(); - if(hConfig.getChunkletsEnabled()) { + if (hConfig.getChunkletsEnabled()) { return new HashChunkletManager(); } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java index be5e823d9..d28531a5a 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/HashChunkletManager.java @@ -25,14 +25,14 @@ public class HashChunkletManager implements ChunkletManager { public void loadChunklet(int cx, int cy, int cz, World world) { File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); File cxDir = new File(dataDir, "" + cx); - if(!cxDir.exists()) return; + if (!cxDir.exists()) return; File czDir = new File(cxDir, "" + cz); - if(!czDir.exists()) return; + if (!czDir.exists()) return; File yFile = new File(czDir, "" + cy); - if(!yFile.exists()) return; + if (!yFile.exists()) return; ChunkletStore in = deserializeChunkletStore(yFile); - if(in != null) { + if (in != null) { store.put(world.getName() + "," + cx + "," + cz + "," + cy, in); } } @@ -40,11 +40,11 @@ public class HashChunkletManager implements ChunkletManager { @Override public void unloadChunklet(int cx, int cy, int cz, World world) { File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); - if(store.containsKey(world.getName() + "," + cx + "," + cz + "," + cy)) { + if (store.containsKey(world.getName() + "," + cx + "," + cz + "," + cy)) { File cxDir = new File(dataDir, "" + cx); - if(!cxDir.exists()) cxDir.mkdir(); + if (!cxDir.exists()) cxDir.mkdir(); File czDir = new File(cxDir, "" + cz); - if(!czDir.exists()) czDir.mkdir(); + if (!czDir.exists()) czDir.mkdir(); File yFile = new File(czDir, "" + cy); ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + cy); @@ -57,18 +57,18 @@ public class HashChunkletManager implements ChunkletManager { public void loadChunk(int cx, int cz, World world) { File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); File cxDir = new File(dataDir, "" + cx); - if(!cxDir.exists()) return; + if (!cxDir.exists()) return; File czDir = new File(cxDir, "" + cz); - if(!czDir.exists()) return; + if (!czDir.exists()) return; for(int y = 0; y < 4; y++) { File yFile = new File(czDir, "" + y); - if(!yFile.exists()) { + if (!yFile.exists()) { continue; } ChunkletStore in = deserializeChunkletStore(yFile); - if(in != null) { + if (in != null) { store.put(world.getName() + "," + cx + "," + cz + "," + y, in); } } @@ -79,11 +79,11 @@ public class HashChunkletManager implements ChunkletManager { File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); for(int y = 0; y < 4; y++) { - if(store.containsKey(world.getName() + "," + cx + "," + cz + "," + y)) { + if (store.containsKey(world.getName() + "," + cx + "," + cz + "," + y)) { File cxDir = new File(dataDir, "" + cx); - if(!cxDir.exists()) cxDir.mkdir(); + if (!cxDir.exists()) cxDir.mkdir(); File czDir = new File(cxDir, "" + cz); - if(!czDir.exists()) czDir.mkdir(); + if (!czDir.exists()) czDir.mkdir(); File yFile = new File(czDir, "" + y); ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + y); @@ -107,16 +107,16 @@ public class HashChunkletManager implements ChunkletManager { public void saveWorld(World world) { String worldName = world.getName(); File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); - if(!dataDir.exists()) + if (!dataDir.exists()) dataDir.mkdirs(); for(String key : store.keySet()) { String[] info = key.split(","); - if(worldName.equals(info[0])) { + if (worldName.equals(info[0])) { File cxDir = new File(dataDir, "" + info[1]); - if(!cxDir.exists()) cxDir.mkdir(); + if (!cxDir.exists()) cxDir.mkdir(); File czDir = new File(cxDir, "" + info[2]); - if(!czDir.exists()) czDir.mkdir(); + if (!czDir.exists()) czDir.mkdir(); File yFile = new File(czDir, "" + info[3]); serializeChunkletStore(store.get(key), yFile); @@ -132,7 +132,7 @@ public class HashChunkletManager implements ChunkletManager { for(String key : store.keySet()) { String tempWorldName = key.split(",")[0]; - if(tempWorldName.equals(worldName)) { + if (tempWorldName.equals(worldName)) { store.remove(key); return; } @@ -254,21 +254,21 @@ public class HashChunkletManager implements ChunkletManager { @Override public void cleanUp() { for(String key : store.keySet()) { - if(store.get(key).isEmpty()) { + if (store.get(key).isEmpty()) { String[] info = key.split(","); File dataDir = new File(Bukkit.getWorld(info[0]).getWorldFolder(), "mcmmo_data"); File cxDir = new File(dataDir, "" + info[1]); - if(!cxDir.exists()) continue; + if (!cxDir.exists()) continue; File czDir = new File(cxDir, "" + info[2]); - if(!czDir.exists()) continue; + if (!czDir.exists()) continue; File yFile = new File(czDir, "" + info[3]); yFile.delete(); //Delete empty directories - if(czDir.list().length == 0) czDir.delete(); - if(cxDir.list().length == 0) cxDir.delete(); + if (czDir.list().length == 0) czDir.delete(); + if (cxDir.list().length == 0) cxDir.delete(); } } } @@ -282,7 +282,7 @@ public class HashChunkletManager implements ChunkletManager { ObjectOutputStream objOut = null; try { - if(!location.exists()) + if (!location.exists()) location.createNewFile(); fileOut = new FileOutputStream(location); objOut = new ObjectOutputStream(fileOut); @@ -374,9 +374,9 @@ public class HashChunkletManager implements ChunkletManager { // IMPORTANT! If ChunkletStoreFactory is going to be returning something other than PrimitiveEx we need to remove this, as it will be breaking time for old maps /* - if(!(storeIn instanceof PrimitiveExChunkletStore)) { + if (!(storeIn instanceof PrimitiveExChunkletStore)) { ChunkletStore tempStore = ChunkletStoreFactory.getChunkletStore(); - if(storeIn != null) { + if (storeIn != null) { tempStore.copyFrom(storeIn); } storeIn = tempStore; diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveChunkletStore.java b/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveChunkletStore.java index 6ce9bd24b..1bcb2b309 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveChunkletStore.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveChunkletStore.java @@ -26,7 +26,7 @@ public class PrimitiveChunkletStore implements ChunkletStore { for(int x = 0; x < 16; x++) { for(int z = 0; z < 16; z++) { for(int y = 0; y < 64; y++) { - if(store[x][z][y]) return false; + if (store[x][z][y]) return false; } } } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveExChunkletStore.java b/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveExChunkletStore.java index bb5ec9ac8..8cc3bcb42 100644 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveExChunkletStore.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/PrimitiveExChunkletStore.java @@ -31,7 +31,7 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable { for(int x = 0; x < 16; x++) { for(int z = 0; z < 16; z++) { for(int y = 0; y < 64; y++) { - if(store[x][z][y]) return false; + if (store[x][z][y]) return false; } } } @@ -57,7 +57,7 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable { for(int x = 0; x < 16; x++) { for(int z = 0; z < 16; z++) { for(int y = 0; y < 64; y++) { - if(store[x][z][y]) { + if (store[x][z][y]) { byte[] temp = constructColumn(x, z); for(int i = 0; i < 9; i++) { @@ -81,7 +81,7 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable { byte[] temp = new byte[9]; // Could probably reorganize this loop to print nasty things if it does not equal 9 or -1 - while(in.read(temp, 0, 9) == 9) { + while (in.read(temp, 0, 9) == 9) { int x = addressByteX(temp[0]); int z = addressByteZ(temp[0]); boolean[] yColumn = new boolean[64]; @@ -127,13 +127,13 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable { column[0] = makeAddressByte(x, z); - for (int i = 0; i < 8; i++){ + for (int i = 0; i < 8; i++) { byte yCompressed = 0x0; int subColumnIndex = 8 * i; int subColumnEnd = subColumnIndex + 8; for(int y = subColumnIndex; y < subColumnEnd; y++) { - if(store[x][z][y]) { + if (store[x][z][y]) { yCompressed |= 1 << (y % 8); } } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/ChunkManagerFactory.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/ChunkManagerFactory.java index 0ef913396..efb3847ed 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/ChunkManagerFactory.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/ChunkManagerFactory.java @@ -6,7 +6,7 @@ public class ChunkManagerFactory { public static ChunkManager getChunkManager() { HiddenConfig hConfig = HiddenConfig.getInstance(); - if(hConfig.getChunkletsEnabled()) { + if (hConfig.getChunkletsEnabled()) { return new HashChunkManager(); } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java index bba0ed14a..bbe641270 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/HashChunkManager.java @@ -143,19 +143,19 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized void loadChunk(int cx, int cz, World world) { - if(world == null) + if (world == null) return; - if(store.containsKey(world.getName() + "," + cx + "," + cz)) + if (store.containsKey(world.getName() + "," + cx + "," + cz)) return; ChunkStore in = null; UUID key = world.getUID(); - if(!this.oldData.containsKey(key)) + if (!this.oldData.containsKey(key)) this.oldData.put(key, (new File(world.getWorldFolder(), "mcmmo_data")).exists()); - if(this.oldData.containsKey(key) && oldData.get(key)) + if (this.oldData.containsKey(key) && oldData.get(key)) convertChunk(new File(world.getWorldFolder(), "mcmmo_data"), cx, cz, world, true); try { @@ -163,20 +163,20 @@ public class HashChunkManager implements ChunkManager { } catch(Exception e) {} - if(in != null) { + if (in != null) { store.put(world.getName() + "," + cx + "," + cz, in); List mobs = in.getSpawnedMobs(); List pets = in.getSpawnedPets(); - if(mobs.isEmpty() && pets.isEmpty()) + if (mobs.isEmpty() && pets.isEmpty()) return; for(LivingEntity entity : world.getLivingEntities()) { - if(mobs.contains(entity.getUniqueId())) + if (mobs.contains(entity.getUniqueId())) addSpawnedMob(entity); - if(pets.contains(entity.getUniqueId())) + if (pets.contains(entity.getUniqueId())) addSpawnedPet(entity); } @@ -189,24 +189,24 @@ public class HashChunkManager implements ChunkManager { public synchronized void unloadChunk(int cx, int cz, World world) { saveChunk(cx, cz, world); - if(store.containsKey(world.getName() + "," + cx + "," + cz)) { + if (store.containsKey(world.getName() + "," + cx + "," + cz)) { store.remove(world.getName() + "," + cx + "," + cz); for(Entity entity : spawnedMobs) { - if(!isEntityInChunk(entity, cx, cz, world)) + if (!isEntityInChunk(entity, cx, cz, world)) continue; mobsToRemove.add(entity); } for(Entity entity : spawnedPets) { - if(!isEntityInChunk(entity, cx, cz, world)) + if (!isEntityInChunk(entity, cx, cz, world)) continue; mobsToRemove.add(entity); } - if(safeToRemoveMobs) { + if (safeToRemoveMobs) { spawnedMobs.remove(mobsToRemove); spawnedPets.remove(mobsToRemove); mobsToRemove.clear(); @@ -216,14 +216,14 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized void saveChunk(int cx, int cz, World world) { - if(world == null) + if (world == null) return; boolean unloaded = false; - if(!store.containsKey(world.getName() + "," + cx + "," + cz)) { + if (!store.containsKey(world.getName() + "," + cx + "," + cz)) { List tempSpawnedMobs = new ArrayList(spawnedMobs); for(Entity entity : tempSpawnedMobs) { - if(!isEntityInChunk(entity, cx, cz, world)) + if (!isEntityInChunk(entity, cx, cz, world)) continue; loadChunk(cx, cz, world); @@ -231,10 +231,10 @@ public class HashChunkManager implements ChunkManager { break; } - if(!unloaded) { + if (!unloaded) { List tempSpawnedPets = new ArrayList(spawnedPets); for(Entity entity : tempSpawnedPets) { - if(!isEntityInChunk(entity, cx, cz, world)) + if (!isEntityInChunk(entity, cx, cz, world)) continue; loadChunk(cx, cz, world); @@ -244,17 +244,17 @@ public class HashChunkManager implements ChunkManager { } } - if(!store.containsKey(world.getName() + "," + cx + "," + cz) && unloaded) { + if (!store.containsKey(world.getName() + "," + cx + "," + cz) && unloaded) { ChunkStore cStore = ChunkStoreFactory.getChunkStore(world, cx, cz); store.put(world.getName() + "," + cx + "," + cz, cStore); } - if(store.containsKey(world.getName() + "," + cx + "," + cz)) { + if (store.containsKey(world.getName() + "," + cx + "," + cz)) { ChunkStore out = store.get(world.getName() + "," + cx + "," + cz); List tempSpawnedMobs = new ArrayList(spawnedMobs); for(Entity entity : tempSpawnedMobs) { - if(!isEntityInChunk(entity, cx, cz, world)) + if (!isEntityInChunk(entity, cx, cz, world)) continue; out.addSpawnedMob(entity.getUniqueId()); @@ -262,13 +262,13 @@ public class HashChunkManager implements ChunkManager { List tempSpawnedPets = new ArrayList(spawnedPets); for(Entity entity : tempSpawnedPets) { - if(!isEntityInChunk(entity, cx, cz, world)) + if (!isEntityInChunk(entity, cx, cz, world)) continue; out.addSpawnedPet(entity.getUniqueId()); } - if(!out.isDirty()) + if (!out.isDirty()) return; writeChunkStore(world, cx, cz, out); @@ -276,16 +276,16 @@ public class HashChunkManager implements ChunkManager { } private boolean isEntityInChunk(Entity entity, int cx, int cz, World world) { - if(entity == null || world == null) + if (entity == null || world == null) return false; - if(entity.getLocation().getChunk().getX() != cx) + if (entity.getLocation().getChunk().getX() != cx) return false; - if(entity.getLocation().getChunk().getZ() != cz) + if (entity.getLocation().getChunk().getZ() != cz) return false; - if(entity.getWorld() != world) + if (entity.getWorld() != world) return false; return true; @@ -293,7 +293,7 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized boolean isChunkLoaded(int cx, int cz, World world) { - if(world == null) + if (world == null) return false; return store.containsKey(world.getName() + "," + cx + "," + cz); @@ -304,7 +304,7 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized void chunkUnloaded(int cx, int cz, World world) { - if(world == null) + if (world == null) return; ChunkletUnloader.addToList(cx, cz, world); @@ -312,7 +312,7 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized void saveWorld(World world) { - if(world == null) + if (world == null) return; closeAll(); @@ -321,7 +321,7 @@ public class HashChunkManager implements ChunkManager { List keys = new ArrayList(store.keySet()); for(String key : keys) { String[] info = key.split(","); - if(worldName.equals(info[0])) { + if (worldName.equals(info[0])) { int cx = 0; int cz = 0; @@ -340,7 +340,7 @@ public class HashChunkManager implements ChunkManager { for(Entity entity : tempSpawnedMobs) { World entityWorld = entity.getWorld(); - if(world != entityWorld) + if (world != entityWorld) continue; int cx = entity.getLocation().getChunk().getX(); @@ -353,7 +353,7 @@ public class HashChunkManager implements ChunkManager { for(Entity entity : tempSpawnedPets) { World entityWorld = entity.getWorld(); - if(world != entityWorld) + if (world != entityWorld) continue; int cx = entity.getLocation().getChunk().getX(); @@ -365,7 +365,7 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized void unloadWorld(World world) { - if(world == null) + if (world == null) return; closeAll(); @@ -374,7 +374,7 @@ public class HashChunkManager implements ChunkManager { List keys = new ArrayList(store.keySet()); for(String key : keys) { String[] info = key.split(","); - if(worldName.equals(info[0])) { + if (worldName.equals(info[0])) { int cx = 0; int cz = 0; @@ -395,7 +395,7 @@ public class HashChunkManager implements ChunkManager { for(Entity entity : tempSpawnedMobs) { World entityWorld = entity.getWorld(); - if(world != entityWorld) + if (world != entityWorld) continue; int cx = entity.getLocation().getChunk().getX(); @@ -408,7 +408,7 @@ public class HashChunkManager implements ChunkManager { for(Entity entity : tempSpawnedPets) { World entityWorld = entity.getWorld(); - if(world != entityWorld) + if (world != entityWorld) continue; int cx = entity.getLocation().getChunk().getX(); @@ -447,7 +447,7 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized boolean isTrue(int x, int y, int z, World world) { - if(world == null) + if (world == null) return false; int cx = x / 16; @@ -471,7 +471,7 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized boolean isTrue(Block block) { - if(block == null) + if (block == null) return false; return isTrue(block.getX(), block.getY(), block.getZ(), block.getWorld()); @@ -479,7 +479,7 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized void setTrue(int x, int y, int z, World world) { - if(world == null) + if (world == null) return; int cx = x / 16; @@ -506,7 +506,7 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized void setTrue(Block block) { - if(block == null) + if (block == null) return; setTrue(block.getX(), block.getY(), block.getZ(), block.getWorld()); @@ -514,7 +514,7 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized void setFalse(int x, int y, int z, World world) { - if(world == null) + if (world == null) return; int cx = x / 16; @@ -540,7 +540,7 @@ public class HashChunkManager implements ChunkManager { @Override public synchronized void setFalse(Block block) { - if(block == null) + if (block == null) return; setFalse(block.getX(), block.getY(), block.getZ(), block.getWorld()); @@ -554,21 +554,21 @@ public class HashChunkManager implements ChunkManager { } public synchronized void convertChunk(File dataDir, int cx, int cz, World world, boolean actually) { - if(!actually) + if (!actually) return; - if(!dataDir.exists()) return; + if (!dataDir.exists()) return; File cxDir = new File(dataDir, "" + cx); - if(!cxDir.exists()) return; + if (!cxDir.exists()) return; File czDir = new File(cxDir, "" + cz); - if(!czDir.exists()) return; + if (!czDir.exists()) return; boolean conversionSet = false; for(BlockStoreConversionZDirectory converter : this.converters) { - if(converter == null) + if (converter == null) continue; - if(converter.taskID >= 0) + if (converter.taskID >= 0) continue; converter.start(world, cxDir, czDir); @@ -576,7 +576,7 @@ public class HashChunkManager implements ChunkManager { break; } - if(!conversionSet) { + if (!conversionSet) { BlockStoreConversionZDirectory converter = new BlockStoreConversionZDirectory(); converter.start(world, cxDir, czDir); converters.add(converter); @@ -592,22 +592,22 @@ public class HashChunkManager implements ChunkManager { } public void addSpawnedMob(Entity entity) { - if(!isSpawnedMob(entity)) + if (!isSpawnedMob(entity)) spawnedMobs.add(entity); } public void addSpawnedPet(Entity entity) { - if(!isSpawnedPet(entity)) + if (!isSpawnedPet(entity)) spawnedPets.add(entity); } public void removeSpawnedMob(Entity entity) { - if(isSpawnedMob(entity)) + if (isSpawnedMob(entity)) spawnedMobs.remove(entity); } public void removeSpawnedPet(Entity entity) { - if(isSpawnedPet(entity)) + if (isSpawnedPet(entity)) spawnedPets.remove(entity); } } diff --git a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java index a97cd7fa9..e8a6dd202 100755 --- a/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java +++ b/src/main/java/com/gmail/nossr50/util/blockmeta/chunkmeta/PrimitiveChunkStore.java @@ -85,7 +85,7 @@ public class PrimitiveChunkStore implements ChunkStore { for(int x = 0; x < 16; x++) { for(int z = 0; z < 16; z++) { for(int y = 0; y < this.worldHeight; y++) { - if(store[x][z][y]) return false; + if (store[x][z][y]) return false; } } } @@ -113,42 +113,42 @@ public class PrimitiveChunkStore implements ChunkStore { } public void addSpawnedMob(UUID id) { - if(!isSpawnedMob(id)) { + if (!isSpawnedMob(id)) { spawnedMobs.add(id); dirty = true; } } public void addSpawnedPet(UUID id) { - if(!isSpawnedPet(id)) { + if (!isSpawnedPet(id)) { spawnedPets.add(id); dirty = true; } } public void removeSpawnedMob(UUID id) { - if(isSpawnedMob(id)) { + if (isSpawnedMob(id)) { spawnedMobs.remove(id); dirty = true; } } public void removeSpawnedPet(UUID id) { - if(isSpawnedPet(id)) { + if (isSpawnedPet(id)) { spawnedPets.remove(id); dirty = true; } } public void clearSpawnedMobs() { - if(!spawnedMobs.isEmpty()) { + if (!spawnedMobs.isEmpty()) { spawnedMobs.clear(); dirty = true; } } public void clearSpawnedPets() { - if(!spawnedPets.isEmpty()) { + if (!spawnedPets.isEmpty()) { spawnedPets.clear(); dirty = true; } @@ -204,16 +204,16 @@ public class PrimitiveChunkStore implements ChunkStore { store = (boolean[][][]) in.readObject(); if (fileVersionNumber < CURRENT_VERSION) { - if(fileVersionNumber < 5) + if (fileVersionNumber < 5) fixArray(); - if(fileVersionNumber < 6) { + if (fileVersionNumber < 6) { spawnedMobs = new ArrayList(); spawnedPets = new ArrayList(); } dirty = true; } - if(fileVersionNumber >= 6) { + if (fileVersionNumber >= 6) { //What do we want to do about this? These casts are unchecked. spawnedMobs = (ArrayList) in.readObject(); spawnedPets = (ArrayList) in.readObject();