forked from MagicBane/Server
Refactored out duplicate power collection.
This commit is contained in:
@@ -53,7 +53,7 @@ public enum PowersManager {
|
||||
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
|
||||
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
|
||||
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
|
||||
public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
|
||||
public static HashMap<Integer, ArrayList<MobPowerEntry>> _allMobPowers;
|
||||
private static JobScheduler js;
|
||||
|
||||
private PowersManager() {
|
||||
@@ -103,6 +103,24 @@ public enum PowersManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayList<MobPowerEntry> getPowersForMobile(Mob mobile) {
|
||||
|
||||
ArrayList<MobPowerEntry> mobPowers = new ArrayList<>();
|
||||
ArrayList<MobPowerEntry> powerEntries;
|
||||
|
||||
powerEntries = PowersManager._allMobPowers.get(mobile.loadID);
|
||||
|
||||
if (powerEntries != null)
|
||||
mobPowers.addAll(powerEntries);
|
||||
|
||||
powerEntries = PowersManager._allMobPowers.get(mobile.contractUUID);
|
||||
|
||||
if (powerEntries != null)
|
||||
mobPowers.addAll(powerEntries);
|
||||
|
||||
return mobPowers;
|
||||
}
|
||||
|
||||
// This pre-loads all powers and effects
|
||||
public static void InitializePowers() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user