Merge pull request #84 from Techcable/fix/null-titles

Don't pass null title to constructor
This commit is contained in:
Zach 2016-03-16 21:13:59 -05:00
commit 36f0b8144d
2 changed files with 15 additions and 14 deletions

View File

@ -1,11 +1,11 @@
From 5c9387d5adf82c863c02ba4dd4e4f1d733fe5213 Mon Sep 17 00:00:00 2001 From 17182b51ae5cd672659b0a43455af918e8bb60c9 Mon Sep 17 00:00:00 2001
From: Techcable <Techcable@outlook.com> From: Techcable <Techcable@outlook.com>
Date: Thu, 3 Mar 2016 02:32:10 -0600 Date: Thu, 3 Mar 2016 02:32:10 -0600
Subject: [PATCH] Player Tab List and Title APIs Subject: [PATCH] Player Tab List and Title APIs
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 10bf160..d9fab10 100644 index 10bf160..0c2d2c6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -99,27 +99,28 @@ index 10bf160..d9fab10 100644
// Paper end // Paper end
@Override @Override
@@ -1342,20 +1420,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1341,21 +1419,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void sendTitle(String title, String subtitle) { public void sendTitle(String title, String subtitle) {
if (title != null) { - if (title != null) {
- PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(title)[0]); - PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(title)[0]);
- getHandle().playerConnection.sendPacket(packetTitle); - getHandle().playerConnection.sendPacket(packetTitle);
+ this.sendTitle(new Title(title)); // TODO: Paper - Double check these - }
} -
- if (subtitle != null) {
if (subtitle != null) {
- PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(subtitle)[0]); - PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(subtitle)[0]);
- getHandle().playerConnection.sendPacket(packetSubtitle); - getHandle().playerConnection.sendPacket(packetSubtitle);
+ this.sendTitle(new Title(null, subtitle)); // TODO: Paper - Double check these - }
} + Preconditions.checkNotNull(title, "Null title");
+ this.sendTitle(new Title(title, subtitle));
} }
@Override @Override
public void resetTitle() { public void resetTitle() {
- PacketPlayOutTitle packetReset = new PacketPlayOutTitle(EnumTitleAction.RESET, null); - PacketPlayOutTitle packetReset = new PacketPlayOutTitle(EnumTitleAction.RESET, null);
- getHandle().playerConnection.sendPacket(packetReset); - getHandle().playerConnection.sendPacket(packetReset);
+ this.hideTitle(); // TODO: Paper - Double check these + getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.RESET, (BaseComponent[]) null, 0, 0, 0));
} }
@Override @Override

View File

@ -1,4 +1,4 @@
From 6894cfddcaf208b675684d39f80fa314867c10aa Mon Sep 17 00:00:00 2001 From bf6283b5e4de9efb88ab98d75a5ccc628997f268 Mon Sep 17 00:00:00 2001
From: Jedediah Smith <jedediah@silencegreys.com> From: Jedediah Smith <jedediah@silencegreys.com>
Date: Sat, 4 Apr 2015 23:17:52 -0400 Date: Sat, 4 Apr 2015 23:17:52 -0400
Subject: [PATCH] Complete resource pack API Subject: [PATCH] Complete resource pack API
@ -37,7 +37,7 @@ index 27f78ab..1b16b54 100644
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 51c971f..fd17df9 100644 index 4be2653..b2b2bf4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -72,6 +72,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -72,6 +72,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -51,7 +51,7 @@ index 51c971f..fd17df9 100644
public CraftPlayer(CraftServer server, EntityPlayer entity) { public CraftPlayer(CraftServer server, EntityPlayer entity) {
super(server, entity); super(server, entity);
@@ -1519,6 +1523,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1514,6 +1518,33 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setViewDistance(int viewDistance) { public void setViewDistance(int viewDistance) {
((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance); ((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance);
} }