Added support for 1_8_R1

This commit is contained in:
Alastair 2017-05-13 18:19:08 +01:00
parent 1bf886e909
commit bbcd423987
4 changed files with 17 additions and 3 deletions

View File

@ -1,6 +1,6 @@
main: com.sekwah.advancedportals.AdvancedPortalsPlugin main: com.sekwah.advancedportals.AdvancedPortalsPlugin
name: AdvancedPortals name: AdvancedPortals
version: 0.0.24 version: 0.0.25
author: sekwah41 author: sekwah41
description: An advanced portals plugin for bukkit. description: An advanced portals plugin for bukkit.
commands: commands:

View File

@ -16,7 +16,7 @@
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository> </repository>
</repositories> </repositories>
<version>0.0.24-snapshot</version> <version>0.0.25-snapshot</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.source>1.7</maven.compiler.source>

View File

@ -61,7 +61,9 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
e.printStackTrace();
this.getLogger().warning("This version of craftbukkit is not yet supported, please notify sekwah and tell him about this version v:" + version); this.getLogger().warning("This version of craftbukkit is not yet supported, please notify sekwah and tell him about this version v:" + version);
this.getLogger().warning("Along with the above stacktrace");
this.setEnabled(false); this.setEnabled(false);
} catch (IllegalArgumentException | } catch (IllegalArgumentException |
NoSuchFieldException | SecurityException | NoSuchMethodException e) { NoSuchFieldException | SecurityException | NoSuchMethodException e) {

View File

@ -39,7 +39,17 @@ public class CraftBukkit {
String minecraftPackage = "net.minecraft.server." + bukkitImpl + "."; String minecraftPackage = "net.minecraft.server." + bukkitImpl + ".";
Class<?> chatBaseComponent = Class.forName(minecraftPackage + "IChatBaseComponent"); // string to packet methods Class<?> chatBaseComponent = Class.forName(minecraftPackage + "IChatBaseComponent"); // string to packet methods
this.serializeMessage = this.findClass(chatBaseComponent, "ChatSerializer").getMethod("a", String.class); Class<?> chatSerialClass = this.findClass(chatBaseComponent, "ChatSerializer");
if(chatSerialClass == null){
plugin.getLogger().info("Old version detected, changing chat method");
this.serializeMessage = chatBaseComponent.getMethod("a", String.class);
}
else{
plugin.getLogger().info("Old version detected, changing chat method");
this.serializeMessage = chatBaseComponent.getMethod("a", String.class);
}
this.chatPacketConstructor = Class.forName(minecraftPackage + "PacketPlayOutChat").getConstructor(chatBaseComponent, byte.class); this.chatPacketConstructor = Class.forName(minecraftPackage + "PacketPlayOutChat").getConstructor(chatBaseComponent, byte.class);
this.playerGetHandle = Class.forName(craftBukkitPackage + "entity.CraftPlayer").getMethod("getHandle"); this.playerGetHandle = Class.forName(craftBukkitPackage + "entity.CraftPlayer").getMethod("getHandle");
@ -47,6 +57,8 @@ public class CraftBukkit {
Class<?> packet = Class.forName(minecraftPackage + "Packet"); Class<?> packet = Class.forName(minecraftPackage + "Packet");
this.sendPacket = playerConnection.getType().getMethod("sendPacket", packet); this.sendPacket = playerConnection.getType().getMethod("sendPacket", packet);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
plugin.getLogger().warning("Attempting to use backup porekit locations");
// Fall back on your Porekit // Fall back on your Porekit
Class<?> textBaseComponent = Class.forName("net.minecraft.util.text.ITextComponent"); // string to packet methods Class<?> textBaseComponent = Class.forName("net.minecraft.util.text.ITextComponent"); // string to packet methods
this.serializeMessage = this.findClass(textBaseComponent, "Serializer").getMethod("func_150699_a", String.class); // md: jsonToComponent this.serializeMessage = this.findClass(textBaseComponent, "Serializer").getMethod("func_150699_a", String.class); // md: jsonToComponent