aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAikar <[email protected]>2016-05-16 20:50:09 -0400
committerAikar <[email protected]>2016-05-16 20:50:09 -0400
commit484a23f437f9f44b8ab6321eb11801b5840773ce (patch)
tree1d88cb6571cb64168c016482d8b545eeca96555f
parent7e5d36ded5cb2743da9b52911bb5a06842e6d6df (diff)
downloadPaper-484a23f437f9f44b8ab6321eb11801b5840773ce.tar.gz
Paper-484a23f437f9f44b8ab6321eb11801b5840773ce.zip
Add Async Helper method to MCUtil
-rw-r--r--Spigot-Server-Patches/0004-MC-Utils.patch18
1 files changed, 15 insertions, 3 deletions
diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch
index 82d244906f..74da3f8683 100644
--- a/Spigot-Server-Patches/0004-MC-Utils.patch
+++ b/Spigot-Server-Patches/0004-MC-Utils.patch
@@ -1,4 +1,4 @@
-From 09eb35c8f468ea83f5595c8e6e2b89614628641b Mon Sep 17 00:00:00 2001
+From a3e63b2551a8b3dfabbc600ea7e5e72763ec6888 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Mon, 28 Mar 2016 20:55:47 -0400
Subject: [PATCH] MC Utils
@@ -7,19 +7,23 @@ Collection of utils to help reduce NMS diff
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..cf7c48f
+index 0000000..8643312
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MCUtil.java
-@@ -0,0 +1,142 @@
+@@ -0,0 +1,154 @@
+package net.minecraft.server;
+
++import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import org.bukkit.Location;
+
+import javax.annotation.Nullable;
++import java.util.concurrent.Executor;
++import java.util.concurrent.Executors;
+import java.util.regex.Pattern;
+
+public final class MCUtil {
+ private static final Pattern REPLACE_QUOTES = Pattern.compile("\"");
++ private static final Executor asyncExecutor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Paper Async Task Handler Thread - %1$d").build());
+
+ private MCUtil() {}
+
@@ -152,6 +156,14 @@ index 0000000..cf7c48f
+ @Nullable public static Chunk getLoadedChunkWithoutMarkingActive(IChunkProvider provider, int x, int z) {
+ return ((ChunkProviderServer)provider).chunks.get(ChunkCoordIntPair.a(x, z));
+ }
++
++ /**
++ * Posts a task to be executed asynchronously
++ * @param run
++ */
++ public static void scheduleAsyncTask(Runnable run) {
++ asyncExecutor.execute(run);
++ }
+}
diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java
index c01cecb..7fa49dd 100644