My OCD made me do it.

This commit is contained in:
gmcferrin 2013-01-09 23:03:17 -05:00
parent c60cbe824c
commit e193da2cd7
57 changed files with 276 additions and 276 deletions

View File

@ -44,24 +44,24 @@ public class AcrobaticsCommand extends SkillCommand {
float gracefulRollChanceF; float gracefulRollChanceF;
// DODGE // DODGE
if(skillValue >= dodgeMaxBonusLevel) dodgeChanceF = dodgeChanceMax; if (skillValue >= dodgeMaxBonusLevel) dodgeChanceF = dodgeChanceMax;
else dodgeChanceF = (float) (((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * skillValue); else dodgeChanceF = (float) (((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * skillValue);
dodgeChance = df.format(dodgeChanceF); 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); else dodgeChanceLucky = df.format(dodgeChanceF + dodgeChanceF * 0.3333D);
// ROLL // ROLL
if(skillValue >= rollMaxBonusLevel) rollChanceF = rollChanceMax; if (skillValue >= rollMaxBonusLevel) rollChanceF = rollChanceMax;
else rollChanceF = (float) (((double) rollChanceMax / (double) rollMaxBonusLevel) * skillValue); else rollChanceF = (float) (((double) rollChanceMax / (double) rollMaxBonusLevel) * skillValue);
rollChance = df.format(rollChanceF); 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); else rollChanceLucky = df.format(rollChanceF + rollChanceF * 0.3333D);
// GRACEFULROLL // GRACEFULROLL
if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChanceF = gracefulRollChanceMax; if (skillValue >= gracefulRollMaxBonusLevel) gracefulRollChanceF = gracefulRollChanceMax;
else gracefulRollChanceF = (float) (((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * skillValue); else gracefulRollChanceF = (float) (((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * skillValue);
gracefulRollChance = df.format(gracefulRollChanceF); 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); else gracefulRollChanceLucky = df.format(gracefulRollChanceF + gracefulRollChanceF * 0.3333D);
} }

View File

@ -50,17 +50,17 @@ public class ArcheryCommand extends SkillCommand {
else skillShotBonus = percent.format(bonus); else skillShotBonus = percent.format(bonus);
// Daze // Daze
if(skillValue >= dazeMaxBonusLevel) dazeChanceF = dazeBonusMax; if (skillValue >= dazeMaxBonusLevel) dazeChanceF = dazeBonusMax;
else dazeChanceF = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillValue); else dazeChanceF = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillValue);
dazeChance = df.format(dazeChanceF); 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); else dazeChanceLucky = df.format(dazeChanceF + dazeChanceF * 0.3333D);
// Retrieve // Retrieve
if(skillValue >= retrieveMaxBonusLevel) retrieveChanceF = retrieveBonusMax; if (skillValue >= retrieveMaxBonusLevel) retrieveChanceF = retrieveBonusMax;
else retrieveChanceF = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillValue); else retrieveChanceF = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillValue);
retrieveChance = df.format(retrieveChanceF); 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); else retrieveChanceLucky = df.format(retrieveChanceF + retrieveChanceF * 0.3333D);
} }

View File

@ -56,7 +56,7 @@ public class AxesCommand extends SkillCommand {
if (skillValue >= critMaxBonusLevel) critChanceF = (float) critMaxChance; if (skillValue >= critMaxBonusLevel) critChanceF = (float) critMaxChance;
else critChanceF = (float) ((critMaxChance / critMaxBonusLevel) * skillCheck); else critChanceF = (float) ((critMaxChance / critMaxBonusLevel) * skillCheck);
critChance = df.format(critChanceF); 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); else critChanceLucky = df.format(critChanceF + critChanceF * 0.3333D);
//Axe Mastery //Axe Mastery
if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax); 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}) })); 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")) 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 })); player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { critChanceLucky }));
else else

View File

@ -45,12 +45,12 @@ public class FishingCommand extends SkillCommand {
int dropChance = Fishing.getShakeChance(lootTier); int dropChance = Fishing.getShakeChance(lootTier);
shakeChance = df.format(dropChance); 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)); else shakeChanceLucky = df.format(dropChance + (dropChance * 0.3333D));
shakeUnlockLevel = advancedConfig.getShakeUnlockLevel(); shakeUnlockLevel = advancedConfig.getShakeUnlockLevel();
//Fishermans Diet //Fishermans Diet
if(skillValue >= fishermansDietRankMaxLevel) fishermansDietRank = "5"; if (skillValue >= fishermansDietRankMaxLevel) fishermansDietRank = "5";
else fishermansDietRank = String.valueOf((int) ((double) skillValue / (double) fishermansDietRankChange)); else fishermansDietRank = String.valueOf((int) ((double) skillValue / (double) fishermansDietRankChange));
} }

View File

@ -51,22 +51,22 @@ public class HerbalismCommand extends SkillCommand {
float doubleDropChanceF; float doubleDropChanceF;
greenTerraLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); greenTerraLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
//FARMERS DIET //FARMERS DIET
if(skillValue >= farmersDietMaxLevel) farmersDietRank = "5"; if (skillValue >= farmersDietMaxLevel) farmersDietRank = "5";
else farmersDietRank = String.valueOf((int) ((double) skillValue / (double) farmersDietRankChange)); else farmersDietRank = String.valueOf((int) ((double) skillValue / (double) farmersDietRankChange));
//GREEN THUMB //GREEN THUMB
if(skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4"; if (skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4";
else greenThumbStage = String.valueOf((int) ((double) skillValue / (double) greenThumbStageChange)); 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); else greenThumbChanceF = (float) ((greenThumbMaxBonus / greenThumbMaxLevel) * skillValue);
greenThumbChance = df.format(greenThumbChanceF); 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); else greenThumbChanceLucky = df.format(greenThumbChanceF + greenThumbChanceF * 0.3333D);
//DOUBLE DROPS //DOUBLE DROPS
if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus); if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
doubleDropChance = df.format(doubleDropChanceF); 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); else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
} }

View File

@ -53,10 +53,10 @@ public class MiningCommand extends SkillCommand {
//Super Breaker //Super Breaker
superBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); superBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
//Double Drops //Double Drops
if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus); if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue); else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
doubleDropChance = df.format(doubleDropChanceF); 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); else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
//Blast Mining //Blast Mining

View File

@ -67,13 +67,13 @@ public class RepairCommand extends SkillCommand {
salvageLevel = Config.getInstance().getSalvageUnlockLevel(); 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); 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); else superRepairChanceF = (float) (((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * skillValue);
superRepairChance = df.format(superRepairChanceF); 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); else superRepairChanceLucky = df.format(superRepairChanceF + superRepairChanceF * 0.3333D);
arcaneForgingRank = Repair.getArcaneForgingRank(profile); arcaneForgingRank = Repair.getArcaneForgingRank(profile);

View File

@ -48,16 +48,16 @@ public class SwordsCommand extends SkillCommand {
if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks); if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks);
else bleedLength = String.valueOf(bleedBaseTicks); else bleedLength = String.valueOf(bleedBaseTicks);
if(skillValue >= bleedMaxLevel) bleedChanceF = bleedChanceMax; if (skillValue >= bleedMaxLevel) bleedChanceF = bleedChanceMax;
else bleedChanceF = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * skillValue); else bleedChanceF = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * skillValue);
bleedChance = df.format(bleedChanceF); 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); 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); else counterAttackChanceF = (float) (((double) counterChanceMax / (double) counterMaxLevel) * skillValue);
counterAttackChance = df.format(counterAttackChanceF); 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); else counterAttackChanceLucky = df.format(counterAttackChanceF + counterAttackChanceF * 0.3333D);
} }

View File

@ -43,10 +43,10 @@ public class TamingCommand extends SkillCommand {
protected void dataCalculations() { protected void dataCalculations() {
DecimalFormat df = new DecimalFormat("0.0"); DecimalFormat df = new DecimalFormat("0.0");
float goreChanceF; float goreChanceF;
if(skillValue >= goreMaxLevel) goreChanceF = (goreChanceMax); if (skillValue >= goreMaxLevel) goreChanceF = (goreChanceMax);
else goreChanceF = (float) (((double) goreChanceMax / (double) goreMaxLevel) * skillValue); else goreChanceF = (float) (((double) goreChanceMax / (double) goreMaxLevel) * skillValue);
goreChance = df.format(goreChanceF); 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); else goreChanceLucky = df.format(goreChanceF + goreChanceF * 0.3333D);
} }

View File

@ -44,16 +44,16 @@ public class UnarmedCommand extends SkillCommand {
float deflectChanceF; float deflectChanceF;
berserkLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); 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); else disarmChanceF = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * skillValue);
disarmChance = df.format(disarmChanceF); 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); 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); else deflectChanceF = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * skillValue);
deflectChance = df.format(deflectChanceF); 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); else deflectChanceLucky = df.format(deflectChanceF + deflectChanceF * 0.3333D);
if (skillValue >= 250) ironArmBonus = String.valueOf(ironArmMaxBonus); if (skillValue >= 250) ironArmBonus = String.valueOf(ironArmMaxBonus);

View File

@ -38,10 +38,10 @@ public class WoodcuttingCommand extends SkillCommand {
float doubleDropChanceF; float doubleDropChanceF;
treeFellerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel)); 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); else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
doubleDropChance = df.format(doubleDropChanceF); 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); else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
} }

View File

@ -16,13 +16,13 @@ public abstract class ConfigLoader {
protected File configFile; protected File configFile;
protected FileConfiguration config; protected FileConfiguration config;
public ConfigLoader(String relativePath, String fileName){ public ConfigLoader(String relativePath, String fileName) {
this.fileName = fileName; this.fileName = fileName;
configFile = new File(plugin.getDataFolder(), relativePath + File.separator + fileName); configFile = new File(plugin.getDataFolder(), relativePath + File.separator + fileName);
loadFile(); loadFile();
} }
public ConfigLoader(String fileName){ public ConfigLoader(String fileName) {
this.fileName = fileName; this.fileName = fileName;
configFile = new File(plugin.getDataFolder(), fileName); configFile = new File(plugin.getDataFolder(), fileName);
loadFile(); loadFile();

View File

@ -202,11 +202,11 @@ public class TreasuresConfig extends ConfigLoader{
int dropLevel = fTreasure.getDropLevel(); int dropLevel = fTreasure.getDropLevel();
int maxLevel = fTreasure.getMaxLevel(); 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); fishingRewardsTier1.add(fTreasure);
} }
if(dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) { if (dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) {
fishingRewardsTier2.add(fTreasure); fishingRewardsTier2.add(fTreasure);
} }

View File

@ -49,7 +49,7 @@ public class CustomArmorConfig extends ConfigLoader{
private void loadArmor(String armorType, List<Integer> idList) { private void loadArmor(String armorType, List<Integer> idList) {
ConfigurationSection armorSection = config.getConfigurationSection(armorType); ConfigurationSection armorSection = config.getConfigurationSection(armorType);
if(armorSection == null) if (armorSection == null)
return; return;
Set<String> armorConfigSet = armorSection.getKeys(false); Set<String> armorConfigSet = armorSection.getKeys(false);
@ -88,7 +88,7 @@ public class CustomArmorConfig extends ConfigLoader{
} }
public List<Repairable> getLoadedRepairables() { public List<Repairable> getLoadedRepairables() {
if(repairables == null) return new ArrayList<Repairable>(); if (repairables == null) return new ArrayList<Repairable>();
return repairables; return repairables;
} }
} }

View File

@ -49,7 +49,7 @@ public class CustomBlocksConfig extends ConfigLoader {
private void loadBlocks(String skillType, List<ItemStack> blockList) { private void loadBlocks(String skillType, List<ItemStack> blockList) {
ConfigurationSection skillSection = config.getConfigurationSection(skillType); ConfigurationSection skillSection = config.getConfigurationSection(skillType);
if(skillSection == null) if (skillSection == null)
return; return;
Set<String> skillConfigSet = skillSection.getKeys(false); Set<String> skillConfigSet = skillSection.getKeys(false);

View File

@ -53,7 +53,7 @@ public class CustomToolsConfig extends ConfigLoader {
private void loadTool(String toolType, List<Integer> idList) { private void loadTool(String toolType, List<Integer> idList) {
ConfigurationSection toolSection = config.getConfigurationSection(toolType); ConfigurationSection toolSection = config.getConfigurationSection(toolType);
if(toolSection == null) if (toolSection == null)
return; return;
Set<String> toolConfigSet = toolSection.getKeys(false); Set<String> toolConfigSet = toolSection.getKeys(false);
@ -95,7 +95,7 @@ public class CustomToolsConfig extends ConfigLoader {
} }
public List<Repairable> getLoadedRepairables() { public List<Repairable> getLoadedRepairables() {
if(repairables == null) return new ArrayList<Repairable>(); if (repairables == null) return new ArrayList<Repairable>();
return repairables; return repairables;
} }
} }

View File

@ -120,9 +120,9 @@ public class McMMOPlayer {
* @param newvalue The amount of XP to add * @param newvalue The amount of XP to add
*/ */
public void addXP(SkillType skillType, int newValue) { public void addXP(SkillType skillType, int newValue) {
if(player == null) if (player == null)
return; return;
else if(player.getGameMode() == null) else if (player.getGameMode() == null)
return; return;
if (player.getGameMode().equals(GameMode.CREATIVE)) { if (player.getGameMode().equals(GameMode.CREATIVE)) {

View File

@ -297,7 +297,7 @@ public class PlayerProfile {
public void save(boolean override) { public void save(boolean override) {
Long timestamp = System.currentTimeMillis(); Long timestamp = System.currentTimeMillis();
if(timestamp < (lastSave + ((long) Config.getInstance().getSaveInterval() * 60000)) && !override) if (timestamp < (lastSave + ((long) Config.getInstance().getSaveInterval() * 60000)) && !override)
return; return;
// if we are using mysql save to database // if we are using mysql save to database

View File

@ -128,7 +128,7 @@ public class BlockListener implements Listener {
int id = block.getTypeId(); int id = block.getTypeId();
Material type = block.getType(); 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 */ /* Code to prevent issues with placed falling Sand/Gravel not being tracked */
if (type.equals(Material.SAND) || type.equals(Material.GRAVEL)) { if (type.equals(Material.SAND) || type.equals(Material.GRAVEL)) {
@ -171,7 +171,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer(); 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); 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)) { if ((relativeType == Material.SAND || relativeType == Material.GRAVEL) && mcMMO.placeStore.isTrue(relative)) {
mcMMO.placeStore.setFalse(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); mcMMO.placeStore.setFalse(relative);
} }
else { else {
@ -284,7 +284,7 @@ public class BlockListener implements Listener {
Player player = event.getPlayer(); 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); PlayerProfile profile = Users.getProfile(player);

View File

@ -60,13 +60,13 @@ public class EntityListener implements Listener {
if (event instanceof FakeEntityDamageByEntityEvent) if (event instanceof FakeEntityDamageByEntityEvent)
return; return;
if(event.getDamage() <= 0) if (event.getDamage() <= 0)
return; return;
Entity attacker = event.getDamager(); Entity attacker = event.getDamager();
Entity defender = event.getEntity(); 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) { if (attacker instanceof Projectile) {
attacker = ((Projectile) attacker).getShooter(); attacker = ((Projectile) attacker).getShooter();
@ -118,7 +118,7 @@ public class EntityListener implements Listener {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
DamageCause cause = event.getCause(); 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)) { if (!(entity instanceof LivingEntity)) {
return; return;
@ -179,7 +179,7 @@ public class EntityListener implements Listener {
public void onEntityDeath(EntityDeathEvent event) { public void onEntityDeath(EntityDeathEvent event) {
LivingEntity entity = event.getEntity(); 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); entity.setFireTicks(0);
BleedTimer.remove(entity); BleedTimer.remove(entity);
@ -211,7 +211,7 @@ public class EntityListener implements Listener {
public void onExplosionPrime(ExplosionPrimeEvent event) { public void onExplosionPrime(ExplosionPrimeEvent event) {
Entity entity = event.getEntity(); 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) { if (entity instanceof TNTPrimed) {
int id = entity.getEntityId(); int id = entity.getEntityId();
@ -236,9 +236,9 @@ public class EntityListener implements Listener {
public void onEnitityExplode(EntityExplodeEvent event) { public void onEnitityExplode(EntityExplodeEvent event) {
Entity entity = event.getEntity(); 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) { if (entity instanceof TNTPrimed) {
int id = entity.getEntityId(); int id = entity.getEntityId();
@ -263,7 +263,7 @@ public class EntityListener implements Listener {
if (event.getEntity() instanceof Player) { if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity(); 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); PlayerProfile profile = Users.getProfile(player);
int currentFoodLevel = player.getFoodLevel(); int currentFoodLevel = player.getFoodLevel();
@ -399,7 +399,7 @@ public class EntityListener implements Listener {
public void onEntityTame(EntityTameEvent event) { public void onEntityTame(EntityTameEvent event) {
Player player = (Player) event.getOwner(); 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())) { if (Permissions.taming(player) && !mcMMO.placeStore.isSpawnedPet(event.getEntity())) {
PlayerProfile profile = Users.getProfile(player); PlayerProfile profile = Users.getProfile(player);

View File

@ -21,7 +21,7 @@ public class HardcoreListener implements Listener {
public void onPlayerDeath(PlayerDeathEvent event) { public void onPlayerDeath(PlayerDeathEvent event) {
Player player = event.getEntity(); //Note this returns a Player object for this subevent 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 (!Permissions.hardcoremodeBypass(player)) {
if (player.getKiller() != null && Config.getInstance().getHardcoreVampirismEnabled()) { if (player.getKiller() != null && Config.getInstance().getHardcoreVampirismEnabled()) {

View File

@ -63,7 +63,7 @@ public class PlayerListener implements Listener {
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) { public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
Player player = event.getPlayer(); 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); PlayerProfile profile = Users.getProfile(player);
@ -97,7 +97,7 @@ public class PlayerListener implements Listener {
int shakeUnlockLevel = advancedConfig.getShakeUnlockLevel(); int shakeUnlockLevel = advancedConfig.getShakeUnlockLevel();
Player player = event.getPlayer(); 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)) { if (Permissions.fishing(player)) {
State state = event.getState(); State state = event.getState();
@ -131,7 +131,7 @@ public class PlayerListener implements Listener {
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onPlayerPickupItem(PlayerPickupItemEvent event) { 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()); PlayerProfile profile = Users.getProfile(event.getPlayer());
@ -151,7 +151,7 @@ public class PlayerListener implements Listener {
*/ */
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerLogin(PlayerLoginEvent event) { 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(); Users.addUser(event.getPlayer()).getProfile().actualizeRespawnATS();
} }
@ -164,7 +164,7 @@ public class PlayerListener implements Listener {
public void onPlayerQuit(PlayerQuitEvent event) { public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer(); 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 */ /* GARBAGE COLLECTION */
@ -181,7 +181,7 @@ public class PlayerListener implements Listener {
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer(); 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. //TODO: Locale ALL the things.
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) { if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
@ -287,7 +287,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerRespawn(PlayerRespawnEvent event) { 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()); PlayerProfile profile = Users.getProfile(event.getPlayer());
if (profile != null) { if (profile != null) {
@ -303,7 +303,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
Player player = event.getPlayer(); 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(); Action action = event.getAction();
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
ItemStack inHand = player.getItemInHand(); ItemStack inHand = player.getItemInHand();
@ -427,7 +427,7 @@ public class PlayerListener implements Listener {
public void onPlayerChat(AsyncPlayerChatEvent event) { public void onPlayerChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer(); 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); PlayerProfile profile = Users.getProfile(player);

View File

@ -19,7 +19,7 @@ public class SelfListener implements Listener {
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) { public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
int xp = event.getXpGained(); int xp = event.getXpGained();
if(xp < 0) { if (xp < 0) {
try { try {
throw new Exception("Gained negative XP!"); throw new Exception("Gained negative XP!");
} }

View File

@ -20,11 +20,11 @@ public class WorldListener implements Listener {
@EventHandler @EventHandler
public void onWorldInit(WorldInitEvent event) { public void onWorldInit(WorldInitEvent event) {
File dataDir = new File(event.getWorld().getWorldFolder(), "mcmmo_data"); File dataDir = new File(event.getWorld().getWorldFolder(), "mcmmo_data");
if(!dataDir.exists()) { if (!dataDir.exists()) {
return; return;
} }
if(mcMMO.p == null) if (mcMMO.p == null)
return; return;
mcMMO.p.getLogger().info("Converting block storage for " + event.getWorld().getName() + " to a new format."); 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 @EventHandler
public void onChunkLoad(ChunkLoadEvent event) { 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()); mcMMO.placeStore.loadChunk(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld());
} }
} }

View File

@ -146,7 +146,7 @@ public class mcMMO extends JavaPlugin {
repairManager.registerRepairables(repairables); repairManager.registerRepairables(repairables);
//Check if Repair Anvil and Salvage Anvil have different itemID's //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!"); getLogger().warning("Can't use the same itemID for Repair/Salvage Anvils!");
} }

View File

@ -42,7 +42,7 @@ public class ChunkletUnloader implements Runnable {
//Chunklets are unloaded only if their chunk has been unloaded for minimumInactiveTime //Chunklets are unloaded only if their chunk has been unloaded for minimumInactiveTime
if (inactiveTime >= minimumInactiveTime) { if (inactiveTime >= minimumInactiveTime) {
if(mcMMO.placeStore == null) if (mcMMO.placeStore == null)
continue; continue;
mcMMO.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld()); mcMMO.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld());

View File

@ -23,7 +23,7 @@ public class GreenThumbTimer implements Runnable {
@Override @Override
public void run() { public void run() {
if(this.block.getType() != this.type) if (this.block.getType() != this.type)
this.block.setType(this.type); this.block.setType(this.type);
int skillLevel = this.profile.getSkillLevel(SkillType.HERBALISM); int skillLevel = this.profile.getSkillLevel(SkillType.HERBALISM);

View File

@ -25,7 +25,7 @@ public class BlockStoreConversionMain implements Runnable {
} }
public void start() { public void start() {
if(this.taskID >= 0) if (this.taskID >= 0)
return; return;
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1); this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
@ -34,18 +34,18 @@ public class BlockStoreConversionMain implements Runnable {
@Override @Override
public void run() { public void run() {
if(!this.dataDir.exists()) { if (!this.dataDir.exists()) {
softStop(); softStop();
return; return;
} }
if(!this.dataDir.isDirectory()) { if (!this.dataDir.isDirectory()) {
this.dataDir.delete(); this.dataDir.delete();
softStop(); softStop();
return; return;
} }
if(this.dataDir.listFiles().length <= 0) { if (this.dataDir.listFiles().length <= 0) {
this.dataDir.delete(); this.dataDir.delete();
softStop(); softStop();
return; return;
@ -54,7 +54,7 @@ public class BlockStoreConversionMain implements Runnable {
this.xDirs = this.dataDir.listFiles(); this.xDirs = this.dataDir.listFiles();
for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.xDirs.length); this.i++) { 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] = new BlockStoreConversionXDirectory();
this.converters[this.i].start(this.world, this.xDirs[this.i]); this.converters[this.i].start(this.world, this.xDirs[this.i]);
@ -64,7 +64,7 @@ public class BlockStoreConversionMain implements Runnable {
} }
public void stop() { public void stop() {
if(this.taskID < 0) if (this.taskID < 0)
return; return;
this.scheduler.cancelTask(this.taskID); this.scheduler.cancelTask(this.taskID);
@ -74,7 +74,7 @@ public class BlockStoreConversionMain implements Runnable {
public void softStop() { public void softStop() {
stop(); stop();
if(this.dataDir.exists() || this.dataDir.isDirectory()) { if (this.dataDir.exists() || this.dataDir.isDirectory()) {
start(); start();
return; return;
} }

View File

@ -26,7 +26,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
this.converters = new BlockStoreConversionZDirectory[HiddenConfig.getInstance().getConversionRate()]; this.converters = new BlockStoreConversionZDirectory[HiddenConfig.getInstance().getConversionRate()];
this.dataDir = dataDir; this.dataDir = dataDir;
if(this.taskID >= 0) if (this.taskID >= 0)
return; return;
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1); this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
@ -35,18 +35,18 @@ public class BlockStoreConversionXDirectory implements Runnable {
@Override @Override
public void run() { public void run() {
if(!this.dataDir.exists()) { if (!this.dataDir.exists()) {
stop(); stop();
return; return;
} }
if(!this.dataDir.isDirectory()) { if (!this.dataDir.isDirectory()) {
this.dataDir.delete(); this.dataDir.delete();
stop(); stop();
return; return;
} }
if(this.dataDir.listFiles().length <= 0) { if (this.dataDir.listFiles().length <= 0) {
this.dataDir.delete(); this.dataDir.delete();
stop(); stop();
return; return;
@ -55,7 +55,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
this.zDirs = this.dataDir.listFiles(); this.zDirs = this.dataDir.listFiles();
for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.zDirs.length); this.i++) { 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] = new BlockStoreConversionZDirectory();
this.converters[this.i].start(this.world, this.dataDir, this.zDirs[this.i]); 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() { public void stop() {
if(this.taskID < 0) if (this.taskID < 0)
return; return;
this.scheduler.cancelTask(this.taskID); this.scheduler.cancelTask(this.taskID);

View File

@ -40,7 +40,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
this.dataDir = dataDir; this.dataDir = dataDir;
this.xDir = xDir; this.xDir = xDir;
if(this.taskID >= 0) if (this.taskID >= 0)
return; return;
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1); this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
@ -49,18 +49,18 @@ public class BlockStoreConversionZDirectory implements Runnable {
@Override @Override
public void run() { public void run() {
if(!this.dataDir.exists()) { if (!this.dataDir.exists()) {
stop(); stop();
return; return;
} }
if(!this.dataDir.isDirectory()) { if (!this.dataDir.isDirectory()) {
this.dataDir.delete(); this.dataDir.delete();
stop(); stop();
return; return;
} }
if(this.dataDir.listFiles().length <= 0) { if (this.dataDir.listFiles().length <= 0) {
this.dataDir.delete(); this.dataDir.delete();
stop(); stop();
return; return;
@ -112,7 +112,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
for(this.y2 = (64 * this.y); this.y2 < (64 * this.y + 64); this.y2++) { for(this.y2 = (64 * this.y); this.y2 < (64 * this.y + 64); this.y2++) {
try { 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; continue;
this.newManager.setTrue(this.cxPos, this.y2, this.czPos, this.world); 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.x = 0; this.x < 16; this.x++) {
for(this.z = 0; this.z < 16; this.z++) { for(this.z = 0; this.z < 16; this.z++) {
if(this.primitiveChunklet != null) if (this.primitiveChunklet != null)
this.oldArray = this.primitiveChunklet.store[x][z]; this.oldArray = this.primitiveChunklet.store[x][z];
if(this.primitiveExChunklet != null) if (this.primitiveExChunklet != null)
this.oldArray = this.primitiveExChunklet.store[x][z]; this.oldArray = this.primitiveExChunklet.store[x][z];
else else
return; return;
this.newArray = this.currentChunk.store[x][z]; this.newArray = this.currentChunk.store[x][z];
if(this.oldArray.length < 64) if (this.oldArray.length < 64)
return; return;
else if(this.newArray.length < ((this.y * 64) + 64)) else if (this.newArray.length < ((this.y * 64) + 64))
return; return;
System.arraycopy(this.oldArray, 0, this.newArray, (this.y * 64), 64); 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); this.newManager.unloadChunk(this.cx, this.cz, this.world);
for(File yFile : dataDir.listFiles()) { for(File yFile : dataDir.listFiles()) {
if(!yFile.exists()) if (!yFile.exists())
continue; continue;
yFile.delete(); yFile.delete();
@ -160,7 +160,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
} }
public void stop() { public void stop() {
if(this.taskID < 0) if (this.taskID < 0)
return; return;
this.scheduler.cancelTask(taskID); this.scheduler.cancelTask(taskID);

View File

@ -33,7 +33,7 @@ public class Axes {
* @param event The event to modify * @param event The event to modify
*/ */
public static void axesBonus(Player attacker, EntityDamageByEntityEvent event) { public static void axesBonus(Player attacker, EntityDamageByEntityEvent event) {
if(attacker == null) if (attacker == null)
return; return;
final int MAX_BONUS = advancedConfig.getBonusDamageAxesBonusMax(); final int MAX_BONUS = advancedConfig.getBonusDamageAxesBonusMax();
@ -57,7 +57,7 @@ public class Axes {
* @param event The event to modify * @param event The event to modify
*/ */
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event) { public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event) {
if(attacker == null) if (attacker == null)
return; return;
Entity entity = event.getEntity(); Entity entity = event.getEntity();
@ -95,10 +95,10 @@ public class Axes {
randomChance = (int) (randomChance * 0.75); randomChance = (int) (randomChance * 0.75);
} }
if (chance > random.nextInt(randomChance) && !entity.isDead()){ if (chance > random.nextInt(randomChance) && !entity.isDead()) {
int damage = event.getDamage(); int damage = event.getDamage();
if (entity instanceof Player){ if (entity instanceof Player) {
event.setDamage((int) (damage * PVP_MODIFIER)); event.setDamage((int) (damage * PVP_MODIFIER));
((Player) entity).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck")); ((Player) entity).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
} }
@ -118,7 +118,7 @@ public class Axes {
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static void impact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) { public static void impact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
if(attacker == null) if (attacker == null)
return; return;
/* /*
@ -140,7 +140,7 @@ public class Axes {
} }
else { else {
for (ItemStack armor : targetPlayer.getInventory().getArmorContents()) { for (ItemStack armor : targetPlayer.getInventory().getArmorContents()) {
if(Math.random() * 100 > 75) { if (Math.random() * 100 > 75) {
int lowerdamage = 0; int lowerdamage = 0;
for (int i = 0; i <= durabilityDamage; i ++) { for (int i = 0; i <= durabilityDamage; i ++) {
if (armor.containsEnchantment(Enchantment.DURABILITY)) { if (armor.containsEnchantment(Enchantment.DURABILITY)) {
@ -172,7 +172,7 @@ public class Axes {
* @param event The event to modify * @param event The event to modify
*/ */
private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) { private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
if(attacker == null) if (attacker == null)
return; return;
final int GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance(); final int GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance();
@ -203,7 +203,7 @@ public class Axes {
* @return true if the player has armor, false otherwise * @return true if the player has armor, false otherwise
*/ */
private static boolean hasArmor(Player player) { private static boolean hasArmor(Player player) {
if(player == null) if (player == null)
return false; return false;
PlayerInventory inventory = player.getInventory(); PlayerInventory inventory = player.getInventory();

View File

@ -38,7 +38,7 @@ public class Excavation {
* @param player The player who broke the block * @param player The player who broke the block
*/ */
public static void excavationProcCheck(Block block, Player player) { public static void excavationProcCheck(Block block, Player player) {
if(player == null) if (player == null)
return; return;
Material type = block.getType(); Material type = block.getType();
@ -128,7 +128,7 @@ public class Excavation {
* @param block The block to check * @param block The block to check
*/ */
public static void gigaDrillBreaker(Player player, Block block) { public static void gigaDrillBreaker(Player player, Block block) {
if(player == null) if (player == null)
return; return;
Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage()); Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());

View File

@ -84,7 +84,7 @@ public class Herbalism {
* @param plugin mcMMO plugin instance * @param plugin mcMMO plugin instance
*/ */
public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin) { public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
if(player == null) if (player == null)
return; return;
final PlayerProfile profile = Users.getProfile(player); 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; return;
Skills.xpProcessing(player, profile, SkillType.HERBALISM, xp); Skills.xpProcessing(player, profile, SkillType.HERBALISM, xp);

View File

@ -275,13 +275,13 @@ public class WoodCutting {
byte data = currentBlock.getData(); byte data = currentBlock.getData();
if((data & 0x4) == 0x4) if ((data & 0x4) == 0x4)
data ^= 0x4; data ^= 0x4;
if((data & 0x8) == 0x8) if ((data & 0x8) == 0x8)
data ^= 0x8; data ^= 0x8;
if(TreeSpecies.getByData(data) == TreeSpecies.JUNGLE) { if (TreeSpecies.getByData(data) == TreeSpecies.JUNGLE) {
Block corner1 = currentBlock.getRelative(1, 0, 1); Block corner1 = currentBlock.getRelative(1, 0, 1);
Block corner2 = currentBlock.getRelative(1, 0, -1); Block corner2 = currentBlock.getRelative(1, 0, -1);
Block corner3 = currentBlock.getRelative(-1, 0, 1); Block corner3 = currentBlock.getRelative(-1, 0, 1);
@ -307,7 +307,7 @@ public class WoodCutting {
} }
if (BlockChecks.treeFellerCompatible(yPositive)) { if (BlockChecks.treeFellerCompatible(yPositive)) {
if(!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) { if (!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) {
processTreeFelling(yPositive, toBeFelled); processTreeFelling(yPositive, toBeFelled);
} }
} }
@ -345,10 +345,10 @@ public class WoodCutting {
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.WOODCUTTING); int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.WOODCUTTING);
byte type = block.getData(); byte type = block.getData();
if((type & 0x4) == 0x4) if ((type & 0x4) == 0x4)
type ^= 0x4; type ^= 0x4;
if((type & 0x8) == 0x8) if ((type & 0x8) == 0x8)
type ^= 0x8; type ^= 0x8;
Material mat = Material.getMaterial(block.getTypeId()); Material mat = Material.getMaterial(block.getTypeId());
@ -442,17 +442,17 @@ public class WoodCutting {
else { else {
byte type = block.getData(); byte type = block.getData();
if((type & 0x4) == 0x4) if ((type & 0x4) == 0x4)
type ^= 0x4; type ^= 0x4;
if((type & 0x8) == 0x8) if ((type & 0x8) == 0x8)
type ^= 0x8; type ^= 0x8;
TreeSpecies species = TreeSpecies.getByData(type); TreeSpecies species = TreeSpecies.getByData(type);
//Apparently species can be null in certain cases (custom server mods?) //Apparently species can be null in certain cases (custom server mods?)
//https://github.com/mcMMO-Dev/mcMMO/issues/229 //https://github.com/mcMMO-Dev/mcMMO/issues/229
if(species == null) if (species == null)
return; return;
switch (species) { switch (species) {

View File

@ -90,7 +90,7 @@ public class Repair {
* @param is Item being repaired * @param is Item being repaired
*/ */
protected static void addEnchants(Player player, ItemStack is) { protected static void addEnchants(Player player, ItemStack is) {
if(Permissions.arcaneBypass(player)) { if (Permissions.arcaneBypass(player)) {
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect")); player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect"));
return; return;
} }
@ -210,7 +210,7 @@ public class Repair {
*/ */
protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) { protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
float bonus; 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); else bonus = (((float) skillLevel) / ((float) REPAIR_MASTERY_MAX_BONUS_LEVEL)) * (((float) REPAIR_MASTERY_CHANCE_MAX) / 100F);
if (Permissions.repairMastery(player)) { if (Permissions.repairMastery(player)) {
@ -222,7 +222,7 @@ public class Repair {
repairAmount = (int) (repairAmount * 2D); repairAmount = (int) (repairAmount * 2D);
} }
if(repairAmount <= 0 || repairAmount > 32767) if (repairAmount <= 0 || repairAmount > 32767)
repairAmount = 32767; repairAmount = 32767;
durability -= repairAmount; durability -= repairAmount;
@ -249,7 +249,7 @@ public class Repair {
if (Permissions.luckyRepair(player)) randomChance = (int) (randomChance * 0.75); 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")); player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
return true; return true;
} }

View File

@ -27,7 +27,7 @@ public class Salvage {
return; return;
} }
if(player.getGameMode() == GameMode.SURVIVAL) { if (player.getGameMode() == GameMode.SURVIVAL) {
final PlayerProfile profile = Users.getProfile(player); final PlayerProfile profile = Users.getProfile(player);
final int skillLevel = profile.getSkillLevel(SkillType.REPAIR); final int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
final int unlockLevel = configInstance.getSalvageUnlockLevel(); final int unlockLevel = configInstance.getSalvageUnlockLevel();

View File

@ -24,7 +24,7 @@ public class CounterAttackEventHandler {
} }
protected boolean isHoldingSword() { protected boolean isHoldingSword() {
if(player == null) if (player == null)
return false; return false;
return ItemChecks.isSword(player.getItemInHand()); return ItemChecks.isSword(player.getItemInHand());
@ -39,7 +39,7 @@ public class CounterAttackEventHandler {
} }
protected void sendAbilityMessages() { protected void sendAbilityMessages() {
if(player == null) if (player == null)
return; return;
player.sendMessage(LocaleLoader.getString("Swords.Combat.Countered")); player.sendMessage(LocaleLoader.getString("Swords.Combat.Countered"));

View File

@ -19,7 +19,7 @@ public class SerratedStrikesEventHandler {
} }
protected void applyAbilityEffects() { protected void applyAbilityEffects() {
if(player == null) if (player == null)
return; return;
Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS); Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS);

View File

@ -26,7 +26,7 @@ public class SwordsManager {
* @param defender The defending entity * @param defender The defending entity
*/ */
public void bleedCheck(LivingEntity defender) { public void bleedCheck(LivingEntity defender) {
if(player == null) if (player == null)
return; return;
if (!Permissions.swordsBleed(player)) { if (!Permissions.swordsBleed(player)) {
@ -53,7 +53,7 @@ public class SwordsManager {
} }
public void counterAttackChecks(LivingEntity attacker, int damage) { public void counterAttackChecks(LivingEntity attacker, int damage) {
if(player == null) if (player == null)
return; return;
if (!Permissions.counterAttack(player)) { if (!Permissions.counterAttack(player)) {
@ -82,7 +82,7 @@ public class SwordsManager {
} }
public void serratedStrikes(LivingEntity target, int damage) { public void serratedStrikes(LivingEntity target, int damage) {
if(player == null) if (player == null)
return; return;
if (!Permissions.serratedStrikes(player)) { if (!Permissions.serratedStrikes(player)) {

View File

@ -19,7 +19,7 @@ public class BeastLoreEventHandler {
} }
protected void sendInspectMessage() { protected void sendInspectMessage() {
if(player == null) if (player == null)
return; return;
String message = LocaleLoader.getString("Combat.BeastLore") + " "; String message = LocaleLoader.getString("Combat.BeastLore") + " ";

View File

@ -28,14 +28,14 @@ public class CallOfTheWildEventHandler {
} }
protected void sendInsufficientAmountMessage() { protected void sendInsufficientAmountMessage() {
if(player == null) if (player == null)
return; return;
player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.GRAY + Misc.prettyItemString(inHand.getTypeId())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.GRAY + Misc.prettyItemString(inHand.getTypeId()));
} }
protected boolean nearbyEntityExists() { protected boolean nearbyEntityExists() {
if(player == null) if (player == null)
return false; return false;
boolean entityExists = false; boolean entityExists = false;
@ -51,7 +51,7 @@ public class CallOfTheWildEventHandler {
} }
protected void sendFailureMessage() { protected void sendFailureMessage() {
if(player == null) if (player == null)
return; return;
if (type == EntityType.OCELOT) { if (type == EntityType.OCELOT) {
@ -63,7 +63,7 @@ public class CallOfTheWildEventHandler {
} }
protected void spawnCreature() { protected void spawnCreature() {
if(player == null) if (player == null)
return; return;
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type); LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
@ -80,7 +80,7 @@ public class CallOfTheWildEventHandler {
} }
protected void processResourceCost() { protected void processResourceCost() {
if(player == null) if (player == null)
return; return;
int newAmount = inHand.getAmount() - summonAmount; int newAmount = inHand.getAmount() - summonAmount;
@ -94,7 +94,7 @@ public class CallOfTheWildEventHandler {
} }
protected void sendSuccessMessage() { protected void sendSuccessMessage() {
if(player == null) if (player == null)
return; return;
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete")); player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));

View File

@ -18,7 +18,7 @@ public class EnvironmentallyAwareEventHandler {
} }
protected void teleportWolf() { protected void teleportWolf() {
if(player == null) if (player == null)
return; return;
if (event.getDamage() > wolf.getHealth()) { if (event.getDamage() > wolf.getHealth()) {
@ -29,7 +29,7 @@ public class EnvironmentallyAwareEventHandler {
} }
protected void sendAbilityMessage() { protected void sendAbilityMessage() {
if(player == null) if (player == null)
return; return;
player.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf")); player.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf"));

View File

@ -34,7 +34,7 @@ public class TamingManager {
* @param damage The damage being absorbed by the wolf * @param damage The damage being absorbed by the wolf
*/ */
public void fastFoodService(Wolf wolf, int damage) { public void fastFoodService(Wolf wolf, int damage) {
if(player == null) if (player == null)
return; return;
if (!Permissions.fastFoodService(player)) { if (!Permissions.fastFoodService(player)) {
@ -62,7 +62,7 @@ public class TamingManager {
* @param event The event to modify * @param event The event to modify
*/ */
public void sharpenedClaws(EntityDamageEvent event) { public void sharpenedClaws(EntityDamageEvent event) {
if(player == null) if (player == null)
return; return;
if (!Permissions.sharpenedClaws(player)) { if (!Permissions.sharpenedClaws(player)) {
@ -82,7 +82,7 @@ public class TamingManager {
* @param event The event to modify * @param event The event to modify
*/ */
public void gore(EntityDamageEvent event) { public void gore(EntityDamageEvent event) {
if(player == null) if (player == null)
return; return;
if (!Permissions.gore(player)) { if (!Permissions.gore(player)) {
@ -160,7 +160,7 @@ public class TamingManager {
* @param livingEntity The entity to examine * @param livingEntity The entity to examine
*/ */
public void beastLore(LivingEntity livingEntity) { public void beastLore(LivingEntity livingEntity) {
if(player == null) if (player == null)
return; return;
if (!Permissions.beastLore(player)) { if (!Permissions.beastLore(player)) {
@ -179,7 +179,7 @@ public class TamingManager {
* @param summonAmount The amount of material needed to summon the entity * @param summonAmount The amount of material needed to summon the entity
*/ */
private void callOfTheWild(EntityType type, int summonAmount) { private void callOfTheWild(EntityType type, int summonAmount) {
if(player == null) if (player == null)
return; return;
if (!Permissions.callOfTheWild(player)) { if (!Permissions.callOfTheWild(player)) {
@ -213,7 +213,7 @@ public class TamingManager {
* @param cause The damage cause of the event * @param cause The damage cause of the event
*/ */
private void environmentallyAware(EntityDamageEvent event, DamageCause cause) { private void environmentallyAware(EntityDamageEvent event, DamageCause cause) {
if(player == null) if (player == null)
return; return;
if (!Permissions.environmentallyAware(player)) { if (!Permissions.environmentallyAware(player)) {
@ -248,7 +248,7 @@ public class TamingManager {
* @param cause The damage cause of the event * @param cause The damage cause of the event
*/ */
private void thickFur(EntityDamageEvent event, DamageCause cause) { private void thickFur(EntityDamageEvent event, DamageCause cause) {
if(player == null) if (player == null)
return; return;
if (!Permissions.thickFur(player)) { if (!Permissions.thickFur(player)) {
@ -268,7 +268,7 @@ public class TamingManager {
* @param event The event to modify * @param event The event to modify
*/ */
private void shockProof(EntityDamageEvent event) { private void shockProof(EntityDamageEvent event) {
if(player == null) if (player == null)
return; return;
if (!Permissions.shockProof(player)) { if (!Permissions.shockProof(player)) {

View File

@ -25,7 +25,7 @@ public class UnarmedManager {
* @param defender The defending player * @param defender The defending player
*/ */
public void disarmCheck(Player defender) { public void disarmCheck(Player defender) {
if(player == null) if (player == null)
return; return;
if (!Permissions.disarm(player)) { if (!Permissions.disarm(player)) {
@ -62,7 +62,7 @@ public class UnarmedManager {
* @param event The event to modify * @param event The event to modify
*/ */
public void deflectCheck(EntityDamageEvent event) { public void deflectCheck(EntityDamageEvent event) {
if(player == null) if (player == null)
return; return;
if (!Permissions.deflect(player)) { if (!Permissions.deflect(player)) {
@ -92,7 +92,7 @@ public class UnarmedManager {
* @param event The event to modify. * @param event The event to modify.
*/ */
public void bonusDamage(EntityDamageEvent event) { public void bonusDamage(EntityDamageEvent event) {
if(player == null) if (player == null)
return; return;
if (!Permissions.unarmedBonus(player)) { if (!Permissions.unarmedBonus(player)) {
@ -112,7 +112,7 @@ public class UnarmedManager {
* @return true if the defender was not disarmed, false otherwise * @return true if the defender was not disarmed, false otherwise
*/ */
private boolean hasIronGrip(Player defender) { private boolean hasIronGrip(Player defender) {
if(defender == null) if (defender == null)
return false; return false;
if (!Permissions.ironGrip(defender)) { if (!Permissions.ironGrip(defender)) {

View File

@ -173,7 +173,7 @@ public class BlockChecks {
* @param block Block to check * @param block Block to check
* @return true if the block is affected, false otherwise * @return true if the block is affected, false otherwise
*/ */
public static boolean canBeGreenTerra(Block block){ public static boolean canBeGreenTerra(Block block) {
switch (block.getType()) { switch (block.getType()) {
case BROWN_MUSHROOM: case BROWN_MUSHROOM:
case CACTUS: 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))) { if (block.getType().equals(Material.LOG) || (customBlocksEnabled && ModChecks.isCustomLogBlock(block))) {
return true; return true;
} }

View File

@ -66,10 +66,10 @@ public class Database {
mcMMO.p.getLogger().info("Connection to MySQL was a success!"); mcMMO.p.getLogger().info("Connection to MySQL was a success!");
} catch (SQLException ex) { } catch (SQLException ex) {
connection = null; 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) { } catch (ClassNotFoundException ex) {
connection = null; 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; PreparedStatement statement = null;
try { try {
if(!checkConnected()) return; if (!checkConnected()) return;
statement = connection.prepareStatement(sql); statement = connection.prepareStatement(sql);
resultSet = statement.executeQuery(); resultSet = statement.executeQuery();

View File

@ -301,7 +301,7 @@ public class Leaderboard {
} }
} }
if(!inserted) { if (!inserted) {
writer.append(ps.name + ":" + ps.statVal).append("\r\n"); writer.append(ps.name + ":" + ps.statVal).append("\r\n");
} }

View File

@ -13,7 +13,7 @@ public class Page {
public static int getTotalPageNumber(String address) public static int getTotalPageNumber(String address)
{ {
String[] addressSplit = LocaleLoader.getString(address).split("\n"); String[] addressSplit = LocaleLoader.getString(address).split("\n");
if(addressSplit.length <= 8) if (addressSplit.length <= 8)
return 1; return 1;
return (addressSplit.length/8)+1; return (addressSplit.length/8)+1;
@ -24,7 +24,7 @@ public class Page {
int pageIndexStart = 0; int pageIndexStart = 0;
//Determine what string to start at //Determine what string to start at
if(pagenum > 1) if (pagenum > 1)
{ {
pageIndexStart = 8*(pagenum-1); pageIndexStart = 8*(pagenum-1);
} }
@ -36,9 +36,9 @@ public class Page {
//Add targeted strings //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(""); allStrings.add("");
else else
allStrings.add(split[pageIndexStart+allStrings.size()-1]); 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. player.sendMessage(ChatColor.DARK_AQUA+"Guide for "+capitalized+" available type /"+skilltype.toString().toLowerCase()+" ? [Page#]"); //TODO: Needs more locale.
if (args.length >= 1) if (args.length >= 1)
{ {
if(args[0].equals("?")) if (args[0].equals("?"))
{ {
String address = "Guides."+capitalized; 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); Page.clearChat(player);
for(String target : Page.grabPageContents(capitalized+" Guide", address, Misc.getInt(args[1]))) for(String target : Page.grabPageContents(capitalized+" Guide", address, Misc.getInt(args[1])))
{ {
player.sendMessage(target); player.sendMessage(target);
} }
} else if(args.length == 1) } else if (args.length == 1)
{ {
Page.clearChat(player); Page.clearChat(player);
for(String target : Page.grabPageContents(capitalized+" Guide", address, 1)) for(String target : Page.grabPageContents(capitalized+" Guide", address, 1))
@ -82,11 +82,11 @@ public class Page {
player.sendMessage(target); 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. 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. player.sendMessage("Not a valid page number!"); //TODO: Needs more locale.
} }

View File

@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
public class Permissions { public class Permissions {
public static boolean hasPermission(CommandSender sender, String perm) public static boolean hasPermission(CommandSender sender, String perm)
{ {
if(sender.hasPermission(perm)) if (sender.hasPermission(perm))
return true; return true;
return false; return false;
@ -14,7 +14,7 @@ public class Permissions {
public static boolean hasPermission(Player sender, String perm) public static boolean hasPermission(Player sender, String perm)
{ {
if(sender.hasPermission(perm)) if (sender.hasPermission(perm))
return true; return true;
return false; return false;

View File

@ -38,7 +38,7 @@ public class Skills {
* @param player The player whose cooldown is being checked * @param player The player whose cooldown is being checked
* @return true if the cooldown is over, false otherwise * @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(); long currentTime = System.currentTimeMillis();
int adjustedCooldown = cooldown; int adjustedCooldown = cooldown;
@ -92,7 +92,7 @@ public class Skills {
* @param ability The ability to watch cooldowns for * @param ability The ability to watch cooldowns for
*/ */
public static void watchCooldown(Player player, PlayerProfile profile, AbilityType ability) { 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; return;
if (!profile.getAbilityInformed(ability) && cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) { 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 * @param xp the amount of XP to gain
*/ */
public static void xpProcessing(Player player, PlayerProfile profile, SkillType type, int xp) { public static void xpProcessing(Player player, PlayerProfile profile, SkillType type, int xp) {
if(player == null) if (player == null)
return; return;
if (type.getPermissions(player)) { if (type.getPermissions(player)) {
if(Users.getPlayer(player) == null) if (Users.getPlayer(player) == null)
return; 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; return;
Users.getPlayer(player).addXP(type, xp); Users.getPlayer(player).addXP(type, xp);

View File

@ -6,7 +6,7 @@ public class ChunkletManagerFactory {
public static ChunkletManager getChunkletManager() { public static ChunkletManager getChunkletManager() {
HiddenConfig hConfig = HiddenConfig.getInstance(); HiddenConfig hConfig = HiddenConfig.getInstance();
if(hConfig.getChunkletsEnabled()) { if (hConfig.getChunkletsEnabled()) {
return new HashChunkletManager(); return new HashChunkletManager();
} }

View File

@ -25,14 +25,14 @@ public class HashChunkletManager implements ChunkletManager {
public void loadChunklet(int cx, int cy, int cz, World world) { public void loadChunklet(int cx, int cy, int cz, World world) {
File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
File cxDir = new File(dataDir, "" + cx); File cxDir = new File(dataDir, "" + cx);
if(!cxDir.exists()) return; if (!cxDir.exists()) return;
File czDir = new File(cxDir, "" + cz); File czDir = new File(cxDir, "" + cz);
if(!czDir.exists()) return; if (!czDir.exists()) return;
File yFile = new File(czDir, "" + cy); File yFile = new File(czDir, "" + cy);
if(!yFile.exists()) return; if (!yFile.exists()) return;
ChunkletStore in = deserializeChunkletStore(yFile); ChunkletStore in = deserializeChunkletStore(yFile);
if(in != null) { if (in != null) {
store.put(world.getName() + "," + cx + "," + cz + "," + cy, in); store.put(world.getName() + "," + cx + "," + cz + "," + cy, in);
} }
} }
@ -40,11 +40,11 @@ public class HashChunkletManager implements ChunkletManager {
@Override @Override
public void unloadChunklet(int cx, int cy, int cz, World world) { public void unloadChunklet(int cx, int cy, int cz, World world) {
File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); 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); File cxDir = new File(dataDir, "" + cx);
if(!cxDir.exists()) cxDir.mkdir(); if (!cxDir.exists()) cxDir.mkdir();
File czDir = new File(cxDir, "" + cz); File czDir = new File(cxDir, "" + cz);
if(!czDir.exists()) czDir.mkdir(); if (!czDir.exists()) czDir.mkdir();
File yFile = new File(czDir, "" + cy); File yFile = new File(czDir, "" + cy);
ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + 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) { public void loadChunk(int cx, int cz, World world) {
File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
File cxDir = new File(dataDir, "" + cx); File cxDir = new File(dataDir, "" + cx);
if(!cxDir.exists()) return; if (!cxDir.exists()) return;
File czDir = new File(cxDir, "" + cz); File czDir = new File(cxDir, "" + cz);
if(!czDir.exists()) return; if (!czDir.exists()) return;
for(int y = 0; y < 4; y++) { for(int y = 0; y < 4; y++) {
File yFile = new File(czDir, "" + y); File yFile = new File(czDir, "" + y);
if(!yFile.exists()) { if (!yFile.exists()) {
continue; continue;
} }
ChunkletStore in = deserializeChunkletStore(yFile); ChunkletStore in = deserializeChunkletStore(yFile);
if(in != null) { if (in != null) {
store.put(world.getName() + "," + cx + "," + cz + "," + y, in); 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"); File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
for(int y = 0; y < 4; y++) { 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); File cxDir = new File(dataDir, "" + cx);
if(!cxDir.exists()) cxDir.mkdir(); if (!cxDir.exists()) cxDir.mkdir();
File czDir = new File(cxDir, "" + cz); File czDir = new File(cxDir, "" + cz);
if(!czDir.exists()) czDir.mkdir(); if (!czDir.exists()) czDir.mkdir();
File yFile = new File(czDir, "" + y); File yFile = new File(czDir, "" + y);
ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + y); ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + y);
@ -107,16 +107,16 @@ public class HashChunkletManager implements ChunkletManager {
public void saveWorld(World world) { public void saveWorld(World world) {
String worldName = world.getName(); String worldName = world.getName();
File dataDir = new File(world.getWorldFolder(), "mcmmo_data"); File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
if(!dataDir.exists()) if (!dataDir.exists())
dataDir.mkdirs(); dataDir.mkdirs();
for(String key : store.keySet()) { for(String key : store.keySet()) {
String[] info = key.split(","); String[] info = key.split(",");
if(worldName.equals(info[0])) { if (worldName.equals(info[0])) {
File cxDir = new File(dataDir, "" + info[1]); File cxDir = new File(dataDir, "" + info[1]);
if(!cxDir.exists()) cxDir.mkdir(); if (!cxDir.exists()) cxDir.mkdir();
File czDir = new File(cxDir, "" + info[2]); File czDir = new File(cxDir, "" + info[2]);
if(!czDir.exists()) czDir.mkdir(); if (!czDir.exists()) czDir.mkdir();
File yFile = new File(czDir, "" + info[3]); File yFile = new File(czDir, "" + info[3]);
serializeChunkletStore(store.get(key), yFile); serializeChunkletStore(store.get(key), yFile);
@ -132,7 +132,7 @@ public class HashChunkletManager implements ChunkletManager {
for(String key : store.keySet()) { for(String key : store.keySet()) {
String tempWorldName = key.split(",")[0]; String tempWorldName = key.split(",")[0];
if(tempWorldName.equals(worldName)) { if (tempWorldName.equals(worldName)) {
store.remove(key); store.remove(key);
return; return;
} }
@ -254,21 +254,21 @@ public class HashChunkletManager implements ChunkletManager {
@Override @Override
public void cleanUp() { public void cleanUp() {
for(String key : store.keySet()) { for(String key : store.keySet()) {
if(store.get(key).isEmpty()) { if (store.get(key).isEmpty()) {
String[] info = key.split(","); String[] info = key.split(",");
File dataDir = new File(Bukkit.getWorld(info[0]).getWorldFolder(), "mcmmo_data"); File dataDir = new File(Bukkit.getWorld(info[0]).getWorldFolder(), "mcmmo_data");
File cxDir = new File(dataDir, "" + info[1]); File cxDir = new File(dataDir, "" + info[1]);
if(!cxDir.exists()) continue; if (!cxDir.exists()) continue;
File czDir = new File(cxDir, "" + info[2]); File czDir = new File(cxDir, "" + info[2]);
if(!czDir.exists()) continue; if (!czDir.exists()) continue;
File yFile = new File(czDir, "" + info[3]); File yFile = new File(czDir, "" + info[3]);
yFile.delete(); yFile.delete();
//Delete empty directories //Delete empty directories
if(czDir.list().length == 0) czDir.delete(); if (czDir.list().length == 0) czDir.delete();
if(cxDir.list().length == 0) cxDir.delete(); if (cxDir.list().length == 0) cxDir.delete();
} }
} }
} }
@ -282,7 +282,7 @@ public class HashChunkletManager implements ChunkletManager {
ObjectOutputStream objOut = null; ObjectOutputStream objOut = null;
try { try {
if(!location.exists()) if (!location.exists())
location.createNewFile(); location.createNewFile();
fileOut = new FileOutputStream(location); fileOut = new FileOutputStream(location);
objOut = new ObjectOutputStream(fileOut); 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 // 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(); ChunkletStore tempStore = ChunkletStoreFactory.getChunkletStore();
if(storeIn != null) { if (storeIn != null) {
tempStore.copyFrom(storeIn); tempStore.copyFrom(storeIn);
} }
storeIn = tempStore; storeIn = tempStore;

View File

@ -26,7 +26,7 @@ public class PrimitiveChunkletStore implements ChunkletStore {
for(int x = 0; x < 16; x++) { for(int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for(int z = 0; z < 16; z++) {
for(int y = 0; y < 64; y++) { for(int y = 0; y < 64; y++) {
if(store[x][z][y]) return false; if (store[x][z][y]) return false;
} }
} }
} }

View File

@ -31,7 +31,7 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
for(int x = 0; x < 16; x++) { for(int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for(int z = 0; z < 16; z++) {
for(int y = 0; y < 64; y++) { 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 x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for(int z = 0; z < 16; z++) {
for(int y = 0; y < 64; y++) { for(int y = 0; y < 64; y++) {
if(store[x][z][y]) { if (store[x][z][y]) {
byte[] temp = constructColumn(x, z); byte[] temp = constructColumn(x, z);
for(int i = 0; i < 9; i++) { for(int i = 0; i < 9; i++) {
@ -81,7 +81,7 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
byte[] temp = new byte[9]; byte[] temp = new byte[9];
// Could probably reorganize this loop to print nasty things if it does not equal 9 or -1 // 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 x = addressByteX(temp[0]);
int z = addressByteZ(temp[0]); int z = addressByteZ(temp[0]);
boolean[] yColumn = new boolean[64]; boolean[] yColumn = new boolean[64];
@ -127,13 +127,13 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
column[0] = makeAddressByte(x, z); column[0] = makeAddressByte(x, z);
for (int i = 0; i < 8; i++){ for (int i = 0; i < 8; i++) {
byte yCompressed = 0x0; byte yCompressed = 0x0;
int subColumnIndex = 8 * i; int subColumnIndex = 8 * i;
int subColumnEnd = subColumnIndex + 8; int subColumnEnd = subColumnIndex + 8;
for(int y = subColumnIndex; y < subColumnEnd; y++) { for(int y = subColumnIndex; y < subColumnEnd; y++) {
if(store[x][z][y]) { if (store[x][z][y]) {
yCompressed |= 1 << (y % 8); yCompressed |= 1 << (y % 8);
} }
} }

View File

@ -6,7 +6,7 @@ public class ChunkManagerFactory {
public static ChunkManager getChunkManager() { public static ChunkManager getChunkManager() {
HiddenConfig hConfig = HiddenConfig.getInstance(); HiddenConfig hConfig = HiddenConfig.getInstance();
if(hConfig.getChunkletsEnabled()) { if (hConfig.getChunkletsEnabled()) {
return new HashChunkManager(); return new HashChunkManager();
} }

View File

@ -143,19 +143,19 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void loadChunk(int cx, int cz, World world) { public synchronized void loadChunk(int cx, int cz, World world) {
if(world == null) if (world == null)
return; return;
if(store.containsKey(world.getName() + "," + cx + "," + cz)) if (store.containsKey(world.getName() + "," + cx + "," + cz))
return; return;
ChunkStore in = null; ChunkStore in = null;
UUID key = world.getUID(); 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()); 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); convertChunk(new File(world.getWorldFolder(), "mcmmo_data"), cx, cz, world, true);
try { try {
@ -163,20 +163,20 @@ public class HashChunkManager implements ChunkManager {
} }
catch(Exception e) {} catch(Exception e) {}
if(in != null) { if (in != null) {
store.put(world.getName() + "," + cx + "," + cz, in); store.put(world.getName() + "," + cx + "," + cz, in);
List<UUID> mobs = in.getSpawnedMobs(); List<UUID> mobs = in.getSpawnedMobs();
List<UUID> pets = in.getSpawnedPets(); List<UUID> pets = in.getSpawnedPets();
if(mobs.isEmpty() && pets.isEmpty()) if (mobs.isEmpty() && pets.isEmpty())
return; return;
for(LivingEntity entity : world.getLivingEntities()) { for(LivingEntity entity : world.getLivingEntities()) {
if(mobs.contains(entity.getUniqueId())) if (mobs.contains(entity.getUniqueId()))
addSpawnedMob(entity); addSpawnedMob(entity);
if(pets.contains(entity.getUniqueId())) if (pets.contains(entity.getUniqueId()))
addSpawnedPet(entity); addSpawnedPet(entity);
} }
@ -189,24 +189,24 @@ public class HashChunkManager implements ChunkManager {
public synchronized void unloadChunk(int cx, int cz, World world) { public synchronized void unloadChunk(int cx, int cz, World world) {
saveChunk(cx, cz, 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); store.remove(world.getName() + "," + cx + "," + cz);
for(Entity entity : spawnedMobs) { for(Entity entity : spawnedMobs) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
mobsToRemove.add(entity); mobsToRemove.add(entity);
} }
for(Entity entity : spawnedPets) { for(Entity entity : spawnedPets) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
mobsToRemove.add(entity); mobsToRemove.add(entity);
} }
if(safeToRemoveMobs) { if (safeToRemoveMobs) {
spawnedMobs.remove(mobsToRemove); spawnedMobs.remove(mobsToRemove);
spawnedPets.remove(mobsToRemove); spawnedPets.remove(mobsToRemove);
mobsToRemove.clear(); mobsToRemove.clear();
@ -216,14 +216,14 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void saveChunk(int cx, int cz, World world) { public synchronized void saveChunk(int cx, int cz, World world) {
if(world == null) if (world == null)
return; return;
boolean unloaded = false; boolean unloaded = false;
if(!store.containsKey(world.getName() + "," + cx + "," + cz)) { if (!store.containsKey(world.getName() + "," + cx + "," + cz)) {
List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs); List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs);
for(Entity entity : tempSpawnedMobs) { for(Entity entity : tempSpawnedMobs) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
loadChunk(cx, cz, world); loadChunk(cx, cz, world);
@ -231,10 +231,10 @@ public class HashChunkManager implements ChunkManager {
break; break;
} }
if(!unloaded) { if (!unloaded) {
List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets);
for(Entity entity : tempSpawnedPets) { for(Entity entity : tempSpawnedPets) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
loadChunk(cx, cz, world); 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); ChunkStore cStore = ChunkStoreFactory.getChunkStore(world, cx, cz);
store.put(world.getName() + "," + cx + "," + cz, cStore); 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); ChunkStore out = store.get(world.getName() + "," + cx + "," + cz);
List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs); List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs);
for(Entity entity : tempSpawnedMobs) { for(Entity entity : tempSpawnedMobs) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
out.addSpawnedMob(entity.getUniqueId()); out.addSpawnedMob(entity.getUniqueId());
@ -262,13 +262,13 @@ public class HashChunkManager implements ChunkManager {
List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets); List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets);
for(Entity entity : tempSpawnedPets) { for(Entity entity : tempSpawnedPets) {
if(!isEntityInChunk(entity, cx, cz, world)) if (!isEntityInChunk(entity, cx, cz, world))
continue; continue;
out.addSpawnedPet(entity.getUniqueId()); out.addSpawnedPet(entity.getUniqueId());
} }
if(!out.isDirty()) if (!out.isDirty())
return; return;
writeChunkStore(world, cx, cz, out); 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) { private boolean isEntityInChunk(Entity entity, int cx, int cz, World world) {
if(entity == null || world == null) if (entity == null || world == null)
return false; return false;
if(entity.getLocation().getChunk().getX() != cx) if (entity.getLocation().getChunk().getX() != cx)
return false; return false;
if(entity.getLocation().getChunk().getZ() != cz) if (entity.getLocation().getChunk().getZ() != cz)
return false; return false;
if(entity.getWorld() != world) if (entity.getWorld() != world)
return false; return false;
return true; return true;
@ -293,7 +293,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized boolean isChunkLoaded(int cx, int cz, World world) { public synchronized boolean isChunkLoaded(int cx, int cz, World world) {
if(world == null) if (world == null)
return false; return false;
return store.containsKey(world.getName() + "," + cx + "," + cz); return store.containsKey(world.getName() + "," + cx + "," + cz);
@ -304,7 +304,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void chunkUnloaded(int cx, int cz, World world) { public synchronized void chunkUnloaded(int cx, int cz, World world) {
if(world == null) if (world == null)
return; return;
ChunkletUnloader.addToList(cx, cz, world); ChunkletUnloader.addToList(cx, cz, world);
@ -312,7 +312,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void saveWorld(World world) { public synchronized void saveWorld(World world) {
if(world == null) if (world == null)
return; return;
closeAll(); closeAll();
@ -321,7 +321,7 @@ public class HashChunkManager implements ChunkManager {
List<String> keys = new ArrayList<String>(store.keySet()); List<String> keys = new ArrayList<String>(store.keySet());
for(String key : keys) { for(String key : keys) {
String[] info = key.split(","); String[] info = key.split(",");
if(worldName.equals(info[0])) { if (worldName.equals(info[0])) {
int cx = 0; int cx = 0;
int cz = 0; int cz = 0;
@ -340,7 +340,7 @@ public class HashChunkManager implements ChunkManager {
for(Entity entity : tempSpawnedMobs) { for(Entity entity : tempSpawnedMobs) {
World entityWorld = entity.getWorld(); World entityWorld = entity.getWorld();
if(world != entityWorld) if (world != entityWorld)
continue; continue;
int cx = entity.getLocation().getChunk().getX(); int cx = entity.getLocation().getChunk().getX();
@ -353,7 +353,7 @@ public class HashChunkManager implements ChunkManager {
for(Entity entity : tempSpawnedPets) { for(Entity entity : tempSpawnedPets) {
World entityWorld = entity.getWorld(); World entityWorld = entity.getWorld();
if(world != entityWorld) if (world != entityWorld)
continue; continue;
int cx = entity.getLocation().getChunk().getX(); int cx = entity.getLocation().getChunk().getX();
@ -365,7 +365,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void unloadWorld(World world) { public synchronized void unloadWorld(World world) {
if(world == null) if (world == null)
return; return;
closeAll(); closeAll();
@ -374,7 +374,7 @@ public class HashChunkManager implements ChunkManager {
List<String> keys = new ArrayList<String>(store.keySet()); List<String> keys = new ArrayList<String>(store.keySet());
for(String key : keys) { for(String key : keys) {
String[] info = key.split(","); String[] info = key.split(",");
if(worldName.equals(info[0])) { if (worldName.equals(info[0])) {
int cx = 0; int cx = 0;
int cz = 0; int cz = 0;
@ -395,7 +395,7 @@ public class HashChunkManager implements ChunkManager {
for(Entity entity : tempSpawnedMobs) { for(Entity entity : tempSpawnedMobs) {
World entityWorld = entity.getWorld(); World entityWorld = entity.getWorld();
if(world != entityWorld) if (world != entityWorld)
continue; continue;
int cx = entity.getLocation().getChunk().getX(); int cx = entity.getLocation().getChunk().getX();
@ -408,7 +408,7 @@ public class HashChunkManager implements ChunkManager {
for(Entity entity : tempSpawnedPets) { for(Entity entity : tempSpawnedPets) {
World entityWorld = entity.getWorld(); World entityWorld = entity.getWorld();
if(world != entityWorld) if (world != entityWorld)
continue; continue;
int cx = entity.getLocation().getChunk().getX(); int cx = entity.getLocation().getChunk().getX();
@ -447,7 +447,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized boolean isTrue(int x, int y, int z, World world) { public synchronized boolean isTrue(int x, int y, int z, World world) {
if(world == null) if (world == null)
return false; return false;
int cx = x / 16; int cx = x / 16;
@ -471,7 +471,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized boolean isTrue(Block block) { public synchronized boolean isTrue(Block block) {
if(block == null) if (block == null)
return false; return false;
return isTrue(block.getX(), block.getY(), block.getZ(), block.getWorld()); return isTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
@ -479,7 +479,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void setTrue(int x, int y, int z, World world) { public synchronized void setTrue(int x, int y, int z, World world) {
if(world == null) if (world == null)
return; return;
int cx = x / 16; int cx = x / 16;
@ -506,7 +506,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void setTrue(Block block) { public synchronized void setTrue(Block block) {
if(block == null) if (block == null)
return; return;
setTrue(block.getX(), block.getY(), block.getZ(), block.getWorld()); setTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
@ -514,7 +514,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void setFalse(int x, int y, int z, World world) { public synchronized void setFalse(int x, int y, int z, World world) {
if(world == null) if (world == null)
return; return;
int cx = x / 16; int cx = x / 16;
@ -540,7 +540,7 @@ public class HashChunkManager implements ChunkManager {
@Override @Override
public synchronized void setFalse(Block block) { public synchronized void setFalse(Block block) {
if(block == null) if (block == null)
return; return;
setFalse(block.getX(), block.getY(), block.getZ(), block.getWorld()); 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) { public synchronized void convertChunk(File dataDir, int cx, int cz, World world, boolean actually) {
if(!actually) if (!actually)
return; return;
if(!dataDir.exists()) return; if (!dataDir.exists()) return;
File cxDir = new File(dataDir, "" + cx); File cxDir = new File(dataDir, "" + cx);
if(!cxDir.exists()) return; if (!cxDir.exists()) return;
File czDir = new File(cxDir, "" + cz); File czDir = new File(cxDir, "" + cz);
if(!czDir.exists()) return; if (!czDir.exists()) return;
boolean conversionSet = false; boolean conversionSet = false;
for(BlockStoreConversionZDirectory converter : this.converters) { for(BlockStoreConversionZDirectory converter : this.converters) {
if(converter == null) if (converter == null)
continue; continue;
if(converter.taskID >= 0) if (converter.taskID >= 0)
continue; continue;
converter.start(world, cxDir, czDir); converter.start(world, cxDir, czDir);
@ -576,7 +576,7 @@ public class HashChunkManager implements ChunkManager {
break; break;
} }
if(!conversionSet) { if (!conversionSet) {
BlockStoreConversionZDirectory converter = new BlockStoreConversionZDirectory(); BlockStoreConversionZDirectory converter = new BlockStoreConversionZDirectory();
converter.start(world, cxDir, czDir); converter.start(world, cxDir, czDir);
converters.add(converter); converters.add(converter);
@ -592,22 +592,22 @@ public class HashChunkManager implements ChunkManager {
} }
public void addSpawnedMob(Entity entity) { public void addSpawnedMob(Entity entity) {
if(!isSpawnedMob(entity)) if (!isSpawnedMob(entity))
spawnedMobs.add(entity); spawnedMobs.add(entity);
} }
public void addSpawnedPet(Entity entity) { public void addSpawnedPet(Entity entity) {
if(!isSpawnedPet(entity)) if (!isSpawnedPet(entity))
spawnedPets.add(entity); spawnedPets.add(entity);
} }
public void removeSpawnedMob(Entity entity) { public void removeSpawnedMob(Entity entity) {
if(isSpawnedMob(entity)) if (isSpawnedMob(entity))
spawnedMobs.remove(entity); spawnedMobs.remove(entity);
} }
public void removeSpawnedPet(Entity entity) { public void removeSpawnedPet(Entity entity) {
if(isSpawnedPet(entity)) if (isSpawnedPet(entity))
spawnedPets.remove(entity); spawnedPets.remove(entity);
} }
} }

View File

@ -85,7 +85,7 @@ public class PrimitiveChunkStore implements ChunkStore {
for(int x = 0; x < 16; x++) { for(int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) { for(int z = 0; z < 16; z++) {
for(int y = 0; y < this.worldHeight; y++) { 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) { public void addSpawnedMob(UUID id) {
if(!isSpawnedMob(id)) { if (!isSpawnedMob(id)) {
spawnedMobs.add(id); spawnedMobs.add(id);
dirty = true; dirty = true;
} }
} }
public void addSpawnedPet(UUID id) { public void addSpawnedPet(UUID id) {
if(!isSpawnedPet(id)) { if (!isSpawnedPet(id)) {
spawnedPets.add(id); spawnedPets.add(id);
dirty = true; dirty = true;
} }
} }
public void removeSpawnedMob(UUID id) { public void removeSpawnedMob(UUID id) {
if(isSpawnedMob(id)) { if (isSpawnedMob(id)) {
spawnedMobs.remove(id); spawnedMobs.remove(id);
dirty = true; dirty = true;
} }
} }
public void removeSpawnedPet(UUID id) { public void removeSpawnedPet(UUID id) {
if(isSpawnedPet(id)) { if (isSpawnedPet(id)) {
spawnedPets.remove(id); spawnedPets.remove(id);
dirty = true; dirty = true;
} }
} }
public void clearSpawnedMobs() { public void clearSpawnedMobs() {
if(!spawnedMobs.isEmpty()) { if (!spawnedMobs.isEmpty()) {
spawnedMobs.clear(); spawnedMobs.clear();
dirty = true; dirty = true;
} }
} }
public void clearSpawnedPets() { public void clearSpawnedPets() {
if(!spawnedPets.isEmpty()) { if (!spawnedPets.isEmpty()) {
spawnedPets.clear(); spawnedPets.clear();
dirty = true; dirty = true;
} }
@ -204,16 +204,16 @@ public class PrimitiveChunkStore implements ChunkStore {
store = (boolean[][][]) in.readObject(); store = (boolean[][][]) in.readObject();
if (fileVersionNumber < CURRENT_VERSION) { if (fileVersionNumber < CURRENT_VERSION) {
if(fileVersionNumber < 5) if (fileVersionNumber < 5)
fixArray(); fixArray();
if(fileVersionNumber < 6) { if (fileVersionNumber < 6) {
spawnedMobs = new ArrayList<UUID>(); spawnedMobs = new ArrayList<UUID>();
spawnedPets = new ArrayList<UUID>(); spawnedPets = new ArrayList<UUID>();
} }
dirty = true; dirty = true;
} }
if(fileVersionNumber >= 6) { if (fileVersionNumber >= 6) {
//What do we want to do about this? These casts are unchecked. //What do we want to do about this? These casts are unchecked.
spawnedMobs = (ArrayList<UUID>) in.readObject(); spawnedMobs = (ArrayList<UUID>) in.readObject();
spawnedPets = (ArrayList<UUID>) in.readObject(); spawnedPets = (ArrayList<UUID>) in.readObject();