summaryrefslogtreecommitdiffstats
path: root/nms-patches/AdvancementRewards.patch
blob: 8f0ea2c330b3828105f1befb6f59f72f0591bb62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--- a/net/minecraft/server/AdvancementRewards.java
+++ b/net/minecraft/server/AdvancementRewards.java
@@ -66,7 +66,24 @@
         CustomFunction customfunction = this.e.a(minecraftserver.aL());
 
         if (customfunction != null) {
-            ICommandListener icommandlistener = new ICommandListener() {
+            // CraftBukkit start
+            ICommandListener icommandlistener = new AdvancementCommandListener(entityplayer, minecraftserver);
+
+            minecraftserver.aL().a(customfunction, icommandlistener);
+        }
+
+    }
+
+            public static class AdvancementCommandListener implements ICommandListener {
+
+                private final EntityPlayer entityplayer;
+                private final MinecraftServer minecraftserver;
+
+                public AdvancementCommandListener(EntityPlayer entityplayer, MinecraftServer minecraftserver) {
+                    this.entityplayer = entityplayer;
+                    this.minecraftserver = minecraftserver;
+                }
+
                 public String getName() {
                     return entityplayer.getName();
                 }
@@ -108,12 +125,8 @@
                 public MinecraftServer C_() {
                     return entityplayer.C_();
                 }
-            };
-
-            minecraftserver.aL().a(customfunction, icommandlistener);
-        }
-
-    }
+            }
+    // CraftBukkit end
 
     public String toString() {
         return "AdvancementRewards{experience=" + this.b + ", loot=" + Arrays.toString(this.c) + ", recipes=" + Arrays.toString(this.d) + ", function=" + this.e + '}';
@@ -156,7 +169,7 @@
             return new AdvancementRewards(i, aminecraftkey, aminecraftkey1, customfunction_a);
         }
 
-        public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+        public AdvancementRewards deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { // CraftBukkit - decompile error
             return this.a(jsonelement, type, jsondeserializationcontext);
         }
     }