PaperMC/nms-patches/ChatModifier.patch

46 lines
2 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ChatModifier.java
+++ b/net/minecraft/server/ChatModifier.java
2016-05-10 13:47:39 +02:00
@@ -263,16 +263,18 @@
2014-12-27 20:29:22 +01:00
}
public int hashCode() {
- int i = this.b.hashCode();
+ // CraftBukkit start - fix npe
+ int i = b == null ? 0 : this.b.hashCode();
- i = 31 * i + this.c.hashCode();
- i = 31 * i + this.d.hashCode();
- i = 31 * i + this.e.hashCode();
- i = 31 * i + this.f.hashCode();
- i = 31 * i + this.g.hashCode();
- i = 31 * i + this.h.hashCode();
- i = 31 * i + this.i.hashCode();
- i = 31 * i + this.j.hashCode();
+ i = 31 * i + (c == null ? 0 : this.c.hashCode());
+ i = 31 * i + (d == null ? 0 : this.d.hashCode());
+ i = 31 * i + (e == null ? 0 : this.e.hashCode());
+ i = 31 * i + (f == null ? 0 : this.f.hashCode());
+ i = 31 * i + (g == null ? 0 : this.g.hashCode());
+ i = 31 * i + (h == null ? 0 : this.h.hashCode());
+ i = 31 * i + (this.i == null ? 0 : this.i.hashCode());
+ i = 31 * i + (j == null ? 0 : this.j.hashCode());
+ // CraftBukkit end
return i;
}
2016-11-17 02:41:03 +01:00
@@ -441,12 +443,12 @@
2015-02-26 23:41:06 +01:00
}
2016-11-17 02:41:03 +01:00
@Nullable
2015-02-26 23:41:06 +01:00
- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) {
+ public JsonElement serialize(ChatModifier object, Type type, JsonSerializationContext jsonserializationcontext) { // CraftBukkit - fix decompile error
return this.a((ChatModifier) object, type, jsonserializationcontext);
}
2016-11-17 02:41:03 +01:00
@Nullable
2015-02-26 23:41:06 +01:00
- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ public ChatModifier deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { // CraftBukkit - fix decompile error
return this.a(jsonelement, type, jsondeserializationcontext);
}
}