mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-02 04:25:26 +02:00
Update code style
This commit is contained in:
@@ -46,13 +46,11 @@ public class BlastMining {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static double getBlastDamageDecrease(int rank) {
|
||||
return AdvancedConfig.getInstance().getBlastDamageDecrease(rank);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static int getDemolitionExpertUnlockLevel() {
|
||||
/*List<Tier> tierList = Arrays.asList(Tier.values());
|
||||
for (Tier tier : tierList) {
|
||||
@@ -63,10 +61,9 @@ public class BlastMining {
|
||||
return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel();
|
||||
}*/
|
||||
|
||||
for(int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks()-1; i++)
|
||||
{
|
||||
if(getBlastDamageDecrease(i+1) > 0)
|
||||
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i+1);
|
||||
for (int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks() - 1; i++) {
|
||||
if (getBlastDamageDecrease(i + 1) > 0)
|
||||
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i + 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -82,10 +79,9 @@ public class BlastMining {
|
||||
return tier == Tier.EIGHT ? tier.getLevel() : tierList.get(tierList.indexOf(tier) - 1).getLevel();
|
||||
}*/
|
||||
|
||||
for(int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks()-1; i++)
|
||||
{
|
||||
if(getBlastRadiusModifier(i+1) > 0)
|
||||
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i+1);
|
||||
for (int i = 0; i < SubSkillType.MINING_BLAST_MINING.getNumRanks() - 1; i++) {
|
||||
if (getBlastRadiusModifier(i + 1) > 0)
|
||||
return RankUtils.getRankUnlockLevel(SubSkillType.MINING_BLAST_MINING, i + 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -103,12 +99,11 @@ public class BlastMining {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(UserManager.getPlayer(defender) == null)
|
||||
{
|
||||
if (UserManager.getPlayer(defender) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MiningManager miningManager = UserManager.getPlayer(defender).getMiningManager();
|
||||
MiningManager miningManager = UserManager.getPlayer(defender).getMiningManager();
|
||||
|
||||
if (!miningManager.canUseDemolitionsExpertise()) {
|
||||
return false;
|
||||
|
@@ -13,37 +13,19 @@ import java.util.List;
|
||||
|
||||
public class Mining {
|
||||
|
||||
private List<Material> detonators;
|
||||
private static Mining instance;
|
||||
|
||||
public static Mining getInstance() {
|
||||
if(instance == null)
|
||||
instance = new Mining();
|
||||
|
||||
return instance;
|
||||
}
|
||||
private List<Material> detonators;
|
||||
|
||||
public Mining() {
|
||||
//Init detonators
|
||||
this.detonators = ItemUtils.matchMaterials(mcMMO.getConfigManager().getConfigMining().getDetonators());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a list of Blast Mining detonator types
|
||||
* @return blast mining detonator materials
|
||||
*/
|
||||
public List<Material> getDetonators() {
|
||||
return detonators;
|
||||
}
|
||||
public static Mining getInstance() {
|
||||
if (instance == null)
|
||||
instance = new Mining();
|
||||
|
||||
/**
|
||||
* Check if an itemStack is a valid blast mining detonator
|
||||
* @param itemStack target itemstack
|
||||
* @return true if valid blast mining detonator
|
||||
*/
|
||||
public Boolean isDetonator(ItemStack itemStack)
|
||||
{
|
||||
return getDetonators().contains(itemStack.getType());
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,4 +183,23 @@ public class Mining {
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a list of Blast Mining detonator types
|
||||
*
|
||||
* @return blast mining detonator materials
|
||||
*/
|
||||
public List<Material> getDetonators() {
|
||||
return detonators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an itemStack is a valid blast mining detonator
|
||||
*
|
||||
* @param itemStack target itemstack
|
||||
* @return true if valid blast mining detonator
|
||||
*/
|
||||
public Boolean isDetonator(ItemStack itemStack) {
|
||||
return getDetonators().contains(itemStack.getType());
|
||||
}
|
||||
}
|
||||
|
@@ -35,8 +35,20 @@ public class MiningManager extends SkillManager {
|
||||
super(mcMMOPlayer, PrimarySkillType.MINING);
|
||||
}
|
||||
|
||||
public static double getOreBonus(int rank) {
|
||||
return AdvancedConfig.getInstance().getOreBonus(rank);
|
||||
}
|
||||
|
||||
public static double getDebrisReduction(int rank) {
|
||||
return AdvancedConfig.getInstance().getDebrisReduction(rank);
|
||||
}
|
||||
|
||||
public static int getDropMultiplier(int rank) {
|
||||
return AdvancedConfig.getInstance().getDropMultiplier(rank);
|
||||
}
|
||||
|
||||
public boolean canUseDemolitionsExpertise() {
|
||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_DEMOLITIONS_EXPERTISE))
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_DEMOLITIONS_EXPERTISE))
|
||||
return false;
|
||||
|
||||
return getSkillLevel() >= BlastMining.getDemolitionExpertUnlockLevel() && Permissions.demolitionsExpertise(getPlayer());
|
||||
@@ -56,7 +68,7 @@ public class MiningManager extends SkillManager {
|
||||
}
|
||||
|
||||
public boolean canUseBiggerBombs() {
|
||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_BIGGER_BOMBS))
|
||||
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.MINING_BIGGER_BOMBS))
|
||||
return false;
|
||||
|
||||
return getSkillLevel() >= BlastMining.getBiggerBombsUnlockLevel() && Permissions.biggerBombs(getPlayer());
|
||||
@@ -83,13 +95,13 @@ public class MiningManager extends SkillManager {
|
||||
}
|
||||
|
||||
//if ((mcMMO.getModManager().isCustomMiningBlock(blockState) && !mcMMO.getModManager().getBlock(blockState).isDoubleDropEnabled()) || !MainConfig.getInstance().getDoubleDropsEnabled(skill, material)) {
|
||||
if(!MainConfig.getInstance().getDoubleDropsEnabled(skill, material)) {
|
||||
if (!MainConfig.getInstance().getDoubleDropsEnabled(skill, material)) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean silkTouch = player.getInventory().getItemInMainHand().containsEnchantment(Enchantment.SILK_TOUCH);
|
||||
|
||||
if(silkTouch && !AdvancedConfig.getInstance().getDoubleDropSilkTouchEnabled())
|
||||
if (silkTouch && !AdvancedConfig.getInstance().getDoubleDropSilkTouchEnabled())
|
||||
return;
|
||||
|
||||
//TODO: Make this readable
|
||||
@@ -128,7 +140,7 @@ public class MiningManager extends SkillManager {
|
||||
/**
|
||||
* Handler for explosion drops and XP gain.
|
||||
*
|
||||
* @param yield The % of blocks to drop
|
||||
* @param yield The % of blocks to drop
|
||||
* @param blockList The list of blocks to drop
|
||||
*/
|
||||
public void blastMiningDropProcessing(float yield, List<Block> blockList) {
|
||||
@@ -147,8 +159,7 @@ public class MiningManager extends SkillManager {
|
||||
|
||||
if (BlockUtils.isOre(blockState)) {
|
||||
ores.add(blockState);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
debris.add(blockState);
|
||||
}
|
||||
}
|
||||
@@ -212,14 +223,6 @@ public class MiningManager extends SkillManager {
|
||||
return getOreBonus(getBlastMiningTier());
|
||||
}
|
||||
|
||||
public static double getOreBonus(int rank) {
|
||||
return AdvancedConfig.getInstance().getOreBonus(rank);
|
||||
}
|
||||
|
||||
public static double getDebrisReduction(int rank) {
|
||||
return AdvancedConfig.getInstance().getDebrisReduction(rank);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Blast Mining tier
|
||||
*
|
||||
@@ -229,10 +232,6 @@ public class MiningManager extends SkillManager {
|
||||
return getDebrisReduction(getBlastMiningTier());
|
||||
}
|
||||
|
||||
public static int getDropMultiplier(int rank) {
|
||||
return AdvancedConfig.getInstance().getDropMultiplier(rank);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Blast Mining tier
|
||||
*
|
||||
|
Reference in New Issue
Block a user