mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-14 04:47:51 +00:00
Improve ComboManager Efficiency
This commit is contained in:
parent
7680a468d3
commit
2e5312fb1f
1 changed files with 34 additions and 28 deletions
|
@ -123,11 +123,16 @@ public class ComboManager {
|
|||
descriptions.put("IceWave", "PhaseChange your WaterWave into an IceWave that freezes and damages enemies.");
|
||||
instructions.put("IceWave", "Create a WaterSpout Wave > PhaseChange (Left Click)");
|
||||
|
||||
/*ArrayList<AbilityInformation> icePillar = new ArrayList<AbilityInformation>();
|
||||
icePillar.add(new AbilityInformation("IceSpike", ClickType.LEFT_CLICK));
|
||||
icePillar.add(new AbilityInformation("IceSpike", ClickType.LEFT_CLICK));
|
||||
icePillar.add(new AbilityInformation("WaterSpout", ClickType.LEFT_CLICK));
|
||||
comboAbilityList.add(new ComboAbility("IcePillar", icePillar, WaterCombo.class));*/
|
||||
/*
|
||||
* ArrayList<AbilityInformation> icePillar = new
|
||||
* ArrayList<AbilityInformation>(); icePillar.add(new
|
||||
* AbilityInformation("IceSpike", ClickType.LEFT_CLICK));
|
||||
* icePillar.add(new AbilityInformation("IceSpike",
|
||||
* ClickType.LEFT_CLICK)); icePillar.add(new
|
||||
* AbilityInformation("WaterSpout", ClickType.LEFT_CLICK));
|
||||
* comboAbilityList.add(new ComboAbility("IcePillar", icePillar,
|
||||
* WaterCombo.class));
|
||||
*/
|
||||
|
||||
ArrayList<AbilityInformation> iceBullet = new ArrayList<AbilityInformation>();
|
||||
iceBullet.add(new AbilityInformation("WaterBubble", ClickType.SHIFT_DOWN));
|
||||
|
@ -219,18 +224,18 @@ public class ComboManager {
|
|||
Enumeration<String> keys = recentlyUsedAbilities.keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
String name = keys.nextElement();
|
||||
ArrayList<AbilityInformation> combos = recentlyUsedAbilities.get(name);
|
||||
ArrayList<AbilityInformation> usedAbilities = recentlyUsedAbilities.get(name);
|
||||
ArrayList<AbilityInformation> stillValidAbilities = new ArrayList<AbilityInformation>();
|
||||
recentlyUsedAbilities.remove(name);
|
||||
for (int i = 0; i < combos.size(); i++) {
|
||||
AbilityInformation info = combos.get(i);
|
||||
if (System.currentTimeMillis() - info.getTime() > CLEANUP_DELAY) {
|
||||
combos.remove(i);
|
||||
i--;
|
||||
|
||||
for (AbilityInformation info : usedAbilities) {
|
||||
if (System.currentTimeMillis() - info.getTime() <= CLEANUP_DELAY) {
|
||||
stillValidAbilities.add(info);
|
||||
}
|
||||
}
|
||||
|
||||
if (combos.size() > 0)
|
||||
recentlyUsedAbilities.put(name, combos);
|
||||
if (stillValidAbilities.size() > 0)
|
||||
recentlyUsedAbilities.put(name, stillValidAbilities);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,7 +257,8 @@ public class ComboManager {
|
|||
public static ArrayList<String> getCombosForElement(Element element) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
for (ComboAbility comboab : comboAbilityList) {
|
||||
if (GeneralMethods.getComboElement(comboab.getName()) == element && descriptions.containsKey(comboab.getName())) list.add(comboab.getName());
|
||||
if (GeneralMethods.getComboElement(comboab.getName()) == element && descriptions.containsKey(comboab.getName()))
|
||||
list.add(comboab.getName());
|
||||
}
|
||||
Collections.sort(list);
|
||||
return list;
|
||||
|
@ -263,7 +269,7 @@ public class ComboManager {
|
|||
public void run() {
|
||||
cleanupOldCombos();
|
||||
}
|
||||
}.runTaskTimer(ProjectKorra.plugin, 0, CLEANUP_DELAY);
|
||||
}.runTaskTimer(ProjectKorra.plugin, 0, CLEANUP_DELAY / 1000 * 20);
|
||||
}
|
||||
|
||||
public static class AbilityInformation {
|
||||
|
|
Loading…
Reference in a new issue