Skip to content

Commit ab61f22

Browse files
committed
Version 1.3.1
1 parent 81bfc74 commit ab61f22

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/com/connorlinfoot/titleapi/TitleAPI.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,22 @@ public static void sendTitle(Player player, Integer fadeIn, Integer stay, Intege
6464
}
6565

6666
public static void sendTabTitle(Player player, String header, String footer) {
67-
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
67+
CraftPlayer craftPlayer = (CraftPlayer) player;
68+
if (craftPlayer.getHandle().playerConnection.networkManager.getVersion() != 47)
69+
return; // If using 1.8, allow method to run
70+
71+
PlayerConnection connection = craftPlayer.getHandle().playerConnection;
72+
73+
74+
if (header == null) header = "";
75+
header = ChatColor.translateAlternateColorCodes('&', header);
76+
77+
if (footer == null) footer = "";
78+
footer = ChatColor.translateAlternateColorCodes('&', footer);
79+
80+
header = header.replaceAll("%player%", player.getDisplayName());
81+
footer = footer.replaceAll("%player%", player.getDisplayName());
82+
6883
IChatBaseComponent header2 = ChatSerializer.a("{'color': 'white', 'text': '" + header + "'}");
6984
IChatBaseComponent footer2 = ChatSerializer.a("{'color': 'white', 'text': '" + footer + "'}");
7085
connection.sendPacket(new ProtocolInjector.PacketTabHeader(header2, footer2));

src/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: TitleAPI
22
description: TitleAPI allows you to use the new 1.8 titles with the latest Spigot patcher
33
main: com.connorlinfoot.titleapi.TitleAPI
4-
version: 1.3
4+
version: 1.3.1
55
commands:
66
title:
77
description: Minecraft 1.8 Title Feature

0 commit comments

Comments
 (0)