From b6f2d665bda6a4adc6fc7a4fc5d792bebaf090bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Kol=C3=A1=C5=99?= Date: Sun, 12 Jun 2016 19:55:56 +0200 Subject: [PATCH] Update for 1.10 --- nms/NMS/pom.xml | 6 ++++ nms/NMS/src/main/java/nms/NMS.java | 4 ++- nms/NMS_hook_1_10_R1/pom.xml | 25 ++++++++++++++++ .../src/main/java/nms/NMSHook.java | 28 ++++++++++++++++++ .../src/main/java/nms/NMSHook_v1_10_R1.java | 29 +++++++++++++++++++ pom.xml | 9 +++--- 6 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 nms/NMS_hook_1_10_R1/pom.xml create mode 100644 nms/NMS_hook_1_10_R1/src/main/java/nms/NMSHook.java create mode 100644 nms/NMS_hook_1_10_R1/src/main/java/nms/NMSHook_v1_10_R1.java diff --git a/nms/NMS/pom.xml b/nms/NMS/pom.xml index 870077a..7be07c0 100644 --- a/nms/NMS/pom.xml +++ b/nms/NMS/pom.xml @@ -56,6 +56,12 @@ ${boosCooldowns.version} compile + + cz.boosik + NMS_hook_1_10_R1 + ${boosCooldowns.version} + compile + \ No newline at end of file diff --git a/nms/NMS/src/main/java/nms/NMS.java b/nms/NMS/src/main/java/nms/NMS.java index bcacf47..90fca05 100644 --- a/nms/NMS/src/main/java/nms/NMS.java +++ b/nms/NMS/src/main/java/nms/NMS.java @@ -32,13 +32,15 @@ public class NMS { if (version.equals("v1_9_R1")) { hook = new NMSHook_v1_9_R1(); } else if (version.equals("v1_9_R2")) { - hook = new NMSHook_v1_9_R2(); + hook = new NMSHook_v1_10_R1(); } else if (version.equals("v1_8_R3")) { hook = new NMSHook_v1_8_R3(); } else if (version.equals("v1_8_R2")) { hook = new NMSHook_v1_8_R2(); } else if (version.equals("v1_8_R1")) { hook = new NMSHook_v1_8_R1(); + } else if (version.equals("v1_10_R1")) { + hook = new NMSHook_v1_10_R1(); } compatible = hook != null; diff --git a/nms/NMS_hook_1_10_R1/pom.xml b/nms/NMS_hook_1_10_R1/pom.xml new file mode 100644 index 0000000..d8edfce --- /dev/null +++ b/nms/NMS_hook_1_10_R1/pom.xml @@ -0,0 +1,25 @@ + + + + boosCooldowns + cz.boosik + ${boosCooldowns.version} + ../../pom.xml + + 4.0.0 + + NMS_hook_1_10_R1 + + + + + org.spigotmc + spigot + 1.10-R0.1-SNAPSHOT + provided + + + + \ No newline at end of file diff --git a/nms/NMS_hook_1_10_R1/src/main/java/nms/NMSHook.java b/nms/NMS_hook_1_10_R1/src/main/java/nms/NMSHook.java new file mode 100644 index 0000000..3b99b16 --- /dev/null +++ b/nms/NMS_hook_1_10_R1/src/main/java/nms/NMSHook.java @@ -0,0 +1,28 @@ +package nms; + +import org.bukkit.entity.Player; + +/** + * All rights reserved. + * + * @author ColoredCarrot + */ +public interface NMSHook { + + /** + * Sends a JSON message to a player. + * + * @param json (String) - the plain JSON + * @param player (Player) - the player + */ + public void sendJSON(String json, Player player); + + /** + * Sends an actionbar to a player. + * + * @param json (String) - the plain JSON + * @param player (Player) - the player + */ + public void sendActionBar(String json, Player player); + +} diff --git a/nms/NMS_hook_1_10_R1/src/main/java/nms/NMSHook_v1_10_R1.java b/nms/NMS_hook_1_10_R1/src/main/java/nms/NMSHook_v1_10_R1.java new file mode 100644 index 0000000..2799850 --- /dev/null +++ b/nms/NMS_hook_1_10_R1/src/main/java/nms/NMSHook_v1_10_R1.java @@ -0,0 +1,29 @@ +package nms; + +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_10_R1.IChatBaseComponent.ChatSerializer; +import net.minecraft.server.v1_10_R1.PacketPlayOutChat; + +/** + * All rights reserved. + * + * @author ColoredCarrot + */ +public class NMSHook_v1_10_R1 + implements NMSHook { + + public void sendJSON(String json, Player player) { + + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutChat(ChatSerializer.a(json))); + + } + + public void sendActionBar(String json, Player player) { + + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutChat(ChatSerializer.a(json), (byte) 2)); + + } + +} diff --git a/pom.xml b/pom.xml index 5143ed5..492caba 100644 --- a/pom.xml +++ b/pom.xml @@ -10,19 +10,20 @@ nms/NMS_hook_1_8_R3 nms/NMS_hook_1_9_R1 nms/NMS_hook_1_9_R2 + nms/NMS_hook_1_10_R1 nms/NMS plugin jar - + pom http://maven.apache.org - 3.11.1 + 3.11.2 UTF-8 UTF-8 - 1.9.2 + 1.10 R0.1 - v1_9_R1 + v1_10_R1