mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-20 10:02:56 -04:00
Changed cooldowns to correctly use a float
This commit is contained in:
@@ -1728,43 +1728,40 @@ public class CreatureObject extends TangibleObject implements IPersistent {
|
||||
}
|
||||
}
|
||||
|
||||
public void addCooldown(String ability, long duration) {
|
||||
if (cooldowns.containsKey(ability))
|
||||
cooldowns.remove(ability);
|
||||
public void addCooldown(String cooldownGroup, float duration) {
|
||||
if (cooldowns.containsKey(cooldownGroup)) {
|
||||
cooldowns.remove(cooldownGroup);
|
||||
}
|
||||
|
||||
Cooldown cd = new Cooldown(duration);
|
||||
cd.setRemovalTask(Executors.newScheduledThreadPool(1).schedule(new Runnable() {
|
||||
|
||||
Cooldown cooldown = new Cooldown(duration);
|
||||
|
||||
cooldown.setRemovalTask(Executors.newScheduledThreadPool(1).schedule(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
removeCooldown(ability);
|
||||
removeCooldown(cooldownGroup);
|
||||
}
|
||||
|
||||
}, duration, TimeUnit.MILLISECONDS));
|
||||
cooldowns.put(ability, cd);
|
||||
|
||||
cooldowns.put(cooldownGroup, cooldown);
|
||||
}
|
||||
|
||||
public boolean hasCooldown(String ability) {
|
||||
if (cooldowns.containsKey(ability))
|
||||
public boolean hasCooldown(String cooldownGroup) {
|
||||
return cooldowns.containsKey(cooldownGroup);
|
||||
}
|
||||
|
||||
public boolean removeCooldown(String cooldownGroup) {
|
||||
if (cooldowns.containsKey(cooldownGroup)) {
|
||||
cooldowns.remove(cooldownGroup);
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean removeCooldown(String ability) {
|
||||
if (cooldowns.containsKey(ability)) {
|
||||
cooldowns.remove(ability);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
public Cooldown getCooldown(String cooldownGroup) {
|
||||
return cooldowns.get(cooldownGroup);
|
||||
}
|
||||
|
||||
public Cooldown getCooldown(String ability) {
|
||||
if (cooldowns.containsKey(ability)) {
|
||||
return cooldowns.get(ability);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user