Update TitleUtil to support 1.8.3
This commit is contained in:
parent
9811e1fd6c
commit
7058cdc1c1
@ -50,7 +50,16 @@ public final class TitleUtil
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// The enum used
|
// The enum used
|
||||||
|
try
|
||||||
|
{
|
||||||
titleEnumClass = PackageType.MINECRAFT_SERVER.getClass("EnumTitleAction");
|
titleEnumClass = PackageType.MINECRAFT_SERVER.getClass("EnumTitleAction");
|
||||||
|
}
|
||||||
|
catch (ClassNotFoundException e)
|
||||||
|
{
|
||||||
|
// Since 1.8.3
|
||||||
|
titleEnumClass = PackageType.MINECRAFT_SERVER.getClass("PacketPlayOutTitle$EnumTitleAction");
|
||||||
|
}
|
||||||
|
|
||||||
// Get the enum values.
|
// Get the enum values.
|
||||||
for (Object o : titleEnumClass.getEnumConstants())
|
for (Object o : titleEnumClass.getEnumConstants())
|
||||||
{
|
{
|
||||||
@ -62,7 +71,16 @@ public final class TitleUtil
|
|||||||
|
|
||||||
// Get chatserializer and chat component.
|
// Get chatserializer and chat component.
|
||||||
iChatBaseComponent = PackageType.MINECRAFT_SERVER.getClass("IChatBaseComponent");
|
iChatBaseComponent = PackageType.MINECRAFT_SERVER.getClass("IChatBaseComponent");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
chatSerializer = PackageType.MINECRAFT_SERVER.getClass("ChatSerializer").getDeclaredMethod("a", String.class);
|
chatSerializer = PackageType.MINECRAFT_SERVER.getClass("ChatSerializer").getDeclaredMethod("a", String.class);
|
||||||
|
}
|
||||||
|
catch (ClassNotFoundException e)
|
||||||
|
{
|
||||||
|
// Since 1.8.3
|
||||||
|
chatSerializer = PackageType.MINECRAFT_SERVER.getClass("IChatBaseComponent$ChatSerializer").getDeclaredMethod("a", String.class);
|
||||||
|
}
|
||||||
|
|
||||||
// Get packet and it's constructor
|
// Get packet and it's constructor
|
||||||
Class<?> packetClass = PackageType.MINECRAFT_SERVER.getClass("PacketPlayOutTitle");
|
Class<?> packetClass = PackageType.MINECRAFT_SERVER.getClass("PacketPlayOutTitle");
|
||||||
@ -82,8 +100,7 @@ public final class TitleUtil
|
|||||||
playerConnection.setAccessible(true);
|
playerConnection.setAccessible(true);
|
||||||
sendPacket.setAccessible(true);
|
sendPacket.setAccessible(true);
|
||||||
|
|
||||||
|
// This succeeded, we use titles.
|
||||||
// This suceeded, we use titles.
|
|
||||||
useTitles = true;
|
useTitles = true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
Loading…
Reference in New Issue
Block a user