mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Fixed counter handling of counters.
This commit is contained in:
parent
34f62ec620
commit
af4a40d5d5
1 changed files with 4 additions and 7 deletions
|
@ -75,18 +75,15 @@ public class Counters extends HashMap<String, Counter> implements Serializable {
|
|||
}
|
||||
|
||||
public void removeCounter(String name) {
|
||||
if (this.containsKey(name)) {
|
||||
Counter counter = this.get(name);
|
||||
counter.remove();
|
||||
if (counter.getCount() == 0) {
|
||||
this.remove(name);
|
||||
}
|
||||
}
|
||||
removeCounter(name, 1);
|
||||
}
|
||||
|
||||
public void removeCounter(CounterType counterType, int amount) {
|
||||
if (this.containsKey(counterType.getName())) {
|
||||
get(counterType.getName()).remove(amount);
|
||||
if (get(counterType.getName()).count == 0) {
|
||||
this.remove(counterType.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue