summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
authort00thpick1 <t00thpick1dirko@gmail.com>2014-01-11 15:48:46 -0500
committerWesley Wolfe <weswolf@aol.com>2014-01-16 00:50:57 -0600
commitdd12820c58871c6e05b6a8cbe9197ac64c6a00a3 (patch)
treef6957a204451e2281306bac18ec40223819264de /src/main/java/net
parent05ed0a3139e623501c3fad5d38edece4ff472f24 (diff)
downloadcraftbukkit-dd12820c58871c6e05b6a8cbe9197ac64c6a00a3.tar
craftbukkit-dd12820c58871c6e05b6a8cbe9197ac64c6a00a3.tar.gz
craftbukkit-dd12820c58871c6e05b6a8cbe9197ac64c6a00a3.tar.lz
craftbukkit-dd12820c58871c6e05b6a8cbe9197ac64c6a00a3.tar.xz
craftbukkit-dd12820c58871c6e05b6a8cbe9197ac64c6a00a3.zip
Add StatisticManager.java for diff visibility.
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/StatisticManager.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/StatisticManager.java b/src/main/java/net/minecraft/server/StatisticManager.java
new file mode 100644
index 00000000..ba8e2134
--- /dev/null
+++ b/src/main/java/net/minecraft/server/StatisticManager.java
@@ -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;
+ }
+}