mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-01-14 20:21:21 +01:00
Fixed for older versions
This commit is contained in:
parent
8ae2473b9a
commit
221bee9613
@ -47,15 +47,16 @@ public class CraftBukkit {
|
|||||||
Class<?> chatBaseComponent = Class.forName(minecraftPackage + "IChatBaseComponent"); // string to packet methods
|
Class<?> chatBaseComponent = Class.forName(minecraftPackage + "IChatBaseComponent"); // string to packet methods
|
||||||
Class<?> chatSerialClass = this.findClass(chatBaseComponent, "ChatSerializer");
|
Class<?> chatSerialClass = this.findClass(chatBaseComponent, "ChatSerializer");
|
||||||
|
|
||||||
|
try{
|
||||||
Class<?> chatMessageTypeClass = Class.forName(minecraftPackage + "ChatMessageType");
|
Class<?> chatMessageTypeClass = Class.forName(minecraftPackage + "ChatMessageType");
|
||||||
|
|
||||||
if(chatMessageTypeClass != null){
|
|
||||||
useEnumType = true;
|
useEnumType = true;
|
||||||
this.chatMessageTypeMethod = chatMessageTypeClass.getMethod("a", byte.class);
|
this.chatMessageTypeMethod = chatMessageTypeClass.getMethod("a", byte.class);
|
||||||
|
|
||||||
this.chatPacketConstructor = Class.forName(minecraftPackage + "PacketPlayOutChat").getConstructor(chatBaseComponent, chatMessageTypeClass);
|
this.chatPacketConstructor = Class.forName(minecraftPackage + "PacketPlayOutChat").getConstructor(chatBaseComponent, chatMessageTypeClass);
|
||||||
}
|
}
|
||||||
else{
|
catch(ClassNotFoundException e) {
|
||||||
|
plugin.getLogger().info("Old version detected, changing chat method");
|
||||||
this.chatPacketConstructor = Class.forName(minecraftPackage + "PacketPlayOutChat").getConstructor(chatBaseComponent, byte.class);
|
this.chatPacketConstructor = Class.forName(minecraftPackage + "PacketPlayOutChat").getConstructor(chatBaseComponent, byte.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ public class CraftBukkit {
|
|||||||
this.serializeMessage = chatSerialClass.getMethod("a", String.class);
|
this.serializeMessage = chatSerialClass.getMethod("a", String.class);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
plugin.getLogger().info("Old version detected, changing chat method");
|
plugin.getLogger().info("Even older version detected, changing chat method");
|
||||||
this.serializeMessage = chatBaseComponent.getMethod("a", String.class);
|
this.serializeMessage = chatBaseComponent.getMethod("a", String.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user