mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-30 04:34:43 +02:00
Because we don't need that many Random objects.
This commit is contained in:
@ -3,7 +3,6 @@ package com.gmail.nossr50.skills.archery;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -14,7 +13,6 @@ import com.gmail.nossr50.util.Misc;
|
||||
|
||||
public class Archery {
|
||||
private static AdvancedConfig advancedConfig = AdvancedConfig.getInstance();
|
||||
private static Random random = new Random();
|
||||
private static List<TrackedEntity> trackedEntities = new ArrayList<TrackedEntity>();
|
||||
|
||||
public static final int ARROW_TRACKING_MAX_BONUS_LEVEL = advancedConfig.getRetrieveMaxBonusLevel();
|
||||
@ -66,8 +64,4 @@ public class Archery {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static Random getRandom() {
|
||||
return random;
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class ArcheryManager {
|
||||
|
||||
float chance = ((float) Archery.ARROW_TRACKING_MAX_BONUS / Archery.ARROW_TRACKING_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
|
||||
|
||||
if (chance > Archery.getRandom().nextInt(randomChance)) {
|
||||
if (chance > Misc.getRandom().nextInt(randomChance)) {
|
||||
eventHandler.addToTracker();
|
||||
}
|
||||
}
|
||||
@ -65,7 +65,7 @@ public class ArcheryManager {
|
||||
|
||||
float chance = ((float) Archery.DAZE_MAX_BONUS / Archery.DAZE_MAX_BONUS_LEVEL) * eventHandler.skillModifier;
|
||||
|
||||
if (chance > Archery.getRandom().nextInt(randomChance)) {
|
||||
if (chance > Misc.getRandom().nextInt(randomChance)) {
|
||||
eventHandler.handleDazeEffect();
|
||||
eventHandler.sendAbilityMessages();
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class DazeEventHandler {
|
||||
protected void handleDazeEffect() {
|
||||
Location location = defender.getLocation();
|
||||
|
||||
if (Archery.getRandom().nextInt(100) > DAZE_CHANCE) {
|
||||
if (Misc.getRandom().nextInt(100) > DAZE_CHANCE) {
|
||||
location.setPitch(90);
|
||||
}
|
||||
else {
|
||||
|
Reference in New Issue
Block a user