mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 23:26:45 +01:00
My OCD made me do it.
This commit is contained in:
parent
c60cbe824c
commit
e193da2cd7
@ -44,24 +44,24 @@ public class AcrobaticsCommand extends SkillCommand {
|
||||
float gracefulRollChanceF;
|
||||
|
||||
// DODGE
|
||||
if(skillValue >= dodgeMaxBonusLevel) dodgeChanceF = dodgeChanceMax;
|
||||
if (skillValue >= dodgeMaxBonusLevel) dodgeChanceF = dodgeChanceMax;
|
||||
else dodgeChanceF = (float) (((double) dodgeChanceMax / (double) dodgeMaxBonusLevel) * skillValue);
|
||||
dodgeChance = df.format(dodgeChanceF);
|
||||
if(dodgeChanceF + dodgeChanceF * 0.3333D >= 100D) dodgeChanceLucky = df.format(100D);
|
||||
if (dodgeChanceF + dodgeChanceF * 0.3333D >= 100D) dodgeChanceLucky = df.format(100D);
|
||||
else dodgeChanceLucky = df.format(dodgeChanceF + dodgeChanceF * 0.3333D);
|
||||
|
||||
// ROLL
|
||||
if(skillValue >= rollMaxBonusLevel) rollChanceF = rollChanceMax;
|
||||
if (skillValue >= rollMaxBonusLevel) rollChanceF = rollChanceMax;
|
||||
else rollChanceF = (float) (((double) rollChanceMax / (double) rollMaxBonusLevel) * skillValue);
|
||||
rollChance = df.format(rollChanceF);
|
||||
if(rollChanceF + rollChanceF * 0.3333D >= 100D) rollChanceLucky = df.format(100D);
|
||||
if (rollChanceF + rollChanceF * 0.3333D >= 100D) rollChanceLucky = df.format(100D);
|
||||
else rollChanceLucky = df.format(rollChanceF + rollChanceF * 0.3333D);
|
||||
|
||||
// GRACEFULROLL
|
||||
if(skillValue >= gracefulRollMaxBonusLevel) gracefulRollChanceF = gracefulRollChanceMax;
|
||||
if (skillValue >= gracefulRollMaxBonusLevel) gracefulRollChanceF = gracefulRollChanceMax;
|
||||
else gracefulRollChanceF = (float) (((double) gracefulRollChanceMax / (double) gracefulRollMaxBonusLevel) * skillValue);
|
||||
gracefulRollChance = df.format(gracefulRollChanceF);
|
||||
if(gracefulRollChanceF + gracefulRollChanceF * 0.3333D >= 100D) gracefulRollChanceLucky = df.format(100D);
|
||||
if (gracefulRollChanceF + gracefulRollChanceF * 0.3333D >= 100D) gracefulRollChanceLucky = df.format(100D);
|
||||
else gracefulRollChanceLucky = df.format(gracefulRollChanceF + gracefulRollChanceF * 0.3333D);
|
||||
}
|
||||
|
||||
|
@ -50,17 +50,17 @@ public class ArcheryCommand extends SkillCommand {
|
||||
else skillShotBonus = percent.format(bonus);
|
||||
|
||||
// Daze
|
||||
if(skillValue >= dazeMaxBonusLevel) dazeChanceF = dazeBonusMax;
|
||||
if (skillValue >= dazeMaxBonusLevel) dazeChanceF = dazeBonusMax;
|
||||
else dazeChanceF = (float) (((double) dazeBonusMax / (double) dazeMaxBonusLevel) * skillValue);
|
||||
dazeChance = df.format(dazeChanceF);
|
||||
if(dazeChanceF + dazeChanceF * 0.3333D >= 100D) dazeChanceLucky = df.format(100D);
|
||||
if (dazeChanceF + dazeChanceF * 0.3333D >= 100D) dazeChanceLucky = df.format(100D);
|
||||
else dazeChanceLucky = df.format(dazeChanceF + dazeChanceF * 0.3333D);
|
||||
|
||||
// Retrieve
|
||||
if(skillValue >= retrieveMaxBonusLevel) retrieveChanceF = retrieveBonusMax;
|
||||
if (skillValue >= retrieveMaxBonusLevel) retrieveChanceF = retrieveBonusMax;
|
||||
else retrieveChanceF = (float) (((double) retrieveBonusMax / (double) retrieveMaxBonusLevel) * skillValue);
|
||||
retrieveChance = df.format(retrieveChanceF);
|
||||
if(retrieveChanceF + retrieveChanceF * 0.3333D >= 100D) retrieveChanceLucky = df.format(100D);
|
||||
if (retrieveChanceF + retrieveChanceF * 0.3333D >= 100D) retrieveChanceLucky = df.format(100D);
|
||||
else retrieveChanceLucky = df.format(retrieveChanceF + retrieveChanceF * 0.3333D);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class AxesCommand extends SkillCommand {
|
||||
if (skillValue >= critMaxBonusLevel) critChanceF = (float) critMaxChance;
|
||||
else critChanceF = (float) ((critMaxChance / critMaxBonusLevel) * skillCheck);
|
||||
critChance = df.format(critChanceF);
|
||||
if(critChanceF + critChanceF * 0.3333D >= 100D) critChanceLucky = df.format(100D);
|
||||
if (critChanceF + critChanceF * 0.3333D >= 100D) critChanceLucky = df.format(100D);
|
||||
else critChanceLucky = df.format(critChanceF + critChanceF * 0.3333D);
|
||||
//Axe Mastery
|
||||
if (skillValue >= bonusDamageAxesMaxBonusLevel) bonusDamage = String.valueOf(bonusDamageAxesBonusMax);
|
||||
@ -125,7 +125,7 @@ public class AxesCommand extends SkillCommand {
|
||||
player.sendMessage(LocaleLoader.getString("Ability.Generic.Template", new Object[] { LocaleLoader.getString("Axes.Ability.Bonus.4"), LocaleLoader.getString("Axes.Ability.Bonus.5", new Object[] {greaterImpactDamage}) }));
|
||||
}
|
||||
|
||||
if (canCritical){
|
||||
if (canCritical) {
|
||||
if (player.hasPermission("mcmmo.perks.lucky.axes"))
|
||||
player.sendMessage(LocaleLoader.getString("Axes.Combat.CritChance", new Object[] { critChance }) + LocaleLoader.getString("Perks.lucky.bonus", new Object[] { critChanceLucky }));
|
||||
else
|
||||
|
@ -45,12 +45,12 @@ public class FishingCommand extends SkillCommand {
|
||||
int dropChance = Fishing.getShakeChance(lootTier);
|
||||
|
||||
shakeChance = df.format(dropChance);
|
||||
if(dropChance + (dropChance * 0.3333D) >= 100D) shakeChanceLucky = df.format(100D);
|
||||
if (dropChance + (dropChance * 0.3333D) >= 100D) shakeChanceLucky = df.format(100D);
|
||||
else shakeChanceLucky = df.format(dropChance + (dropChance * 0.3333D));
|
||||
shakeUnlockLevel = advancedConfig.getShakeUnlockLevel();
|
||||
|
||||
//Fishermans Diet
|
||||
if(skillValue >= fishermansDietRankMaxLevel) fishermansDietRank = "5";
|
||||
if (skillValue >= fishermansDietRankMaxLevel) fishermansDietRank = "5";
|
||||
else fishermansDietRank = String.valueOf((int) ((double) skillValue / (double) fishermansDietRankChange));
|
||||
}
|
||||
|
||||
|
@ -51,22 +51,22 @@ public class HerbalismCommand extends SkillCommand {
|
||||
float doubleDropChanceF;
|
||||
greenTerraLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
|
||||
//FARMERS DIET
|
||||
if(skillValue >= farmersDietMaxLevel) farmersDietRank = "5";
|
||||
if (skillValue >= farmersDietMaxLevel) farmersDietRank = "5";
|
||||
else farmersDietRank = String.valueOf((int) ((double) skillValue / (double) farmersDietRankChange));
|
||||
//GREEN THUMB
|
||||
if(skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4";
|
||||
if (skillValue >= greenThumbStageMaxLevel) greenThumbStage = "4";
|
||||
else greenThumbStage = String.valueOf((int) ((double) skillValue / (double) greenThumbStageChange));
|
||||
|
||||
if(skillValue >= greenThumbMaxLevel) greenThumbChanceF = (float) (greenThumbMaxBonus);
|
||||
if (skillValue >= greenThumbMaxLevel) greenThumbChanceF = (float) (greenThumbMaxBonus);
|
||||
else greenThumbChanceF = (float) ((greenThumbMaxBonus / greenThumbMaxLevel) * skillValue);
|
||||
greenThumbChance = df.format(greenThumbChanceF);
|
||||
if(greenThumbChanceF + greenThumbChanceF * 0.3333D >= 100D) greenThumbChanceLucky = df.format(100D);
|
||||
if (greenThumbChanceF + greenThumbChanceF * 0.3333D >= 100D) greenThumbChanceLucky = df.format(100D);
|
||||
else greenThumbChanceLucky = df.format(greenThumbChanceF + greenThumbChanceF * 0.3333D);
|
||||
//DOUBLE DROPS
|
||||
if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
|
||||
if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
|
||||
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
|
||||
doubleDropChance = df.format(doubleDropChanceF);
|
||||
if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
|
||||
if (doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
|
||||
else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
|
||||
}
|
||||
|
||||
|
@ -53,10 +53,10 @@ public class MiningCommand extends SkillCommand {
|
||||
//Super Breaker
|
||||
superBreakerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
|
||||
//Double Drops
|
||||
if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
|
||||
if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
|
||||
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
|
||||
doubleDropChance = df.format(doubleDropChanceF);
|
||||
if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
|
||||
if (doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
|
||||
else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
|
||||
|
||||
//Blast Mining
|
||||
|
@ -67,13 +67,13 @@ public class RepairCommand extends SkillCommand {
|
||||
|
||||
salvageLevel = Config.getInstance().getSalvageUnlockLevel();
|
||||
|
||||
if(skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryMaxBonus);
|
||||
if (skillValue >= repairMasteryMaxBonusLevel) repairMasteryBonus = df.format(repairMasteryMaxBonus);
|
||||
else repairMasteryBonus = df.format(((double) repairMasteryMaxBonus / (double) repairMasteryMaxBonusLevel) * skillValue);
|
||||
|
||||
if(skillValue >= superRepairMaxBonusLevel) superRepairChanceF = superRepairChanceMax;
|
||||
if (skillValue >= superRepairMaxBonusLevel) superRepairChanceF = superRepairChanceMax;
|
||||
else superRepairChanceF = (float) (((double) superRepairChanceMax / (double) superRepairMaxBonusLevel) * skillValue);
|
||||
superRepairChance = df.format(superRepairChanceF);
|
||||
if(superRepairChanceF + superRepairChanceF * 0.3333D >= 100D) superRepairChanceLucky = df.format(100D);
|
||||
if (superRepairChanceF + superRepairChanceF * 0.3333D >= 100D) superRepairChanceLucky = df.format(100D);
|
||||
else superRepairChanceLucky = df.format(superRepairChanceF + superRepairChanceF * 0.3333D);
|
||||
|
||||
arcaneForgingRank = Repair.getArcaneForgingRank(profile);
|
||||
|
@ -48,16 +48,16 @@ public class SwordsCommand extends SkillCommand {
|
||||
if (skillValue >= bleedMaxLevel) bleedLength = String.valueOf(bleedMaxTicks);
|
||||
else bleedLength = String.valueOf(bleedBaseTicks);
|
||||
|
||||
if(skillValue >= bleedMaxLevel) bleedChanceF = bleedChanceMax;
|
||||
if (skillValue >= bleedMaxLevel) bleedChanceF = bleedChanceMax;
|
||||
else bleedChanceF = (float) (((double) bleedChanceMax / (double) bleedMaxLevel) * skillValue);
|
||||
bleedChance = df.format(bleedChanceF);
|
||||
if(bleedChanceF + bleedChanceF * 0.3333D >= 100D) bleedChanceLucky = df.format(100D);
|
||||
if (bleedChanceF + bleedChanceF * 0.3333D >= 100D) bleedChanceLucky = df.format(100D);
|
||||
else bleedChanceLucky = df.format(bleedChanceF + bleedChanceF * 0.3333D);
|
||||
|
||||
if(skillValue >= counterMaxLevel) counterAttackChanceF = counterChanceMax;
|
||||
if (skillValue >= counterMaxLevel) counterAttackChanceF = counterChanceMax;
|
||||
else counterAttackChanceF = (float) (((double) counterChanceMax / (double) counterMaxLevel) * skillValue);
|
||||
counterAttackChance = df.format(counterAttackChanceF);
|
||||
if(counterAttackChanceF + counterAttackChanceF * 0.3333D >= 100D) counterAttackChanceLucky = df.format(100D);
|
||||
if (counterAttackChanceF + counterAttackChanceF * 0.3333D >= 100D) counterAttackChanceLucky = df.format(100D);
|
||||
else counterAttackChanceLucky = df.format(counterAttackChanceF + counterAttackChanceF * 0.3333D);
|
||||
}
|
||||
|
||||
|
@ -43,10 +43,10 @@ public class TamingCommand extends SkillCommand {
|
||||
protected void dataCalculations() {
|
||||
DecimalFormat df = new DecimalFormat("0.0");
|
||||
float goreChanceF;
|
||||
if(skillValue >= goreMaxLevel) goreChanceF = (goreChanceMax);
|
||||
if (skillValue >= goreMaxLevel) goreChanceF = (goreChanceMax);
|
||||
else goreChanceF = (float) (((double) goreChanceMax / (double) goreMaxLevel) * skillValue);
|
||||
goreChance = df.format(goreChanceF);
|
||||
if(goreChanceF + goreChanceF * 0.3333D >= 100D) goreChanceLucky = df.format(100D);
|
||||
if (goreChanceF + goreChanceF * 0.3333D >= 100D) goreChanceLucky = df.format(100D);
|
||||
else goreChanceLucky = df.format(goreChanceF + goreChanceF * 0.3333D);
|
||||
}
|
||||
|
||||
|
@ -44,16 +44,16 @@ public class UnarmedCommand extends SkillCommand {
|
||||
float deflectChanceF;
|
||||
berserkLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
|
||||
|
||||
if(skillValue >= disarmMaxLevel) disarmChanceF = disarmChanceMax;
|
||||
if (skillValue >= disarmMaxLevel) disarmChanceF = disarmChanceMax;
|
||||
else disarmChanceF = (float) (((double) disarmChanceMax / (double) disarmMaxLevel) * skillValue);
|
||||
disarmChance = df.format(disarmChanceF);
|
||||
if(disarmChanceF + disarmChanceF * 0.3333D >= 100D) disarmChanceLucky = df.format(100D);
|
||||
if (disarmChanceF + disarmChanceF * 0.3333D >= 100D) disarmChanceLucky = df.format(100D);
|
||||
else disarmChanceLucky = df.format(disarmChanceF + disarmChanceF * 0.3333D);
|
||||
|
||||
if(skillValue >= deflectMaxLevel) deflectChanceF = deflectChanceMax;
|
||||
if (skillValue >= deflectMaxLevel) deflectChanceF = deflectChanceMax;
|
||||
else deflectChanceF = (float) (((double) deflectChanceMax / (double) deflectMaxLevel) * skillValue);
|
||||
deflectChance = df.format(deflectChanceF);
|
||||
if(deflectChanceF + deflectChanceF * 0.3333D >= 100D) deflectChanceLucky = df.format(100D);
|
||||
if (deflectChanceF + deflectChanceF * 0.3333D >= 100D) deflectChanceLucky = df.format(100D);
|
||||
else deflectChanceLucky = df.format(deflectChanceF + deflectChanceF * 0.3333D);
|
||||
|
||||
if (skillValue >= 250) ironArmBonus = String.valueOf(ironArmMaxBonus);
|
||||
|
@ -38,10 +38,10 @@ public class WoodcuttingCommand extends SkillCommand {
|
||||
float doubleDropChanceF;
|
||||
|
||||
treeFellerLength = String.valueOf(2 + (int) ((double) skillValue / (double) abilityLengthIncreaseLevel));
|
||||
if(skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
|
||||
if (skillValue >= doubleDropsMaxLevel) doubleDropChanceF = (float) (doubleDropsMaxBonus);
|
||||
else doubleDropChanceF = (float) ((doubleDropsMaxBonus / doubleDropsMaxLevel) * skillValue);
|
||||
doubleDropChance = df.format(doubleDropChanceF);
|
||||
if(doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
|
||||
if (doubleDropChanceF + doubleDropChanceF * 0.3333D >= 100D) doubleDropChanceLucky = df.format(100D);
|
||||
else doubleDropChanceLucky = df.format(doubleDropChanceF + doubleDropChanceF * 0.3333D);
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,13 @@ public abstract class ConfigLoader {
|
||||
protected File configFile;
|
||||
protected FileConfiguration config;
|
||||
|
||||
public ConfigLoader(String relativePath, String fileName){
|
||||
public ConfigLoader(String relativePath, String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(plugin.getDataFolder(), relativePath + File.separator + fileName);
|
||||
loadFile();
|
||||
}
|
||||
|
||||
public ConfigLoader(String fileName){
|
||||
public ConfigLoader(String fileName) {
|
||||
this.fileName = fileName;
|
||||
configFile = new File(plugin.getDataFolder(), fileName);
|
||||
loadFile();
|
||||
|
@ -202,11 +202,11 @@ public class TreasuresConfig extends ConfigLoader{
|
||||
int dropLevel = fTreasure.getDropLevel();
|
||||
int maxLevel = fTreasure.getMaxLevel();
|
||||
|
||||
if(dropLevel <= Config.getInstance().getFishingTierLevelsTier1() && maxLevel >= Config.getInstance().getFishingTierLevelsTier1()) {
|
||||
if (dropLevel <= Config.getInstance().getFishingTierLevelsTier1() && maxLevel >= Config.getInstance().getFishingTierLevelsTier1()) {
|
||||
fishingRewardsTier1.add(fTreasure);
|
||||
}
|
||||
|
||||
if(dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) {
|
||||
if (dropLevel <= Config.getInstance().getFishingTierLevelsTier2() && maxLevel >= Config.getInstance().getFishingTierLevelsTier2()) {
|
||||
fishingRewardsTier2.add(fTreasure);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class CustomArmorConfig extends ConfigLoader{
|
||||
private void loadArmor(String armorType, List<Integer> idList) {
|
||||
ConfigurationSection armorSection = config.getConfigurationSection(armorType);
|
||||
|
||||
if(armorSection == null)
|
||||
if (armorSection == null)
|
||||
return;
|
||||
|
||||
Set<String> armorConfigSet = armorSection.getKeys(false);
|
||||
@ -88,7 +88,7 @@ public class CustomArmorConfig extends ConfigLoader{
|
||||
}
|
||||
|
||||
public List<Repairable> getLoadedRepairables() {
|
||||
if(repairables == null) return new ArrayList<Repairable>();
|
||||
if (repairables == null) return new ArrayList<Repairable>();
|
||||
return repairables;
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class CustomBlocksConfig extends ConfigLoader {
|
||||
private void loadBlocks(String skillType, List<ItemStack> blockList) {
|
||||
ConfigurationSection skillSection = config.getConfigurationSection(skillType);
|
||||
|
||||
if(skillSection == null)
|
||||
if (skillSection == null)
|
||||
return;
|
||||
|
||||
Set<String> skillConfigSet = skillSection.getKeys(false);
|
||||
|
@ -53,7 +53,7 @@ public class CustomToolsConfig extends ConfigLoader {
|
||||
private void loadTool(String toolType, List<Integer> idList) {
|
||||
ConfigurationSection toolSection = config.getConfigurationSection(toolType);
|
||||
|
||||
if(toolSection == null)
|
||||
if (toolSection == null)
|
||||
return;
|
||||
|
||||
Set<String> toolConfigSet = toolSection.getKeys(false);
|
||||
@ -95,7 +95,7 @@ public class CustomToolsConfig extends ConfigLoader {
|
||||
}
|
||||
|
||||
public List<Repairable> getLoadedRepairables() {
|
||||
if(repairables == null) return new ArrayList<Repairable>();
|
||||
if (repairables == null) return new ArrayList<Repairable>();
|
||||
return repairables;
|
||||
}
|
||||
}
|
||||
|
@ -120,9 +120,9 @@ public class McMMOPlayer {
|
||||
* @param newvalue The amount of XP to add
|
||||
*/
|
||||
public void addXP(SkillType skillType, int newValue) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
else if(player.getGameMode() == null)
|
||||
else if (player.getGameMode() == null)
|
||||
return;
|
||||
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE)) {
|
||||
|
@ -297,7 +297,7 @@ public class PlayerProfile {
|
||||
|
||||
public void save(boolean override) {
|
||||
Long timestamp = System.currentTimeMillis();
|
||||
if(timestamp < (lastSave + ((long) Config.getInstance().getSaveInterval() * 60000)) && !override)
|
||||
if (timestamp < (lastSave + ((long) Config.getInstance().getSaveInterval() * 60000)) && !override)
|
||||
return;
|
||||
|
||||
// if we are using mysql save to database
|
||||
|
@ -128,7 +128,7 @@ public class BlockListener implements Listener {
|
||||
int id = block.getTypeId();
|
||||
Material type = block.getType();
|
||||
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
/* Code to prevent issues with placed falling Sand/Gravel not being tracked */
|
||||
if (type.equals(Material.SAND) || type.equals(Material.GRAVEL)) {
|
||||
@ -171,7 +171,7 @@ public class BlockListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
@ -258,7 +258,7 @@ public class BlockListener implements Listener {
|
||||
if ((relativeType == Material.SAND || relativeType == Material.GRAVEL) && mcMMO.placeStore.isTrue(relative)) {
|
||||
mcMMO.placeStore.setFalse(relative);
|
||||
}
|
||||
else if (!BlockChecks.shouldBeWatched(relative) && mcMMO.placeStore.isTrue(relative)){
|
||||
else if (!BlockChecks.shouldBeWatched(relative) && mcMMO.placeStore.isTrue(relative)) {
|
||||
mcMMO.placeStore.setFalse(relative);
|
||||
}
|
||||
else {
|
||||
@ -284,7 +284,7 @@ public class BlockListener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
|
@ -60,13 +60,13 @@ public class EntityListener implements Listener {
|
||||
if (event instanceof FakeEntityDamageByEntityEvent)
|
||||
return;
|
||||
|
||||
if(event.getDamage() <= 0)
|
||||
if (event.getDamage() <= 0)
|
||||
return;
|
||||
|
||||
Entity attacker = event.getDamager();
|
||||
Entity defender = event.getEntity();
|
||||
|
||||
if(attacker.hasMetadata("NPC") || defender.hasMetadata("NPC")) return; // Check if either players is are Citizens NPCs
|
||||
if (attacker.hasMetadata("NPC") || defender.hasMetadata("NPC")) return; // Check if either players is are Citizens NPCs
|
||||
|
||||
if (attacker instanceof Projectile) {
|
||||
attacker = ((Projectile) attacker).getShooter();
|
||||
@ -118,7 +118,7 @@ public class EntityListener implements Listener {
|
||||
Entity entity = event.getEntity();
|
||||
DamageCause cause = event.getCause();
|
||||
|
||||
if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
if (!(entity instanceof LivingEntity)) {
|
||||
return;
|
||||
@ -179,7 +179,7 @@ public class EntityListener implements Listener {
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
LivingEntity entity = event.getEntity();
|
||||
|
||||
if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
entity.setFireTicks(0);
|
||||
BleedTimer.remove(entity);
|
||||
@ -211,7 +211,7 @@ public class EntityListener implements Listener {
|
||||
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
if (entity instanceof TNTPrimed) {
|
||||
int id = entity.getEntityId();
|
||||
@ -236,9 +236,9 @@ public class EntityListener implements Listener {
|
||||
public void onEnitityExplode(EntityExplodeEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
|
||||
if(entity == null) return;
|
||||
if (entity == null) return;
|
||||
|
||||
if(entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (entity.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
if (entity instanceof TNTPrimed) {
|
||||
int id = entity.getEntityId();
|
||||
@ -263,7 +263,7 @@ public class EntityListener implements Listener {
|
||||
if (event.getEntity() instanceof Player) {
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
int currentFoodLevel = player.getFoodLevel();
|
||||
@ -399,7 +399,7 @@ public class EntityListener implements Listener {
|
||||
public void onEntityTame(EntityTameEvent event) {
|
||||
Player player = (Player) event.getOwner();
|
||||
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
if (Permissions.taming(player) && !mcMMO.placeStore.isSpawnedPet(event.getEntity())) {
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
@ -21,7 +21,7 @@ public class HardcoreListener implements Listener {
|
||||
public void onPlayerDeath(PlayerDeathEvent event) {
|
||||
Player player = event.getEntity(); //Note this returns a Player object for this subevent
|
||||
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
if (!Permissions.hardcoremodeBypass(player)) {
|
||||
if (player.getKiller() != null && Config.getInstance().getHardcoreVampirismEnabled()) {
|
||||
|
@ -63,7 +63,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerWorldChangeEvent(PlayerChangedWorldEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
@ -97,7 +97,7 @@ public class PlayerListener implements Listener {
|
||||
int shakeUnlockLevel = advancedConfig.getShakeUnlockLevel();
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
if (Permissions.fishing(player)) {
|
||||
State state = event.getState();
|
||||
@ -131,7 +131,7 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerPickupItem(PlayerPickupItemEvent event) {
|
||||
|
||||
if(event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
PlayerProfile profile = Users.getProfile(event.getPlayer());
|
||||
|
||||
@ -151,7 +151,7 @@ public class PlayerListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
if(event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
Users.addUser(event.getPlayer()).getProfile().actualizeRespawnATS();
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
/* GARBAGE COLLECTION */
|
||||
|
||||
@ -181,7 +181,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
//TODO: Locale ALL the things.
|
||||
if (Config.getInstance().getMOTDEnabled() && Permissions.motd(player)) {
|
||||
@ -287,7 +287,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
if(event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (event.getPlayer().hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
PlayerProfile profile = Users.getProfile(event.getPlayer());
|
||||
|
||||
if (profile != null) {
|
||||
@ -303,7 +303,7 @@ public class PlayerListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
Action action = event.getAction();
|
||||
Block block = event.getClickedBlock();
|
||||
ItemStack inHand = player.getItemInHand();
|
||||
@ -427,7 +427,7 @@ public class PlayerListener implements Listener {
|
||||
public void onPlayerChat(AsyncPlayerChatEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
if (player.hasMetadata("NPC")) return; // Check if this player is a Citizens NPC
|
||||
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class SelfListener implements Listener {
|
||||
public void onPlayerXpGain(McMMOPlayerXpGainEvent event) {
|
||||
int xp = event.getXpGained();
|
||||
|
||||
if(xp < 0) {
|
||||
if (xp < 0) {
|
||||
try {
|
||||
throw new Exception("Gained negative XP!");
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ public class WorldListener implements Listener {
|
||||
@EventHandler
|
||||
public void onWorldInit(WorldInitEvent event) {
|
||||
File dataDir = new File(event.getWorld().getWorldFolder(), "mcmmo_data");
|
||||
if(!dataDir.exists()) {
|
||||
if (!dataDir.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(mcMMO.p == null)
|
||||
if (mcMMO.p == null)
|
||||
return;
|
||||
|
||||
mcMMO.p.getLogger().info("Converting block storage for " + event.getWorld().getName() + " to a new format.");
|
||||
@ -50,7 +50,7 @@ public class WorldListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
if(event.getChunk().getEntities().length > 0)
|
||||
if (event.getChunk().getEntities().length > 0)
|
||||
mcMMO.placeStore.loadChunk(event.getChunk().getX(), event.getChunk().getZ(), event.getWorld());
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class mcMMO extends JavaPlugin {
|
||||
repairManager.registerRepairables(repairables);
|
||||
|
||||
//Check if Repair Anvil and Salvage Anvil have different itemID's
|
||||
if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()){
|
||||
if (configInstance.getSalvageAnvilId() == configInstance.getRepairAnvilId()) {
|
||||
getLogger().warning("Can't use the same itemID for Repair/Salvage Anvils!");
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class ChunkletUnloader implements Runnable {
|
||||
|
||||
//Chunklets are unloaded only if their chunk has been unloaded for minimumInactiveTime
|
||||
if (inactiveTime >= minimumInactiveTime) {
|
||||
if(mcMMO.placeStore == null)
|
||||
if (mcMMO.placeStore == null)
|
||||
continue;
|
||||
|
||||
mcMMO.placeStore.unloadChunk(chunk.getX(), chunk.getZ(), chunk.getWorld());
|
||||
|
@ -23,7 +23,7 @@ public class GreenThumbTimer implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(this.block.getType() != this.type)
|
||||
if (this.block.getType() != this.type)
|
||||
this.block.setType(this.type);
|
||||
|
||||
int skillLevel = this.profile.getSkillLevel(SkillType.HERBALISM);
|
||||
|
@ -25,7 +25,7 @@ public class BlockStoreConversionMain implements Runnable {
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if(this.taskID >= 0)
|
||||
if (this.taskID >= 0)
|
||||
return;
|
||||
|
||||
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
|
||||
@ -34,18 +34,18 @@ public class BlockStoreConversionMain implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(!this.dataDir.exists()) {
|
||||
if (!this.dataDir.exists()) {
|
||||
softStop();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!this.dataDir.isDirectory()) {
|
||||
if (!this.dataDir.isDirectory()) {
|
||||
this.dataDir.delete();
|
||||
softStop();
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.dataDir.listFiles().length <= 0) {
|
||||
if (this.dataDir.listFiles().length <= 0) {
|
||||
this.dataDir.delete();
|
||||
softStop();
|
||||
return;
|
||||
@ -54,7 +54,7 @@ public class BlockStoreConversionMain implements Runnable {
|
||||
this.xDirs = this.dataDir.listFiles();
|
||||
|
||||
for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.xDirs.length); this.i++) {
|
||||
if(this.converters[this.i] == null)
|
||||
if (this.converters[this.i] == null)
|
||||
this.converters[this.i] = new BlockStoreConversionXDirectory();
|
||||
|
||||
this.converters[this.i].start(this.world, this.xDirs[this.i]);
|
||||
@ -64,7 +64,7 @@ public class BlockStoreConversionMain implements Runnable {
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if(this.taskID < 0)
|
||||
if (this.taskID < 0)
|
||||
return;
|
||||
|
||||
this.scheduler.cancelTask(this.taskID);
|
||||
@ -74,7 +74,7 @@ public class BlockStoreConversionMain implements Runnable {
|
||||
public void softStop() {
|
||||
stop();
|
||||
|
||||
if(this.dataDir.exists() || this.dataDir.isDirectory()) {
|
||||
if (this.dataDir.exists() || this.dataDir.isDirectory()) {
|
||||
start();
|
||||
return;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
|
||||
this.converters = new BlockStoreConversionZDirectory[HiddenConfig.getInstance().getConversionRate()];
|
||||
this.dataDir = dataDir;
|
||||
|
||||
if(this.taskID >= 0)
|
||||
if (this.taskID >= 0)
|
||||
return;
|
||||
|
||||
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
|
||||
@ -35,18 +35,18 @@ public class BlockStoreConversionXDirectory implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(!this.dataDir.exists()) {
|
||||
if (!this.dataDir.exists()) {
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!this.dataDir.isDirectory()) {
|
||||
if (!this.dataDir.isDirectory()) {
|
||||
this.dataDir.delete();
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.dataDir.listFiles().length <= 0) {
|
||||
if (this.dataDir.listFiles().length <= 0) {
|
||||
this.dataDir.delete();
|
||||
stop();
|
||||
return;
|
||||
@ -55,7 +55,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
|
||||
this.zDirs = this.dataDir.listFiles();
|
||||
|
||||
for (this.i = 0; (this.i < HiddenConfig.getInstance().getConversionRate()) && (this.i < this.zDirs.length); this.i++) {
|
||||
if(this.converters[this.i] == null)
|
||||
if (this.converters[this.i] == null)
|
||||
this.converters[this.i] = new BlockStoreConversionZDirectory();
|
||||
|
||||
this.converters[this.i].start(this.world, this.dataDir, this.zDirs[this.i]);
|
||||
@ -65,7 +65,7 @@ public class BlockStoreConversionXDirectory implements Runnable {
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if(this.taskID < 0)
|
||||
if (this.taskID < 0)
|
||||
return;
|
||||
|
||||
this.scheduler.cancelTask(this.taskID);
|
||||
|
@ -40,7 +40,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
this.dataDir = dataDir;
|
||||
this.xDir = xDir;
|
||||
|
||||
if(this.taskID >= 0)
|
||||
if (this.taskID >= 0)
|
||||
return;
|
||||
|
||||
this.taskID = this.scheduler.scheduleSyncDelayedTask(mcMMO.p, this, 1);
|
||||
@ -49,18 +49,18 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if(!this.dataDir.exists()) {
|
||||
if (!this.dataDir.exists()) {
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!this.dataDir.isDirectory()) {
|
||||
if (!this.dataDir.isDirectory()) {
|
||||
this.dataDir.delete();
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.dataDir.listFiles().length <= 0) {
|
||||
if (this.dataDir.listFiles().length <= 0) {
|
||||
this.dataDir.delete();
|
||||
stop();
|
||||
return;
|
||||
@ -112,7 +112,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
|
||||
for(this.y2 = (64 * this.y); this.y2 < (64 * this.y + 64); this.y2++) {
|
||||
try {
|
||||
if(!this.manager.isTrue(this.cxPos, this.y2, this.czPos, this.world))
|
||||
if (!this.manager.isTrue(this.cxPos, this.y2, this.czPos, this.world))
|
||||
continue;
|
||||
|
||||
this.newManager.setTrue(this.cxPos, this.y2, this.czPos, this.world);
|
||||
@ -130,16 +130,16 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
|
||||
for(this.x = 0; this.x < 16; this.x++) {
|
||||
for(this.z = 0; this.z < 16; this.z++) {
|
||||
if(this.primitiveChunklet != null)
|
||||
if (this.primitiveChunklet != null)
|
||||
this.oldArray = this.primitiveChunklet.store[x][z];
|
||||
if(this.primitiveExChunklet != null)
|
||||
if (this.primitiveExChunklet != null)
|
||||
this.oldArray = this.primitiveExChunklet.store[x][z];
|
||||
else
|
||||
return;
|
||||
this.newArray = this.currentChunk.store[x][z];
|
||||
if(this.oldArray.length < 64)
|
||||
if (this.oldArray.length < 64)
|
||||
return;
|
||||
else if(this.newArray.length < ((this.y * 64) + 64))
|
||||
else if (this.newArray.length < ((this.y * 64) + 64))
|
||||
return;
|
||||
System.arraycopy(this.oldArray, 0, this.newArray, (this.y * 64), 64);
|
||||
}
|
||||
@ -150,7 +150,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
this.newManager.unloadChunk(this.cx, this.cz, this.world);
|
||||
|
||||
for(File yFile : dataDir.listFiles()) {
|
||||
if(!yFile.exists())
|
||||
if (!yFile.exists())
|
||||
continue;
|
||||
|
||||
yFile.delete();
|
||||
@ -160,7 +160,7 @@ public class BlockStoreConversionZDirectory implements Runnable {
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
if(this.taskID < 0)
|
||||
if (this.taskID < 0)
|
||||
return;
|
||||
|
||||
this.scheduler.cancelTask(taskID);
|
||||
|
@ -33,7 +33,7 @@ public class Axes {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void axesBonus(Player attacker, EntityDamageByEntityEvent event) {
|
||||
if(attacker == null)
|
||||
if (attacker == null)
|
||||
return;
|
||||
|
||||
final int MAX_BONUS = advancedConfig.getBonusDamageAxesBonusMax();
|
||||
@ -57,7 +57,7 @@ public class Axes {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public static void axeCriticalCheck(Player attacker, EntityDamageByEntityEvent event) {
|
||||
if(attacker == null)
|
||||
if (attacker == null)
|
||||
return;
|
||||
|
||||
Entity entity = event.getEntity();
|
||||
@ -95,10 +95,10 @@ public class Axes {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
if (chance > random.nextInt(randomChance) && !entity.isDead()){
|
||||
if (chance > random.nextInt(randomChance) && !entity.isDead()) {
|
||||
int damage = event.getDamage();
|
||||
|
||||
if (entity instanceof Player){
|
||||
if (entity instanceof Player) {
|
||||
event.setDamage((int) (damage * PVP_MODIFIER));
|
||||
((Player) entity).sendMessage(LocaleLoader.getString("Axes.Combat.CritStruck"));
|
||||
}
|
||||
@ -118,7 +118,7 @@ public class Axes {
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void impact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||
if(attacker == null)
|
||||
if (attacker == null)
|
||||
return;
|
||||
|
||||
/*
|
||||
@ -140,7 +140,7 @@ public class Axes {
|
||||
}
|
||||
else {
|
||||
for (ItemStack armor : targetPlayer.getInventory().getArmorContents()) {
|
||||
if(Math.random() * 100 > 75) {
|
||||
if (Math.random() * 100 > 75) {
|
||||
int lowerdamage = 0;
|
||||
for (int i = 0; i <= durabilityDamage; i ++) {
|
||||
if (armor.containsEnchantment(Enchantment.DURABILITY)) {
|
||||
@ -172,7 +172,7 @@ public class Axes {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
private static void applyGreaterImpact(Player attacker, LivingEntity target, EntityDamageByEntityEvent event) {
|
||||
if(attacker == null)
|
||||
if (attacker == null)
|
||||
return;
|
||||
|
||||
final int GREATER_IMPACT_CHANCE = advancedConfig.getGreaterImpactChance();
|
||||
@ -203,7 +203,7 @@ public class Axes {
|
||||
* @return true if the player has armor, false otherwise
|
||||
*/
|
||||
private static boolean hasArmor(Player player) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
PlayerInventory inventory = player.getInventory();
|
||||
|
@ -38,7 +38,7 @@ public class Excavation {
|
||||
* @param player The player who broke the block
|
||||
*/
|
||||
public static void excavationProcCheck(Block block, Player player) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Material type = block.getType();
|
||||
@ -128,7 +128,7 @@ public class Excavation {
|
||||
* @param block The block to check
|
||||
*/
|
||||
public static void gigaDrillBreaker(Player player, Block block) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Skills.abilityDurabilityLoss(player.getItemInHand(), Config.getInstance().getAbilityToolDamage());
|
||||
|
@ -84,7 +84,7 @@ public class Herbalism {
|
||||
* @param plugin mcMMO plugin instance
|
||||
*/
|
||||
public static void herbalismProcCheck(final Block block, Player player, BlockBreakEvent event, mcMMO plugin) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
final PlayerProfile profile = Users.getProfile(player);
|
||||
@ -396,7 +396,7 @@ public class Herbalism {
|
||||
}
|
||||
}
|
||||
|
||||
if(Config.getInstance().getHerbalismAFKDisabled() && player.isInsideVehicle())
|
||||
if (Config.getInstance().getHerbalismAFKDisabled() && player.isInsideVehicle())
|
||||
return;
|
||||
|
||||
Skills.xpProcessing(player, profile, SkillType.HERBALISM, xp);
|
||||
|
@ -275,13 +275,13 @@ public class WoodCutting {
|
||||
|
||||
byte data = currentBlock.getData();
|
||||
|
||||
if((data & 0x4) == 0x4)
|
||||
if ((data & 0x4) == 0x4)
|
||||
data ^= 0x4;
|
||||
|
||||
if((data & 0x8) == 0x8)
|
||||
if ((data & 0x8) == 0x8)
|
||||
data ^= 0x8;
|
||||
|
||||
if(TreeSpecies.getByData(data) == TreeSpecies.JUNGLE) {
|
||||
if (TreeSpecies.getByData(data) == TreeSpecies.JUNGLE) {
|
||||
Block corner1 = currentBlock.getRelative(1, 0, 1);
|
||||
Block corner2 = currentBlock.getRelative(1, 0, -1);
|
||||
Block corner3 = currentBlock.getRelative(-1, 0, 1);
|
||||
@ -307,7 +307,7 @@ public class WoodCutting {
|
||||
}
|
||||
|
||||
if (BlockChecks.treeFellerCompatible(yPositive)) {
|
||||
if(!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) {
|
||||
if (!mcMMO.placeStore.isTrue(currentBlock) && !toBeFelled.contains(yPositive)) {
|
||||
processTreeFelling(yPositive, toBeFelled);
|
||||
}
|
||||
}
|
||||
@ -345,10 +345,10 @@ public class WoodCutting {
|
||||
int skillLevel = Users.getProfile(player).getSkillLevel(SkillType.WOODCUTTING);
|
||||
byte type = block.getData();
|
||||
|
||||
if((type & 0x4) == 0x4)
|
||||
if ((type & 0x4) == 0x4)
|
||||
type ^= 0x4;
|
||||
|
||||
if((type & 0x8) == 0x8)
|
||||
if ((type & 0x8) == 0x8)
|
||||
type ^= 0x8;
|
||||
|
||||
Material mat = Material.getMaterial(block.getTypeId());
|
||||
@ -442,17 +442,17 @@ public class WoodCutting {
|
||||
else {
|
||||
byte type = block.getData();
|
||||
|
||||
if((type & 0x4) == 0x4)
|
||||
if ((type & 0x4) == 0x4)
|
||||
type ^= 0x4;
|
||||
|
||||
if((type & 0x8) == 0x8)
|
||||
if ((type & 0x8) == 0x8)
|
||||
type ^= 0x8;
|
||||
|
||||
TreeSpecies species = TreeSpecies.getByData(type);
|
||||
|
||||
//Apparently species can be null in certain cases (custom server mods?)
|
||||
//https://github.com/mcMMO-Dev/mcMMO/issues/229
|
||||
if(species == null)
|
||||
if (species == null)
|
||||
return;
|
||||
|
||||
switch (species) {
|
||||
|
@ -90,7 +90,7 @@ public class Repair {
|
||||
* @param is Item being repaired
|
||||
*/
|
||||
protected static void addEnchants(Player player, ItemStack is) {
|
||||
if(Permissions.arcaneBypass(player)) {
|
||||
if (Permissions.arcaneBypass(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Arcane.Perfect"));
|
||||
return;
|
||||
}
|
||||
@ -210,7 +210,7 @@ public class Repair {
|
||||
*/
|
||||
protected static short repairCalculate(Player player, int skillLevel, short durability, int repairAmount) {
|
||||
float bonus;
|
||||
if(skillLevel >= REPAIR_MASTERY_MAX_BONUS_LEVEL) bonus = ((float) REPAIR_MASTERY_CHANCE_MAX / 100F);
|
||||
if (skillLevel >= REPAIR_MASTERY_MAX_BONUS_LEVEL) bonus = ((float) REPAIR_MASTERY_CHANCE_MAX / 100F);
|
||||
else bonus = (((float) skillLevel) / ((float) REPAIR_MASTERY_MAX_BONUS_LEVEL)) * (((float) REPAIR_MASTERY_CHANCE_MAX) / 100F);
|
||||
|
||||
if (Permissions.repairMastery(player)) {
|
||||
@ -222,7 +222,7 @@ public class Repair {
|
||||
repairAmount = (int) (repairAmount * 2D);
|
||||
}
|
||||
|
||||
if(repairAmount <= 0 || repairAmount > 32767)
|
||||
if (repairAmount <= 0 || repairAmount > 32767)
|
||||
repairAmount = 32767;
|
||||
|
||||
durability -= repairAmount;
|
||||
@ -249,7 +249,7 @@ public class Repair {
|
||||
|
||||
if (Permissions.luckyRepair(player)) randomChance = (int) (randomChance * 0.75);
|
||||
|
||||
if (chance > random.nextInt(randomChance) && Permissions.repairBonus(player)){
|
||||
if (chance > random.nextInt(randomChance) && Permissions.repairBonus(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Repair.Skills.FeltEasy"));
|
||||
return true;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public class Salvage {
|
||||
return;
|
||||
}
|
||||
|
||||
if(player.getGameMode() == GameMode.SURVIVAL) {
|
||||
if (player.getGameMode() == GameMode.SURVIVAL) {
|
||||
final PlayerProfile profile = Users.getProfile(player);
|
||||
final int skillLevel = profile.getSkillLevel(SkillType.REPAIR);
|
||||
final int unlockLevel = configInstance.getSalvageUnlockLevel();
|
||||
|
@ -24,7 +24,7 @@ public class CounterAttackEventHandler {
|
||||
}
|
||||
|
||||
protected boolean isHoldingSword() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
return ItemChecks.isSword(player.getItemInHand());
|
||||
@ -39,7 +39,7 @@ public class CounterAttackEventHandler {
|
||||
}
|
||||
|
||||
protected void sendAbilityMessages() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Swords.Combat.Countered"));
|
||||
|
@ -19,7 +19,7 @@ public class SerratedStrikesEventHandler {
|
||||
}
|
||||
|
||||
protected void applyAbilityEffects() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Combat.applyAbilityAoE(player, target, damage / Swords.SERRATED_STRIKES_MODIFIER, SkillType.SWORDS);
|
||||
|
@ -26,7 +26,7 @@ public class SwordsManager {
|
||||
* @param defender The defending entity
|
||||
*/
|
||||
public void bleedCheck(LivingEntity defender) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.swordsBleed(player)) {
|
||||
@ -53,7 +53,7 @@ public class SwordsManager {
|
||||
}
|
||||
|
||||
public void counterAttackChecks(LivingEntity attacker, int damage) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.counterAttack(player)) {
|
||||
@ -82,7 +82,7 @@ public class SwordsManager {
|
||||
}
|
||||
|
||||
public void serratedStrikes(LivingEntity target, int damage) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.serratedStrikes(player)) {
|
||||
|
@ -19,7 +19,7 @@ public class BeastLoreEventHandler {
|
||||
}
|
||||
|
||||
protected void sendInspectMessage() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
String message = LocaleLoader.getString("Combat.BeastLore") + " ";
|
||||
|
@ -28,14 +28,14 @@ public class CallOfTheWildEventHandler {
|
||||
}
|
||||
|
||||
protected void sendInsufficientAmountMessage() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore") + " " + ChatColor.GRAY + Misc.prettyItemString(inHand.getTypeId()));
|
||||
}
|
||||
|
||||
protected boolean nearbyEntityExists() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return false;
|
||||
|
||||
boolean entityExists = false;
|
||||
@ -51,7 +51,7 @@ public class CallOfTheWildEventHandler {
|
||||
}
|
||||
|
||||
protected void sendFailureMessage() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (type == EntityType.OCELOT) {
|
||||
@ -63,7 +63,7 @@ public class CallOfTheWildEventHandler {
|
||||
}
|
||||
|
||||
protected void spawnCreature() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
|
||||
@ -80,7 +80,7 @@ public class CallOfTheWildEventHandler {
|
||||
}
|
||||
|
||||
protected void processResourceCost() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
int newAmount = inHand.getAmount() - summonAmount;
|
||||
@ -94,7 +94,7 @@ public class CallOfTheWildEventHandler {
|
||||
}
|
||||
|
||||
protected void sendSuccessMessage() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Summon.Complete"));
|
||||
|
@ -18,7 +18,7 @@ public class EnvironmentallyAwareEventHandler {
|
||||
}
|
||||
|
||||
protected void teleportWolf() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (event.getDamage() > wolf.getHealth()) {
|
||||
@ -29,7 +29,7 @@ public class EnvironmentallyAwareEventHandler {
|
||||
}
|
||||
|
||||
protected void sendAbilityMessage() {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Taming.Listener.Wolf"));
|
||||
|
@ -34,7 +34,7 @@ public class TamingManager {
|
||||
* @param damage The damage being absorbed by the wolf
|
||||
*/
|
||||
public void fastFoodService(Wolf wolf, int damage) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.fastFoodService(player)) {
|
||||
@ -62,7 +62,7 @@ public class TamingManager {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void sharpenedClaws(EntityDamageEvent event) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.sharpenedClaws(player)) {
|
||||
@ -82,7 +82,7 @@ public class TamingManager {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void gore(EntityDamageEvent event) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.gore(player)) {
|
||||
@ -160,7 +160,7 @@ public class TamingManager {
|
||||
* @param livingEntity The entity to examine
|
||||
*/
|
||||
public void beastLore(LivingEntity livingEntity) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.beastLore(player)) {
|
||||
@ -179,7 +179,7 @@ public class TamingManager {
|
||||
* @param summonAmount The amount of material needed to summon the entity
|
||||
*/
|
||||
private void callOfTheWild(EntityType type, int summonAmount) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.callOfTheWild(player)) {
|
||||
@ -213,7 +213,7 @@ public class TamingManager {
|
||||
* @param cause The damage cause of the event
|
||||
*/
|
||||
private void environmentallyAware(EntityDamageEvent event, DamageCause cause) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.environmentallyAware(player)) {
|
||||
@ -248,7 +248,7 @@ public class TamingManager {
|
||||
* @param cause The damage cause of the event
|
||||
*/
|
||||
private void thickFur(EntityDamageEvent event, DamageCause cause) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.thickFur(player)) {
|
||||
@ -268,7 +268,7 @@ public class TamingManager {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
private void shockProof(EntityDamageEvent event) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.shockProof(player)) {
|
||||
|
@ -25,7 +25,7 @@ public class UnarmedManager {
|
||||
* @param defender The defending player
|
||||
*/
|
||||
public void disarmCheck(Player defender) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.disarm(player)) {
|
||||
@ -62,7 +62,7 @@ public class UnarmedManager {
|
||||
* @param event The event to modify
|
||||
*/
|
||||
public void deflectCheck(EntityDamageEvent event) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.deflect(player)) {
|
||||
@ -92,7 +92,7 @@ public class UnarmedManager {
|
||||
* @param event The event to modify.
|
||||
*/
|
||||
public void bonusDamage(EntityDamageEvent event) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Permissions.unarmedBonus(player)) {
|
||||
@ -112,7 +112,7 @@ public class UnarmedManager {
|
||||
* @return true if the defender was not disarmed, false otherwise
|
||||
*/
|
||||
private boolean hasIronGrip(Player defender) {
|
||||
if(defender == null)
|
||||
if (defender == null)
|
||||
return false;
|
||||
|
||||
if (!Permissions.ironGrip(defender)) {
|
||||
|
@ -173,7 +173,7 @@ public class BlockChecks {
|
||||
* @param block Block to check
|
||||
* @return true if the block is affected, false otherwise
|
||||
*/
|
||||
public static boolean canBeGreenTerra(Block block){
|
||||
public static boolean canBeGreenTerra(Block block) {
|
||||
switch (block.getType()) {
|
||||
case BROWN_MUSHROOM:
|
||||
case CACTUS:
|
||||
@ -297,7 +297,7 @@ public class BlockChecks {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLog (Block block){
|
||||
public static boolean isLog (Block block) {
|
||||
if (block.getType().equals(Material.LOG) || (customBlocksEnabled && ModChecks.isCustomLogBlock(block))) {
|
||||
return true;
|
||||
}
|
||||
|
@ -66,10 +66,10 @@ public class Database {
|
||||
mcMMO.p.getLogger().info("Connection to MySQL was a success!");
|
||||
} catch (SQLException ex) {
|
||||
connection = null;
|
||||
if(reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("Connection to MySQL failed!");
|
||||
if (reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("Connection to MySQL failed!");
|
||||
} catch (ClassNotFoundException ex) {
|
||||
connection = null;
|
||||
if(reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("MySQL database driver not found!");
|
||||
if (reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("MySQL database driver not found!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ public class Database {
|
||||
|
||||
PreparedStatement statement = null;
|
||||
try {
|
||||
if(!checkConnected()) return;
|
||||
if (!checkConnected()) return;
|
||||
statement = connection.prepareStatement(sql);
|
||||
resultSet = statement.executeQuery();
|
||||
|
||||
|
@ -301,7 +301,7 @@ public class Leaderboard {
|
||||
}
|
||||
}
|
||||
|
||||
if(!inserted) {
|
||||
if (!inserted) {
|
||||
writer.append(ps.name + ":" + ps.statVal).append("\r\n");
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ public class Page {
|
||||
public static int getTotalPageNumber(String address)
|
||||
{
|
||||
String[] addressSplit = LocaleLoader.getString(address).split("\n");
|
||||
if(addressSplit.length <= 8)
|
||||
if (addressSplit.length <= 8)
|
||||
return 1;
|
||||
|
||||
return (addressSplit.length/8)+1;
|
||||
@ -24,7 +24,7 @@ public class Page {
|
||||
int pageIndexStart = 0;
|
||||
|
||||
//Determine what string to start at
|
||||
if(pagenum > 1)
|
||||
if (pagenum > 1)
|
||||
{
|
||||
pageIndexStart = 8*(pagenum-1);
|
||||
}
|
||||
@ -36,9 +36,9 @@ public class Page {
|
||||
|
||||
//Add targeted strings
|
||||
|
||||
while(allStrings.size() < 9)
|
||||
while (allStrings.size() < 9)
|
||||
{
|
||||
if(pageIndexStart+allStrings.size() > split.length)
|
||||
if (pageIndexStart+allStrings.size() > split.length)
|
||||
allStrings.add("");
|
||||
else
|
||||
allStrings.add(split[pageIndexStart+allStrings.size()-1]);
|
||||
@ -62,19 +62,19 @@ public class Page {
|
||||
player.sendMessage(ChatColor.DARK_AQUA+"Guide for "+capitalized+" available type /"+skilltype.toString().toLowerCase()+" ? [Page#]"); //TODO: Needs more locale.
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if(args[0].equals("?"))
|
||||
if (args[0].equals("?"))
|
||||
{
|
||||
|
||||
String address = "Guides."+capitalized;
|
||||
|
||||
if(args.length > 1 && Misc.isInt(args[1]) && Misc.getInt(args[1]) <= Page.getTotalPageNumber(address))
|
||||
if (args.length > 1 && Misc.isInt(args[1]) && Misc.getInt(args[1]) <= Page.getTotalPageNumber(address))
|
||||
{
|
||||
Page.clearChat(player);
|
||||
for(String target : Page.grabPageContents(capitalized+" Guide", address, Misc.getInt(args[1])))
|
||||
{
|
||||
player.sendMessage(target);
|
||||
}
|
||||
} else if(args.length == 1)
|
||||
} else if (args.length == 1)
|
||||
{
|
||||
Page.clearChat(player);
|
||||
for(String target : Page.grabPageContents(capitalized+" Guide", address, 1))
|
||||
@ -82,11 +82,11 @@ public class Page {
|
||||
player.sendMessage(target);
|
||||
}
|
||||
}
|
||||
else if(args.length > 1 && Misc.getInt(args[1]) > Page.getTotalPageNumber(address))
|
||||
else if (args.length > 1 && Misc.getInt(args[1]) > Page.getTotalPageNumber(address))
|
||||
{
|
||||
player.sendMessage("That page doesn't exist, there are only "+Page.getTotalPageNumber(address)+" total pages"); //TODO: Needs more locale.
|
||||
}
|
||||
else if(args.length > 1 && !Misc.isInt(args[1]))
|
||||
else if (args.length > 1 && !Misc.isInt(args[1]))
|
||||
{
|
||||
player.sendMessage("Not a valid page number!"); //TODO: Needs more locale.
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.entity.Player;
|
||||
public class Permissions {
|
||||
public static boolean hasPermission(CommandSender sender, String perm)
|
||||
{
|
||||
if(sender.hasPermission(perm))
|
||||
if (sender.hasPermission(perm))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -14,7 +14,7 @@ public class Permissions {
|
||||
|
||||
public static boolean hasPermission(Player sender, String perm)
|
||||
{
|
||||
if(sender.hasPermission(perm))
|
||||
if (sender.hasPermission(perm))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -38,7 +38,7 @@ public class Skills {
|
||||
* @param player The player whose cooldown is being checked
|
||||
* @return true if the cooldown is over, false otherwise
|
||||
*/
|
||||
public static boolean cooldownOver(long oldTime, int cooldown, Player player){
|
||||
public static boolean cooldownOver(long oldTime, int cooldown, Player player) {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
int adjustedCooldown = cooldown;
|
||||
|
||||
@ -92,7 +92,7 @@ public class Skills {
|
||||
* @param ability The ability to watch cooldowns for
|
||||
*/
|
||||
public static void watchCooldown(Player player, PlayerProfile profile, AbilityType ability) {
|
||||
if(player == null || profile == null || ability == null)
|
||||
if (player == null || profile == null || ability == null)
|
||||
return;
|
||||
|
||||
if (!profile.getAbilityInformed(ability) && cooldownOver(profile.getSkillDATS(ability) * Misc.TIME_CONVERSION_FACTOR, ability.getCooldown(), player)) {
|
||||
@ -510,14 +510,14 @@ public class Skills {
|
||||
* @param xp the amount of XP to gain
|
||||
*/
|
||||
public static void xpProcessing(Player player, PlayerProfile profile, SkillType type, int xp) {
|
||||
if(player == null)
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (type.getPermissions(player)) {
|
||||
if(Users.getPlayer(player) == null)
|
||||
if (Users.getPlayer(player) == null)
|
||||
return;
|
||||
|
||||
if((type.getMaxLevel() < profile.getSkillLevel(type) + 1) || (Misc.getPowerLevelCap() < Users.getPlayer(player).getPowerLevel() + 1))
|
||||
if ((type.getMaxLevel() < profile.getSkillLevel(type) + 1) || (Misc.getPowerLevelCap() < Users.getPlayer(player).getPowerLevel() + 1))
|
||||
return;
|
||||
|
||||
Users.getPlayer(player).addXP(type, xp);
|
||||
|
@ -6,7 +6,7 @@ public class ChunkletManagerFactory {
|
||||
public static ChunkletManager getChunkletManager() {
|
||||
HiddenConfig hConfig = HiddenConfig.getInstance();
|
||||
|
||||
if(hConfig.getChunkletsEnabled()) {
|
||||
if (hConfig.getChunkletsEnabled()) {
|
||||
return new HashChunkletManager();
|
||||
}
|
||||
|
||||
|
@ -25,14 +25,14 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
public void loadChunklet(int cx, int cy, int cz, World world) {
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
File cxDir = new File(dataDir, "" + cx);
|
||||
if(!cxDir.exists()) return;
|
||||
if (!cxDir.exists()) return;
|
||||
File czDir = new File(cxDir, "" + cz);
|
||||
if(!czDir.exists()) return;
|
||||
if (!czDir.exists()) return;
|
||||
File yFile = new File(czDir, "" + cy);
|
||||
if(!yFile.exists()) return;
|
||||
if (!yFile.exists()) return;
|
||||
|
||||
ChunkletStore in = deserializeChunkletStore(yFile);
|
||||
if(in != null) {
|
||||
if (in != null) {
|
||||
store.put(world.getName() + "," + cx + "," + cz + "," + cy, in);
|
||||
}
|
||||
}
|
||||
@ -40,11 +40,11 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
@Override
|
||||
public void unloadChunklet(int cx, int cy, int cz, World world) {
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
if(store.containsKey(world.getName() + "," + cx + "," + cz + "," + cy)) {
|
||||
if (store.containsKey(world.getName() + "," + cx + "," + cz + "," + cy)) {
|
||||
File cxDir = new File(dataDir, "" + cx);
|
||||
if(!cxDir.exists()) cxDir.mkdir();
|
||||
if (!cxDir.exists()) cxDir.mkdir();
|
||||
File czDir = new File(cxDir, "" + cz);
|
||||
if(!czDir.exists()) czDir.mkdir();
|
||||
if (!czDir.exists()) czDir.mkdir();
|
||||
File yFile = new File(czDir, "" + cy);
|
||||
|
||||
ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + cy);
|
||||
@ -57,18 +57,18 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
public void loadChunk(int cx, int cz, World world) {
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
File cxDir = new File(dataDir, "" + cx);
|
||||
if(!cxDir.exists()) return;
|
||||
if (!cxDir.exists()) return;
|
||||
File czDir = new File(cxDir, "" + cz);
|
||||
if(!czDir.exists()) return;
|
||||
if (!czDir.exists()) return;
|
||||
|
||||
for(int y = 0; y < 4; y++) {
|
||||
File yFile = new File(czDir, "" + y);
|
||||
if(!yFile.exists()) {
|
||||
if (!yFile.exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ChunkletStore in = deserializeChunkletStore(yFile);
|
||||
if(in != null) {
|
||||
if (in != null) {
|
||||
store.put(world.getName() + "," + cx + "," + cz + "," + y, in);
|
||||
}
|
||||
}
|
||||
@ -79,11 +79,11 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
|
||||
for(int y = 0; y < 4; y++) {
|
||||
if(store.containsKey(world.getName() + "," + cx + "," + cz + "," + y)) {
|
||||
if (store.containsKey(world.getName() + "," + cx + "," + cz + "," + y)) {
|
||||
File cxDir = new File(dataDir, "" + cx);
|
||||
if(!cxDir.exists()) cxDir.mkdir();
|
||||
if (!cxDir.exists()) cxDir.mkdir();
|
||||
File czDir = new File(cxDir, "" + cz);
|
||||
if(!czDir.exists()) czDir.mkdir();
|
||||
if (!czDir.exists()) czDir.mkdir();
|
||||
File yFile = new File(czDir, "" + y);
|
||||
|
||||
ChunkletStore out = store.get(world.getName() + "," + cx + "," + cz + "," + y);
|
||||
@ -107,16 +107,16 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
public void saveWorld(World world) {
|
||||
String worldName = world.getName();
|
||||
File dataDir = new File(world.getWorldFolder(), "mcmmo_data");
|
||||
if(!dataDir.exists())
|
||||
if (!dataDir.exists())
|
||||
dataDir.mkdirs();
|
||||
|
||||
for(String key : store.keySet()) {
|
||||
String[] info = key.split(",");
|
||||
if(worldName.equals(info[0])) {
|
||||
if (worldName.equals(info[0])) {
|
||||
File cxDir = new File(dataDir, "" + info[1]);
|
||||
if(!cxDir.exists()) cxDir.mkdir();
|
||||
if (!cxDir.exists()) cxDir.mkdir();
|
||||
File czDir = new File(cxDir, "" + info[2]);
|
||||
if(!czDir.exists()) czDir.mkdir();
|
||||
if (!czDir.exists()) czDir.mkdir();
|
||||
|
||||
File yFile = new File(czDir, "" + info[3]);
|
||||
serializeChunkletStore(store.get(key), yFile);
|
||||
@ -132,7 +132,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
|
||||
for(String key : store.keySet()) {
|
||||
String tempWorldName = key.split(",")[0];
|
||||
if(tempWorldName.equals(worldName)) {
|
||||
if (tempWorldName.equals(worldName)) {
|
||||
store.remove(key);
|
||||
return;
|
||||
}
|
||||
@ -254,21 +254,21 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
@Override
|
||||
public void cleanUp() {
|
||||
for(String key : store.keySet()) {
|
||||
if(store.get(key).isEmpty()) {
|
||||
if (store.get(key).isEmpty()) {
|
||||
String[] info = key.split(",");
|
||||
File dataDir = new File(Bukkit.getWorld(info[0]).getWorldFolder(), "mcmmo_data");
|
||||
|
||||
File cxDir = new File(dataDir, "" + info[1]);
|
||||
if(!cxDir.exists()) continue;
|
||||
if (!cxDir.exists()) continue;
|
||||
File czDir = new File(cxDir, "" + info[2]);
|
||||
if(!czDir.exists()) continue;
|
||||
if (!czDir.exists()) continue;
|
||||
|
||||
File yFile = new File(czDir, "" + info[3]);
|
||||
yFile.delete();
|
||||
|
||||
//Delete empty directories
|
||||
if(czDir.list().length == 0) czDir.delete();
|
||||
if(cxDir.list().length == 0) cxDir.delete();
|
||||
if (czDir.list().length == 0) czDir.delete();
|
||||
if (cxDir.list().length == 0) cxDir.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -282,7 +282,7 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
ObjectOutputStream objOut = null;
|
||||
|
||||
try {
|
||||
if(!location.exists())
|
||||
if (!location.exists())
|
||||
location.createNewFile();
|
||||
fileOut = new FileOutputStream(location);
|
||||
objOut = new ObjectOutputStream(fileOut);
|
||||
@ -374,9 +374,9 @@ public class HashChunkletManager implements ChunkletManager {
|
||||
// IMPORTANT! If ChunkletStoreFactory is going to be returning something other than PrimitiveEx we need to remove this, as it will be breaking time for old maps
|
||||
|
||||
/*
|
||||
if(!(storeIn instanceof PrimitiveExChunkletStore)) {
|
||||
if (!(storeIn instanceof PrimitiveExChunkletStore)) {
|
||||
ChunkletStore tempStore = ChunkletStoreFactory.getChunkletStore();
|
||||
if(storeIn != null) {
|
||||
if (storeIn != null) {
|
||||
tempStore.copyFrom(storeIn);
|
||||
}
|
||||
storeIn = tempStore;
|
||||
|
@ -26,7 +26,7 @@ public class PrimitiveChunkletStore implements ChunkletStore {
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
for(int y = 0; y < 64; y++) {
|
||||
if(store[x][z][y]) return false;
|
||||
if (store[x][z][y]) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
for(int y = 0; y < 64; y++) {
|
||||
if(store[x][z][y]) return false;
|
||||
if (store[x][z][y]) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -57,7 +57,7 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
for(int y = 0; y < 64; y++) {
|
||||
if(store[x][z][y]) {
|
||||
if (store[x][z][y]) {
|
||||
byte[] temp = constructColumn(x, z);
|
||||
|
||||
for(int i = 0; i < 9; i++) {
|
||||
@ -81,7 +81,7 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
|
||||
byte[] temp = new byte[9];
|
||||
|
||||
// Could probably reorganize this loop to print nasty things if it does not equal 9 or -1
|
||||
while(in.read(temp, 0, 9) == 9) {
|
||||
while (in.read(temp, 0, 9) == 9) {
|
||||
int x = addressByteX(temp[0]);
|
||||
int z = addressByteZ(temp[0]);
|
||||
boolean[] yColumn = new boolean[64];
|
||||
@ -127,13 +127,13 @@ public class PrimitiveExChunkletStore implements ChunkletStore, Externalizable {
|
||||
|
||||
column[0] = makeAddressByte(x, z);
|
||||
|
||||
for (int i = 0; i < 8; i++){
|
||||
for (int i = 0; i < 8; i++) {
|
||||
byte yCompressed = 0x0;
|
||||
int subColumnIndex = 8 * i;
|
||||
int subColumnEnd = subColumnIndex + 8;
|
||||
|
||||
for(int y = subColumnIndex; y < subColumnEnd; y++) {
|
||||
if(store[x][z][y]) {
|
||||
if (store[x][z][y]) {
|
||||
yCompressed |= 1 << (y % 8);
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ public class ChunkManagerFactory {
|
||||
public static ChunkManager getChunkManager() {
|
||||
HiddenConfig hConfig = HiddenConfig.getInstance();
|
||||
|
||||
if(hConfig.getChunkletsEnabled()) {
|
||||
if (hConfig.getChunkletsEnabled()) {
|
||||
return new HashChunkManager();
|
||||
}
|
||||
|
||||
|
@ -143,19 +143,19 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void loadChunk(int cx, int cz, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
if(store.containsKey(world.getName() + "," + cx + "," + cz))
|
||||
if (store.containsKey(world.getName() + "," + cx + "," + cz))
|
||||
return;
|
||||
|
||||
ChunkStore in = null;
|
||||
|
||||
UUID key = world.getUID();
|
||||
if(!this.oldData.containsKey(key))
|
||||
if (!this.oldData.containsKey(key))
|
||||
this.oldData.put(key, (new File(world.getWorldFolder(), "mcmmo_data")).exists());
|
||||
|
||||
if(this.oldData.containsKey(key) && oldData.get(key))
|
||||
if (this.oldData.containsKey(key) && oldData.get(key))
|
||||
convertChunk(new File(world.getWorldFolder(), "mcmmo_data"), cx, cz, world, true);
|
||||
|
||||
try {
|
||||
@ -163,20 +163,20 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
catch(Exception e) {}
|
||||
|
||||
if(in != null) {
|
||||
if (in != null) {
|
||||
store.put(world.getName() + "," + cx + "," + cz, in);
|
||||
|
||||
List<UUID> mobs = in.getSpawnedMobs();
|
||||
List<UUID> pets = in.getSpawnedPets();
|
||||
|
||||
if(mobs.isEmpty() && pets.isEmpty())
|
||||
if (mobs.isEmpty() && pets.isEmpty())
|
||||
return;
|
||||
|
||||
for(LivingEntity entity : world.getLivingEntities()) {
|
||||
if(mobs.contains(entity.getUniqueId()))
|
||||
if (mobs.contains(entity.getUniqueId()))
|
||||
addSpawnedMob(entity);
|
||||
|
||||
if(pets.contains(entity.getUniqueId()))
|
||||
if (pets.contains(entity.getUniqueId()))
|
||||
addSpawnedPet(entity);
|
||||
}
|
||||
|
||||
@ -189,24 +189,24 @@ public class HashChunkManager implements ChunkManager {
|
||||
public synchronized void unloadChunk(int cx, int cz, World world) {
|
||||
saveChunk(cx, cz, world);
|
||||
|
||||
if(store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
if (store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
store.remove(world.getName() + "," + cx + "," + cz);
|
||||
|
||||
for(Entity entity : spawnedMobs) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
mobsToRemove.add(entity);
|
||||
}
|
||||
|
||||
for(Entity entity : spawnedPets) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
mobsToRemove.add(entity);
|
||||
}
|
||||
|
||||
if(safeToRemoveMobs) {
|
||||
if (safeToRemoveMobs) {
|
||||
spawnedMobs.remove(mobsToRemove);
|
||||
spawnedPets.remove(mobsToRemove);
|
||||
mobsToRemove.clear();
|
||||
@ -216,14 +216,14 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void saveChunk(int cx, int cz, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
boolean unloaded = false;
|
||||
if(!store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
if (!store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs);
|
||||
for(Entity entity : tempSpawnedMobs) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
loadChunk(cx, cz, world);
|
||||
@ -231,10 +231,10 @@ public class HashChunkManager implements ChunkManager {
|
||||
break;
|
||||
}
|
||||
|
||||
if(!unloaded) {
|
||||
if (!unloaded) {
|
||||
List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets);
|
||||
for(Entity entity : tempSpawnedPets) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
loadChunk(cx, cz, world);
|
||||
@ -244,17 +244,17 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
}
|
||||
|
||||
if(!store.containsKey(world.getName() + "," + cx + "," + cz) && unloaded) {
|
||||
if (!store.containsKey(world.getName() + "," + cx + "," + cz) && unloaded) {
|
||||
ChunkStore cStore = ChunkStoreFactory.getChunkStore(world, cx, cz);
|
||||
store.put(world.getName() + "," + cx + "," + cz, cStore);
|
||||
}
|
||||
|
||||
if(store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
if (store.containsKey(world.getName() + "," + cx + "," + cz)) {
|
||||
ChunkStore out = store.get(world.getName() + "," + cx + "," + cz);
|
||||
|
||||
List<Entity> tempSpawnedMobs = new ArrayList<Entity>(spawnedMobs);
|
||||
for(Entity entity : tempSpawnedMobs) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
out.addSpawnedMob(entity.getUniqueId());
|
||||
@ -262,13 +262,13 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
List<Entity> tempSpawnedPets = new ArrayList<Entity>(spawnedPets);
|
||||
for(Entity entity : tempSpawnedPets) {
|
||||
if(!isEntityInChunk(entity, cx, cz, world))
|
||||
if (!isEntityInChunk(entity, cx, cz, world))
|
||||
continue;
|
||||
|
||||
out.addSpawnedPet(entity.getUniqueId());
|
||||
}
|
||||
|
||||
if(!out.isDirty())
|
||||
if (!out.isDirty())
|
||||
return;
|
||||
|
||||
writeChunkStore(world, cx, cz, out);
|
||||
@ -276,16 +276,16 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
private boolean isEntityInChunk(Entity entity, int cx, int cz, World world) {
|
||||
if(entity == null || world == null)
|
||||
if (entity == null || world == null)
|
||||
return false;
|
||||
|
||||
if(entity.getLocation().getChunk().getX() != cx)
|
||||
if (entity.getLocation().getChunk().getX() != cx)
|
||||
return false;
|
||||
|
||||
if(entity.getLocation().getChunk().getZ() != cz)
|
||||
if (entity.getLocation().getChunk().getZ() != cz)
|
||||
return false;
|
||||
|
||||
if(entity.getWorld() != world)
|
||||
if (entity.getWorld() != world)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -293,7 +293,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized boolean isChunkLoaded(int cx, int cz, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return false;
|
||||
|
||||
return store.containsKey(world.getName() + "," + cx + "," + cz);
|
||||
@ -304,7 +304,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void chunkUnloaded(int cx, int cz, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
ChunkletUnloader.addToList(cx, cz, world);
|
||||
@ -312,7 +312,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void saveWorld(World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
closeAll();
|
||||
@ -321,7 +321,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
List<String> keys = new ArrayList<String>(store.keySet());
|
||||
for(String key : keys) {
|
||||
String[] info = key.split(",");
|
||||
if(worldName.equals(info[0])) {
|
||||
if (worldName.equals(info[0])) {
|
||||
int cx = 0;
|
||||
int cz = 0;
|
||||
|
||||
@ -340,7 +340,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
for(Entity entity : tempSpawnedMobs) {
|
||||
World entityWorld = entity.getWorld();
|
||||
|
||||
if(world != entityWorld)
|
||||
if (world != entityWorld)
|
||||
continue;
|
||||
|
||||
int cx = entity.getLocation().getChunk().getX();
|
||||
@ -353,7 +353,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
for(Entity entity : tempSpawnedPets) {
|
||||
World entityWorld = entity.getWorld();
|
||||
|
||||
if(world != entityWorld)
|
||||
if (world != entityWorld)
|
||||
continue;
|
||||
|
||||
int cx = entity.getLocation().getChunk().getX();
|
||||
@ -365,7 +365,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void unloadWorld(World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
closeAll();
|
||||
@ -374,7 +374,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
List<String> keys = new ArrayList<String>(store.keySet());
|
||||
for(String key : keys) {
|
||||
String[] info = key.split(",");
|
||||
if(worldName.equals(info[0])) {
|
||||
if (worldName.equals(info[0])) {
|
||||
int cx = 0;
|
||||
int cz = 0;
|
||||
|
||||
@ -395,7 +395,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
for(Entity entity : tempSpawnedMobs) {
|
||||
World entityWorld = entity.getWorld();
|
||||
|
||||
if(world != entityWorld)
|
||||
if (world != entityWorld)
|
||||
continue;
|
||||
|
||||
int cx = entity.getLocation().getChunk().getX();
|
||||
@ -408,7 +408,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
for(Entity entity : tempSpawnedPets) {
|
||||
World entityWorld = entity.getWorld();
|
||||
|
||||
if(world != entityWorld)
|
||||
if (world != entityWorld)
|
||||
continue;
|
||||
|
||||
int cx = entity.getLocation().getChunk().getX();
|
||||
@ -447,7 +447,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized boolean isTrue(int x, int y, int z, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return false;
|
||||
|
||||
int cx = x / 16;
|
||||
@ -471,7 +471,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized boolean isTrue(Block block) {
|
||||
if(block == null)
|
||||
if (block == null)
|
||||
return false;
|
||||
|
||||
return isTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
@ -479,7 +479,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void setTrue(int x, int y, int z, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
int cx = x / 16;
|
||||
@ -506,7 +506,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void setTrue(Block block) {
|
||||
if(block == null)
|
||||
if (block == null)
|
||||
return;
|
||||
|
||||
setTrue(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
@ -514,7 +514,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void setFalse(int x, int y, int z, World world) {
|
||||
if(world == null)
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
int cx = x / 16;
|
||||
@ -540,7 +540,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
|
||||
@Override
|
||||
public synchronized void setFalse(Block block) {
|
||||
if(block == null)
|
||||
if (block == null)
|
||||
return;
|
||||
|
||||
setFalse(block.getX(), block.getY(), block.getZ(), block.getWorld());
|
||||
@ -554,21 +554,21 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
public synchronized void convertChunk(File dataDir, int cx, int cz, World world, boolean actually) {
|
||||
if(!actually)
|
||||
if (!actually)
|
||||
return;
|
||||
if(!dataDir.exists()) return;
|
||||
if (!dataDir.exists()) return;
|
||||
File cxDir = new File(dataDir, "" + cx);
|
||||
if(!cxDir.exists()) return;
|
||||
if (!cxDir.exists()) return;
|
||||
File czDir = new File(cxDir, "" + cz);
|
||||
if(!czDir.exists()) return;
|
||||
if (!czDir.exists()) return;
|
||||
|
||||
boolean conversionSet = false;
|
||||
|
||||
for(BlockStoreConversionZDirectory converter : this.converters) {
|
||||
if(converter == null)
|
||||
if (converter == null)
|
||||
continue;
|
||||
|
||||
if(converter.taskID >= 0)
|
||||
if (converter.taskID >= 0)
|
||||
continue;
|
||||
|
||||
converter.start(world, cxDir, czDir);
|
||||
@ -576,7 +576,7 @@ public class HashChunkManager implements ChunkManager {
|
||||
break;
|
||||
}
|
||||
|
||||
if(!conversionSet) {
|
||||
if (!conversionSet) {
|
||||
BlockStoreConversionZDirectory converter = new BlockStoreConversionZDirectory();
|
||||
converter.start(world, cxDir, czDir);
|
||||
converters.add(converter);
|
||||
@ -592,22 +592,22 @@ public class HashChunkManager implements ChunkManager {
|
||||
}
|
||||
|
||||
public void addSpawnedMob(Entity entity) {
|
||||
if(!isSpawnedMob(entity))
|
||||
if (!isSpawnedMob(entity))
|
||||
spawnedMobs.add(entity);
|
||||
}
|
||||
|
||||
public void addSpawnedPet(Entity entity) {
|
||||
if(!isSpawnedPet(entity))
|
||||
if (!isSpawnedPet(entity))
|
||||
spawnedPets.add(entity);
|
||||
}
|
||||
|
||||
public void removeSpawnedMob(Entity entity) {
|
||||
if(isSpawnedMob(entity))
|
||||
if (isSpawnedMob(entity))
|
||||
spawnedMobs.remove(entity);
|
||||
}
|
||||
|
||||
public void removeSpawnedPet(Entity entity) {
|
||||
if(isSpawnedPet(entity))
|
||||
if (isSpawnedPet(entity))
|
||||
spawnedPets.remove(entity);
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
for(int y = 0; y < this.worldHeight; y++) {
|
||||
if(store[x][z][y]) return false;
|
||||
if (store[x][z][y]) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -113,42 +113,42 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
}
|
||||
|
||||
public void addSpawnedMob(UUID id) {
|
||||
if(!isSpawnedMob(id)) {
|
||||
if (!isSpawnedMob(id)) {
|
||||
spawnedMobs.add(id);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void addSpawnedPet(UUID id) {
|
||||
if(!isSpawnedPet(id)) {
|
||||
if (!isSpawnedPet(id)) {
|
||||
spawnedPets.add(id);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeSpawnedMob(UUID id) {
|
||||
if(isSpawnedMob(id)) {
|
||||
if (isSpawnedMob(id)) {
|
||||
spawnedMobs.remove(id);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeSpawnedPet(UUID id) {
|
||||
if(isSpawnedPet(id)) {
|
||||
if (isSpawnedPet(id)) {
|
||||
spawnedPets.remove(id);
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearSpawnedMobs() {
|
||||
if(!spawnedMobs.isEmpty()) {
|
||||
if (!spawnedMobs.isEmpty()) {
|
||||
spawnedMobs.clear();
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearSpawnedPets() {
|
||||
if(!spawnedPets.isEmpty()) {
|
||||
if (!spawnedPets.isEmpty()) {
|
||||
spawnedPets.clear();
|
||||
dirty = true;
|
||||
}
|
||||
@ -204,16 +204,16 @@ public class PrimitiveChunkStore implements ChunkStore {
|
||||
store = (boolean[][][]) in.readObject();
|
||||
|
||||
if (fileVersionNumber < CURRENT_VERSION) {
|
||||
if(fileVersionNumber < 5)
|
||||
if (fileVersionNumber < 5)
|
||||
fixArray();
|
||||
if(fileVersionNumber < 6) {
|
||||
if (fileVersionNumber < 6) {
|
||||
spawnedMobs = new ArrayList<UUID>();
|
||||
spawnedPets = new ArrayList<UUID>();
|
||||
}
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
if(fileVersionNumber >= 6) {
|
||||
if (fileVersionNumber >= 6) {
|
||||
//What do we want to do about this? These casts are unchecked.
|
||||
spawnedMobs = (ArrayList<UUID>) in.readObject();
|
||||
spawnedPets = (ArrayList<UUID>) in.readObject();
|
||||
|
Loading…
Reference in New Issue
Block a user