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:
@ -72,7 +72,7 @@ public class CallOfTheWildEventHandler {
|
||||
((Tameable) entity).setOwner(player);
|
||||
|
||||
if (type == EntityType.OCELOT) {
|
||||
((Ocelot) entity).setCatType(Ocelot.Type.getType(1 + Taming.getRandom().nextInt(3)));
|
||||
((Ocelot) entity).setCatType(Ocelot.Type.getType(1 + Misc.getRandom().nextInt(3)));
|
||||
}
|
||||
else {
|
||||
entity.setHealth(entity.getMaxHealth());
|
||||
|
@ -1,7 +1,5 @@
|
||||
package com.gmail.nossr50.skills.taming;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
|
||||
public class Taming {
|
||||
@ -25,10 +23,4 @@ public class Taming {
|
||||
|
||||
public static final int THICK_FUR_ACTIVATION_LEVEL = advancedConfig.getThickFurUnlock();
|
||||
public static final int THICK_FUR_MODIFIER = advancedConfig.getThickFurModifier();
|
||||
|
||||
private static Random random = new Random();
|
||||
|
||||
public static Random getRandom() {
|
||||
return random;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
@ -48,7 +49,7 @@ public class TamingManager {
|
||||
randomChance = (int) (randomChance * 0.75);
|
||||
}
|
||||
|
||||
if (Taming.getRandom().nextInt(randomChance) < Taming.FAST_FOOD_SERVICE_ACTIVATION_CHANCE) {
|
||||
if (Misc.getRandom().nextInt(randomChance) < Taming.FAST_FOOD_SERVICE_ACTIVATION_CHANCE) {
|
||||
FastFoodServiceEventHandler eventHandler = new FastFoodServiceEventHandler(wolf);
|
||||
|
||||
eventHandler.modifyHealth(damage);
|
||||
@ -100,7 +101,7 @@ public class TamingManager {
|
||||
float chance = (float) (((double) Taming.GORE_CHANCE_MAX / (double) Taming.GORE_MAX_BONUS_LEVEL) * skillLevel);
|
||||
if (chance > Taming.GORE_CHANCE_MAX) chance = Taming.GORE_CHANCE_MAX;
|
||||
|
||||
if (chance > Taming.getRandom().nextInt(randomChance)) {
|
||||
if (chance > Misc.getRandom().nextInt(randomChance)) {
|
||||
eventHandler.modifyEventDamage();
|
||||
eventHandler.applyBleed();
|
||||
eventHandler.sendAbilityMessage();
|
||||
|
Reference in New Issue
Block a user