Permalink
Browse files

Actionbar update for 1.8.4

  • Loading branch information...
Sablednah committed May 21, 2015
1 parent a8d908f commit eff21228a3dffb50d74da1c7cc1952505c695645
@@ -0,0 +1,18 @@
+package main.java.me.sablednah.MobHealth.API;
+
+import net.minecraft.server.v1_8_R3.IChatBaseComponent;
+import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
+import org.bukkit.ChatColor;
+import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+public class ActionBar_1_8_4 implements ActionBar {
+ public boolean sendActionBar(String text, Player player) {
+ String output = "{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', text) + "\"}";
+
+ IChatBaseComponent baseChat = IChatBaseComponent.ChatSerializer.a(output);
+ PacketPlayOutChat actionbarPacket = new PacketPlayOutChat(baseChat, (byte) 2);
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(actionbarPacket);
+ return true;
+ }
+}
@@ -38,6 +38,7 @@
import main.java.me.sablednah.MobHealth.API.ActionBar;
import main.java.me.sablednah.MobHealth.API.ActionBar_1_8_1;
import main.java.me.sablednah.MobHealth.API.ActionBar_1_8_3;
+import main.java.me.sablednah.MobHealth.API.ActionBar_1_8_4;
import main.java.me.sablednah.MobHealth.API.MobHealthAPI;
import org.bukkit.ChatColor;
@@ -269,7 +270,9 @@ public void onEnable() {
showMobHeadHealth = false;
}
}
- if (plugin.getServer().getClass().getPackage().getName().substring(23).equalsIgnoreCase("v1_8_R2")) {
+ if (plugin.getServer().getClass().getPackage().getName().substring(23).equalsIgnoreCase("v1_8_R3")) {
+ actionBar = new ActionBar_1_8_4();
+ } else if (plugin.getServer().getClass().getPackage().getName().substring(23).equalsIgnoreCase("v1_8_R2")) {
actionBar = new ActionBar_1_8_3();
} else if (plugin.getServer().getClass().getPackage().getName().substring(23).equalsIgnoreCase("v1_8_R1")) {
actionBar = new ActionBar_1_8_1();

0 comments on commit eff2122

Please sign in to comment.