diff --git a/Harbor/.classpath b/Harbor/.classpath index 51a8bba..39fab5f 100644 --- a/Harbor/.classpath +++ b/Harbor/.classpath @@ -1,6 +1,21 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/Harbor/.project b/Harbor/.project index 3010c00..eab6d28 100644 --- a/Harbor/.project +++ b/Harbor/.project @@ -1,17 +1,17 @@ - - - Harbor - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - + + + Harbor + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/Harbor/.settings/org.eclipse.jdt.core.prefs b/Harbor/.settings/org.eclipse.jdt.core.prefs index 3a21537..bb35fa0 100644 --- a/Harbor/.settings/org.eclipse.jdt.core.prefs +++ b/Harbor/.settings/org.eclipse.jdt.core.prefs @@ -1,11 +1,11 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar.java b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar.java new file mode 100644 index 0000000..abb8ea1 --- /dev/null +++ b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar.java @@ -0,0 +1,8 @@ +package techtoolbox.Harbor.Actionbar; + +import org.bukkit.entity.Player; + +public interface Actionbar { + + public void sendActionbar(Player player, String message); +} diff --git a/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_10_R1.java b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_10_R1.java new file mode 100644 index 0000000..87a7b7b --- /dev/null +++ b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_10_R1.java @@ -0,0 +1,19 @@ +package techtoolbox.Harbor.Actionbar; + +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_10_R1.IChatBaseComponent; +import net.minecraft.server.v1_10_R1.IChatBaseComponent.ChatSerializer; +import net.minecraft.server.v1_10_R1.PacketPlayOutChat; + +public class Actionbar_1_10_R1 implements Actionbar { + + @Override + public void sendActionbar(Player player, String message) { + IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', message) + "\"}"); + PacketPlayOutChat titlePacket = new PacketPlayOutChat(titleComponent, (byte)2); + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket); + } +} diff --git a/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_11_R1.java b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_11_R1.java new file mode 100644 index 0000000..ab7c38d --- /dev/null +++ b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_11_R1.java @@ -0,0 +1,19 @@ +package techtoolbox.Harbor.Actionbar; + +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_11_R1.IChatBaseComponent; +import net.minecraft.server.v1_11_R1.IChatBaseComponent.ChatSerializer; +import net.minecraft.server.v1_11_R1.PacketPlayOutChat; + +public class Actionbar_1_11_R1 implements Actionbar { + + @Override + public void sendActionbar(Player player, String message) { + IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', message) + "\"}"); + PacketPlayOutChat titlePacket = new PacketPlayOutChat(titleComponent, (byte)2); + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket); + } +} diff --git a/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_12_R1.java b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_12_R1.java new file mode 100644 index 0000000..a63dccf --- /dev/null +++ b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_12_R1.java @@ -0,0 +1,20 @@ +package techtoolbox.Harbor.Actionbar; + +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_12_R1.ChatMessageType; +import net.minecraft.server.v1_12_R1.IChatBaseComponent; +import net.minecraft.server.v1_12_R1.PacketPlayOutChat; + +public class Actionbar_1_12_R1 implements Actionbar { + + @Override + public void sendActionbar(Player player, String message) { + + IChatBaseComponent titleComponent = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', message) + "\"}"); + PacketPlayOutChat titlePacket = new PacketPlayOutChat(titleComponent, ChatMessageType.GAME_INFO); + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket); + } +} diff --git a/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_13_R1.java b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_13_R1.java new file mode 100644 index 0000000..bedd929 --- /dev/null +++ b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_13_R1.java @@ -0,0 +1,18 @@ +package techtoolbox.Harbor.Actionbar; + +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_13_R1.IChatBaseComponent; +import net.minecraft.server.v1_13_R1.PacketPlayOutTitle; + +public class Actionbar_1_13_R1 implements Actionbar { + + @Override + public void sendActionbar(Player player, String message) { + IChatBaseComponent titleComponent = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', message) + "\"}"); + PacketPlayOutTitle titlePacket = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.ACTIONBAR, titleComponent); + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket); + } +} diff --git a/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_13_R2.java b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_13_R2.java new file mode 100644 index 0000000..7abfeb7 --- /dev/null +++ b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_13_R2.java @@ -0,0 +1,18 @@ +package techtoolbox.Harbor.Actionbar; + +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_13_R2.IChatBaseComponent; +import net.minecraft.server.v1_13_R2.PacketPlayOutTitle; + +public class Actionbar_1_13_R2 implements Actionbar { + + @Override + public void sendActionbar(Player player, String message) { + IChatBaseComponent titleComponent = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', message) + "\"}"); + PacketPlayOutTitle titlePacket = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.ACTIONBAR, titleComponent); + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket); + } +} diff --git a/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_8_R1.java b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_8_R1.java new file mode 100644 index 0000000..b019f49 --- /dev/null +++ b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_8_R1.java @@ -0,0 +1,19 @@ +package techtoolbox.Harbor.Actionbar; + +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_8_R1.ChatSerializer; +import net.minecraft.server.v1_8_R1.IChatBaseComponent; +import net.minecraft.server.v1_8_R1.PacketPlayOutChat; + +public class Actionbar_1_8_R1 implements Actionbar { + + @Override + public void sendActionbar(Player player, String message) { + IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', message) + "\"}"); + PacketPlayOutChat titlePacket = new PacketPlayOutChat(titleComponent, (byte)2); + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket); + } +} diff --git a/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_8_R2.java b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_8_R2.java new file mode 100644 index 0000000..8d0d000 --- /dev/null +++ b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_8_R2.java @@ -0,0 +1,19 @@ +package techtoolbox.Harbor.Actionbar; + +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_8_R2.IChatBaseComponent; +import net.minecraft.server.v1_8_R2.IChatBaseComponent.ChatSerializer; +import net.minecraft.server.v1_8_R2.PacketPlayOutChat; + +public class Actionbar_1_8_R2 implements Actionbar { + + @Override + public void sendActionbar(Player player, String message) { + IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', message) + "\"}"); + PacketPlayOutChat titlePacket = new PacketPlayOutChat(titleComponent, (byte)2); + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket); + } +} diff --git a/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_8_R3.java b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_8_R3.java new file mode 100644 index 0000000..eeae5da --- /dev/null +++ b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_8_R3.java @@ -0,0 +1,20 @@ +package techtoolbox.Harbor.Actionbar; + +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_8_R3.IChatBaseComponent; +import net.minecraft.server.v1_8_R3.IChatBaseComponent.ChatSerializer; +import net.minecraft.server.v1_8_R3.PacketPlayOutChat; + + +public class Actionbar_1_8_R3 implements Actionbar { + + @Override + public void sendActionbar(Player player, String message) { + IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', message) + "\"}"); + PacketPlayOutChat titlePacket = new PacketPlayOutChat(titleComponent, (byte)2); + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket); + } +} diff --git a/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_9_R1.java b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_9_R1.java new file mode 100644 index 0000000..c287af3 --- /dev/null +++ b/Harbor/src/techtoolbox/Harbor/Actionbar/Actionbar_1_9_R1.java @@ -0,0 +1,20 @@ +package techtoolbox.Harbor.Actionbar; + +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +import net.minecraft.server.v1_9_R1.IChatBaseComponent; +import net.minecraft.server.v1_9_R1.IChatBaseComponent.ChatSerializer; +import net.minecraft.server.v1_9_R1.PacketPlayOutChat; + + +public class Actionbar_1_9_R1 implements Actionbar { + + @Override + public void sendActionbar(Player player, String message) { + IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', message) + "\"}"); + PacketPlayOutChat titlePacket = new PacketPlayOutChat(titleComponent, (byte)2); + ((CraftPlayer) player).getHandle().playerConnection.sendPacket(titlePacket); + } +}