Paper/nms-patches/AdvancementRewards.patch

53 lines
2.1 KiB
Diff

--- 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);
}
}