Because we don't need that many Random objects.

This commit is contained in:
gmcferrin
2013-01-09 23:46:35 -05:00
parent e036b7ac70
commit c1463c3257
24 changed files with 52 additions and 118 deletions

View File

@ -308,4 +308,8 @@ public class Misc {
return Integer.MAX_VALUE;
}
public static Random getRandom() {
return random;
}
}

View File

@ -1,7 +1,5 @@
package com.gmail.nossr50.util;
import java.util.Random;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
import org.bukkit.enchantments.Enchantment;
@ -28,8 +26,6 @@ public class Skills {
static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
public static int abilityLengthIncreaseLevel = advancedConfig.getAbilityLength();
private final static Random random = new Random();
/**
* Checks to see if the cooldown for an item or ability is expired.
*
@ -387,7 +383,7 @@ public class Skills {
if (Config.getInstance().getAbilitiesDamageTools()) {
if (inHand.containsEnchantment(Enchantment.DURABILITY)) {
int level = inHand.getEnchantmentLevel(Enchantment.DURABILITY);
if (random.nextInt(level + 1) > 0) {
if (Misc.getRandom().nextInt(level + 1) > 0) {
return;
}
}