Don't pass null title to constructor

Fixes #83
Fix resetTitle()
@Zbob750 shouldn't be doing these updates in the middle of the night
Dieser Commit ist enthalten in:
Techcable 2016-03-16 18:58:48 -07:00
Ursprung 4209e6184c
Commit c2c40a2562
2 geänderte Dateien mit 15 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -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>
Date: Thu, 3 Mar 2016 02:32:10 -0600
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
index 10bf160..d9fab10 100644
index 10bf160..0c2d2c6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1,5 +1,6 @@
@ -99,27 +99,28 @@ index 10bf160..d9fab10 100644
// Paper end
@Override
@@ -1342,20 +1420,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1341,21 +1419,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public void sendTitle(String title, String subtitle) {
if (title != null) {
- if (title != null) {
- PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(title)[0]);
- 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]);
- 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
public void resetTitle() {
- PacketPlayOutTitle packetReset = new PacketPlayOutTitle(EnumTitleAction.RESET, null);
- 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

Datei anzeigen

@ -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>
Date: Sat, 4 Apr 2015 23:17:52 -0400
Subject: [PATCH] Complete resource pack API
@ -37,7 +37,7 @@ index 27f78ab..1b16b54 100644
// CraftBukkit end
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
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -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) {
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) {
((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance);
}