mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 19:54:44 +02:00
Because we don't need that many Random objects.
This commit is contained in:
@ -1,12 +1,9 @@
|
||||
package com.gmail.nossr50.skills.mining;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
|
||||
public class BlastMining {
|
||||
private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
private static Random random = new Random();
|
||||
|
||||
public final static int BLAST_MINING_RANK_1 = advancedConfig.getBlastMiningRank1();
|
||||
public final static int BLAST_MINING_RANK_2 = advancedConfig.getBlastMiningRank2();
|
||||
@ -18,8 +15,4 @@ public class BlastMining {
|
||||
public final static int BLAST_MINING_RANK_8 = advancedConfig.getBlastMiningRank8();
|
||||
|
||||
public final static int MAXIMUM_REMOTE_DETONATION_DISTANCE = 100;
|
||||
|
||||
protected static Random getRandom() {
|
||||
return random;
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class BlastMiningDropEventHandler {
|
||||
Location location = block.getLocation();
|
||||
Material type = block.getType();
|
||||
|
||||
if (BlastMining.getRandom().nextFloat() < (yield + oreBonus)) {
|
||||
if (Misc.getRandom().nextFloat() < (yield + oreBonus)) {
|
||||
droppedOres.add(block);
|
||||
Mining.miningDrops(block, location, type);
|
||||
|
||||
@ -82,7 +82,7 @@ public class BlastMiningDropEventHandler {
|
||||
Location location = block.getLocation();
|
||||
Material type = block.getType();
|
||||
|
||||
if (BlastMining.getRandom().nextFloat() < debrisYield) {
|
||||
if (Misc.getRandom().nextFloat() < debrisYield) {
|
||||
Misc.dropItem(location, new ItemStack(type));
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.gmail.nossr50.skills.mining;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.CoalType;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
@ -23,7 +21,6 @@ import com.gmail.nossr50.util.Skills;
|
||||
public class Mining {
|
||||
private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
private static Config config = Config.getInstance();
|
||||
private static Random random = new Random();
|
||||
|
||||
public static final int DOUBLE_DROPS_MAX_BONUS_LEVEL = advancedConfig.getMiningDoubleDropMaxLevel();
|
||||
public static final int DOUBLE_DROPS_MAX_CHANCE = advancedConfig.getMiningDoubleDropChance();
|
||||
@ -315,8 +312,4 @@ public class Mining {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected static Random getRandom() {
|
||||
return random;
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public class MiningManager {
|
||||
|
||||
float chance = ((float) Mining.DOUBLE_DROPS_MAX_CHANCE / Mining.DOUBLE_DROPS_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
|
||||
|
||||
if (chance > Mining.getRandom().nextInt(randomChance)) {
|
||||
if (chance > Misc.getRandom().nextInt(randomChance)) {
|
||||
eventHandler.processDrops();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user