[LTC] Implement Gilraen, Dunedain Protector (#10728)

* [LTC] Implement Gilraen, Dunedain Protector

* add tests on Gilraen

* apply review
This commit is contained in:
Susucre 2023-08-12 22:16:02 +02:00 committed by GitHub
parent eef8f508e4
commit 2d53668c96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 317 additions and 190 deletions

View file

@ -25,19 +25,20 @@ public class Counters extends HashMap<String, Counter> implements Serializable {
return new Counters(this);
}
public void addCounter(String name, int amount) {
public Counters addCounter(String name, int amount) {
putIfAbsent(name, new Counter(name));
this.get(name).add(amount);
return this;
}
public void addCounter(Counter counter) {
public Counters addCounter(Counter counter) {
if (!containsKey(counter.name)) {
put(counter.name, counter);
} else {
get(counter.name).add(counter.getCount());
}
return this;
}
public boolean removeCounter(String name) {