mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Add StatisticManager.java for diff visibility.
This commit is contained in:
parent
05ed0a3139
commit
dd12820c58
1 changed files with 61 additions and 0 deletions
61
src/main/java/net/minecraft/server/StatisticManager.java
Normal file
61
src/main/java/net/minecraft/server/StatisticManager.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
package net.minecraft.server;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class StatisticManager {
|
||||
|
||||
protected final Map a = new HashMap();
|
||||
|
||||
public StatisticManager() {
|
||||
}
|
||||
|
||||
public boolean a(Achievement achievement) {
|
||||
return this.a((Statistic) achievement) > 0;
|
||||
}
|
||||
|
||||
public boolean b(Achievement achievement) {
|
||||
return achievement.c == null || this.a(achievement.c);
|
||||
}
|
||||
|
||||
public void b(EntityHuman entityhuman, Statistic statistic, int i) {
|
||||
if (!statistic.d() || this.b((Achievement) statistic)) {
|
||||
this.a(entityhuman, statistic, this.a(statistic) + i);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(EntityHuman entityhuman, Statistic statistic, int i) {
|
||||
StatisticWrapper statisticwrapper = (StatisticWrapper) this.a.get(statistic);
|
||||
|
||||
if (statisticwrapper == null) {
|
||||
statisticwrapper = new StatisticWrapper();
|
||||
this.a.put(statistic, statisticwrapper);
|
||||
}
|
||||
|
||||
statisticwrapper.a(i);
|
||||
}
|
||||
|
||||
public int a(Statistic statistic) {
|
||||
StatisticWrapper statisticwrapper = (StatisticWrapper) this.a.get(statistic);
|
||||
|
||||
return statisticwrapper == null ? 0 : statisticwrapper.a();
|
||||
}
|
||||
|
||||
public IJsonStatistic b(Statistic statistic) {
|
||||
StatisticWrapper statisticwrapper = (StatisticWrapper) this.a.get(statistic);
|
||||
|
||||
return statisticwrapper != null ? statisticwrapper.b() : null;
|
||||
}
|
||||
|
||||
public IJsonStatistic a(Statistic statistic, IJsonStatistic ijsonstatistic) {
|
||||
StatisticWrapper statisticwrapper = (StatisticWrapper) this.a.get(statistic);
|
||||
|
||||
if (statisticwrapper == null) {
|
||||
statisticwrapper = new StatisticWrapper();
|
||||
this.a.put(statistic, statisticwrapper);
|
||||
}
|
||||
|
||||
statisticwrapper.a(ijsonstatistic);
|
||||
return ijsonstatistic;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue