Files
2019-02-24 22:29:41 +08:00

38 lines
1.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/util/text/Style.java
+++ ../src-work/minecraft/net/minecraft/util/text/Style.java
@@ -238,7 +238,6 @@
return this;
}
- @SideOnly(Side.CLIENT)
public String getFormattingCode()
{
if (this.isEmpty())
@@ -362,15 +361,17 @@
public int hashCode()
{
- int i = this.color.hashCode();
- i = 31 * i + this.bold.hashCode();
- i = 31 * i + this.italic.hashCode();
- i = 31 * i + this.underlined.hashCode();
- i = 31 * i + this.strikethrough.hashCode();
- i = 31 * i + this.obfuscated.hashCode();
- i = 31 * i + this.clickEvent.hashCode();
- i = 31 * i + this.hoverEvent.hashCode();
- i = 31 * i + this.insertion.hashCode();
+ // CraftBukkit start - fix npe
+ int i = color == null ? 0 : this.color.hashCode();
+ i = 31 * i + (bold == null ? 0 : this.bold.hashCode());
+ i = 31 * i + (italic == null ? 0 : this.italic.hashCode());
+ i = 31 * i + (underlined == null ? 0 : this.underlined.hashCode());
+ i = 31 * i + (strikethrough == null ? 0 : this.strikethrough.hashCode());
+ i = 31 * i + (obfuscated == null ? 0 : this.obfuscated.hashCode());
+ i = 31 * i + (clickEvent == null ? 0 : this.clickEvent.hashCode());
+ i = 31 * i + (hoverEvent == null ? 0 : this.hoverEvent.hashCode());
+ i = 31 * i + (insertion == null ? 0 : this.insertion.hashCode());
+ // CraftBukkit end
return i;
}