diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index 67f0c7cf49..aefef821f0 100644 --- a/Spigot-Server-Patches/0004-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -1,11 +1,11 @@ -From 41b25e73b7480b5af82b385e10674d7f21ebbaa3 Mon Sep 17 00:00:00 2001 +From 11d2df695af8ab5f3f0d65c71cff3e0af8259cea Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 28 Mar 2016 20:55:47 -0400 Subject: [PATCH] MC Utils diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index b0aba60..81fc04e 100644 +index b0aba6089..81fc04ed3 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -675,6 +675,7 @@ public class Chunk { @@ -18,10 +18,10 @@ index b0aba60..81fc04e 100644 // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java new file mode 100644 -index 0000000..fe7b476 +index 000000000..1159eea1a --- /dev/null +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -0,0 +1,199 @@ +@@ -0,0 +1,189 @@ +package net.minecraft.server; + +import com.google.common.util.concurrent.ThreadFactoryBuilder; @@ -37,22 +37,12 @@ index 0000000..fe7b476 +import java.util.regex.Pattern; + +public final class MCUtil { -+ private static final Pattern REPLACE_QUOTES = Pattern.compile("\""); + private static final Executor asyncExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Paper Async Task Handler Thread - %1$d").build()); + + private MCUtil() {} + + + /** -+ * Builds a chat componenent from a string. -+ * @param str -+ * @return -+ */ -+ public static IChatBaseComponent cmpFromMessage(String str) { -+ return IChatBaseComponent.ChatSerializer.a("{\"text\":\"" + REPLACE_QUOTES.matcher(str).replaceAll("\\\"") + "\"}"); -+ } -+ -+ /** + * Ensures the target code is running on the main thread + * @param reason + * @param run @@ -222,7 +212,7 @@ index 0000000..fe7b476 + } +} diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index 90d18f4..2a2f53c 100644 +index 90d18f489..2a2f53c82 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java @@ -19,7 +19,7 @@ import org.apache.logging.log4j.Logger; @@ -249,7 +239,7 @@ index 90d18f4..2a2f53c 100644 public UUID a(String s) { return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least")); diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index 370203b..ae7498c 100644 +index 370203b2d..ae7498c03 100644 --- a/src/main/java/net/minecraft/server/NBTTagList.java +++ b/src/main/java/net/minecraft/server/NBTTagList.java @@ -12,7 +12,7 @@ import org.apache.logging.log4j.Logger; @@ -262,5 +252,5 @@ index 370203b..ae7498c 100644 public NBTTagList() {} -- -2.9.3 +2.11.0 diff --git a/Spigot-Server-Patches/0194-String-based-Action-Bar-API.patch b/Spigot-Server-Patches/0194-String-based-Action-Bar-API.patch index 3fd9a7990f..5d39b63ea7 100644 --- a/Spigot-Server-Patches/0194-String-based-Action-Bar-API.patch +++ b/Spigot-Server-Patches/0194-String-based-Action-Bar-API.patch @@ -1,11 +1,11 @@ -From e084bdc8d74009aa017c01186ceda098027069d9 Mon Sep 17 00:00:00 2001 +From d9f86b41bde9db6872be73e1fae16fb7dd73bf55 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 27 Dec 2016 15:02:42 -0500 Subject: [PATCH] String based Action Bar API diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index fe7b476c0..117cfba80 100644 +index 1159eea1a..38359517c 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -1,10 +1,13 @@ @@ -22,7 +22,7 @@ index fe7b476c0..117cfba80 100644 import javax.annotation.Nullable; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; -@@ -18,6 +21,24 @@ public final class MCUtil { +@@ -17,6 +20,24 @@ public final class MCUtil { private MCUtil() {} @@ -46,8 +46,8 @@ index fe7b476c0..117cfba80 100644 + } /** - * Builds a chat componenent from a string. -@@ -196,4 +217,13 @@ public final class MCUtil { + * Ensures the target code is running on the main thread +@@ -186,4 +207,13 @@ public final class MCUtil { } return null; } @@ -62,7 +62,7 @@ index fe7b476c0..117cfba80 100644 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 3edeb4910..0f0056561 100644 +index 3edeb4910..26b89799e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -163,6 +163,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -71,7 +71,7 @@ index 3edeb4910..0f0056561 100644 @Override + public void sendActionBar(String message) { + if (getHandle().playerConnection == null || message == null || message.isEmpty()) return; -+ getHandle().playerConnection.sendPacket(new PacketPlayOutChat(net.minecraft.server.MCUtil.cmpFromMessage(message), (byte) 2)); ++ getHandle().playerConnection.sendPacket(new PacketPlayOutChat(new ChatComponentText(message), (byte) 2)); + } + + @Override