PaperMC/nms-patches/JsonList.patch
2020-06-25 10:00:00 +10:00

60 lines
2.1 KiB
Diff

--- a/net/minecraft/server/JsonList.java
+++ b/net/minecraft/server/JsonList.java
@@ -50,7 +50,7 @@
@Nullable
public V get(K k0) {
this.g();
- return (JsonListEntry) this.d.get(this.a(k0));
+ return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error
}
public void remove(K k0) {
@@ -72,6 +72,12 @@
return (String[]) this.d.keySet().toArray(new String[this.d.size()]);
}
+ // CraftBukkit start
+ public Collection<V> getValues() {
+ return this.d.values();
+ }
+ // CraftBukkit end
+
public boolean isEmpty() {
return this.d.size() < 1;
}
@@ -89,7 +95,7 @@
Iterator iterator = this.d.values().iterator();
while (iterator.hasNext()) {
- V v0 = (JsonListEntry) iterator.next();
+ V v0 = (V) iterator.next(); // CraftBukkit - decompile error
if (v0.hasExpired()) {
list.add(v0.getKey());
@@ -99,7 +105,7 @@
iterator = list.iterator();
while (iterator.hasNext()) {
- K k0 = iterator.next();
+ K k0 = (K) iterator.next(); // CraftBukkit - decompile error
this.d.remove(this.a(k0));
}
@@ -119,7 +125,7 @@
JsonObject jsonobject = new JsonObject();
jsonlistentry.getClass();
- return (JsonObject) SystemUtils.a((Object) jsonobject, jsonlistentry::a);
+ return (JsonObject) SystemUtils.a(jsonobject, jsonlistentry::a); // CraftBukkit - decompile error
}).forEach(jsonarray::add);
BufferedWriter bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
Throwable throwable = null;
@@ -163,7 +169,7 @@
JsonListEntry<K> jsonlistentry = this.a(jsonobject);
if (jsonlistentry.getKey() != null) {
- this.d.put(this.a(jsonlistentry.getKey()), jsonlistentry);
+ this.d.put(this.a(jsonlistentry.getKey()), (V) jsonlistentry); // CraftBukkit - fix decompile error
}
}
} catch (Throwable throwable1) {