aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAikar <[email protected]>2019-03-26 01:39:57 -0400
committerAikar <[email protected]>2019-03-26 01:39:57 -0400
commit5e4ae76bc3e57f2a779dcf5a5c1c666758ebaf49 (patch)
treeca45aa20af34b9c5637dadc0eecb31aa344c526d
parent1073a39560a522a2e6e66b506582d68ac70673c9 (diff)
downloadPaper-5e4ae76bc3e57f2a779dcf5a5c1c666758ebaf49.tar.gz
Paper-5e4ae76bc3e57f2a779dcf5a5c1c666758ebaf49.zip
Fix null task issue with timings
-rw-r--r--Spigot-API-Patches/0003-Timings-v2.patch8
-rw-r--r--Spigot-Server-Patches/0009-Timings-v2.patch21
2 files changed, 16 insertions, 13 deletions
diff --git a/Spigot-API-Patches/0003-Timings-v2.patch b/Spigot-API-Patches/0003-Timings-v2.patch
index 3c181c5f12..1ddd82ab94 100644
--- a/Spigot-API-Patches/0003-Timings-v2.patch
+++ b/Spigot-API-Patches/0003-Timings-v2.patch
@@ -1,4 +1,4 @@
-From 5ecd59c7f8a08d76faaa561f750665fd4ed6f18d Mon Sep 17 00:00:00 2001
+From 39d1fdb91886c053e524bfc65ee8ce80ad364bb4 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Mon, 29 Feb 2016 18:48:17 -0600
Subject: [PATCH] Timings v2
@@ -93,10 +93,10 @@ index 00000000..597d39a3
+}
diff --git a/src/main/java/co/aikar/timings/NullTimingHandler.java b/src/main/java/co/aikar/timings/NullTimingHandler.java
new file mode 100644
-index 00000000..8c43e206
+index 00000000..3222c8c2
--- /dev/null
+++ b/src/main/java/co/aikar/timings/NullTimingHandler.java
-@@ -0,0 +1,61 @@
+@@ -0,0 +1,63 @@
+/*
+ * This file is licensed under the MIT License (MIT).
+ *
@@ -123,6 +123,8 @@ index 00000000..8c43e206
+package co.aikar.timings;
+
+public final class NullTimingHandler implements Timing {
++ public static final Timing NULL = new NullTimingHandler();
++
+ @Override
+ public Timing startTiming() {
+ return this;
diff --git a/Spigot-Server-Patches/0009-Timings-v2.patch b/Spigot-Server-Patches/0009-Timings-v2.patch
index 98549a69a3..1bf6c3f78b 100644
--- a/Spigot-Server-Patches/0009-Timings-v2.patch
+++ b/Spigot-Server-Patches/0009-Timings-v2.patch
@@ -1,4 +1,4 @@
-From 7e842b6dd25d4f24f0109bcc0a403066220c9795 Mon Sep 17 00:00:00 2001
+From 5c2b7e485fb417cedb926d24b98af63c462aa607 Mon Sep 17 00:00:00 2001
From: Aikar <[email protected]>
Date: Thu, 3 Mar 2016 04:00:11 -0600
Subject: [PATCH] Timings v2
@@ -6,7 +6,7 @@ Subject: [PATCH] Timings v2
diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java
new file mode 100644
-index 000000000..c6405aa1b
+index 000000000..baea97382
--- /dev/null
+++ b/src/main/java/co/aikar/timings/MinecraftTimings.java
@@ -0,0 +1,128 @@
@@ -63,7 +63,7 @@ index 000000000..c6405aa1b
+ */
+ public static Timing getPluginTaskTimings(BukkitTask bukkitTask, long period) {
+ if (!bukkitTask.isSync()) {
-+ return null;
++ return NullTimingHandler.NULL;
+ }
+ Plugin plugin;
+
@@ -1770,12 +1770,13 @@ index f11bd7545..93b9134d6 100644
private boolean isReady(final int currentTick) {
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
-index 7e7ce9a81..f688a796d 100644
+index 7e7ce9a81..70252ef30 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java
-@@ -1,8 +1,8 @@
+@@ -1,8 +1,9 @@
package org.bukkit.craftbukkit.scheduler;
++import co.aikar.timings.NullTimingHandler;
import org.bukkit.Bukkit;
-import org.bukkit.craftbukkit.SpigotTimings; // Spigot
-import org.spigotmc.CustomTimingsHandler; // Spigot
@@ -1784,7 +1785,7 @@ index 7e7ce9a81..f688a796d 100644
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitTask;
-@@ -25,11 +25,11 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
+@@ -25,11 +26,11 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
*/
private volatile long period;
private long nextRun;
@@ -1798,7 +1799,7 @@ index 7e7ce9a81..f688a796d 100644
CraftTask() {
this(null, null, CraftTask.NO_REPEATING, CraftTask.NO_REPEATING);
}
-@@ -38,26 +38,12 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
+@@ -38,26 +39,12 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
this(null, task, CraftTask.NO_REPEATING, CraftTask.NO_REPEATING);
}
@@ -1823,11 +1824,11 @@ index 7e7ce9a81..f688a796d 100644
- CraftTask(final Plugin plugin, final Runnable task, final int id, final long period) {
- this(null, plugin, task, id, period);
- // Spigot end
-+ timings = task != null ? MinecraftTimings.getPluginTaskTimings(this, period) : null; // Paper
++ timings = task != null ? MinecraftTimings.getPluginTaskTimings(this, period) : NullTimingHandler.NULL; // Paper
}
public final int getTaskId() {
-@@ -73,7 +59,9 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
+@@ -73,7 +60,9 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
}
public void run() {
@@ -1838,7 +1839,7 @@ index 7e7ce9a81..f688a796d 100644
}
long getPeriod() {
-@@ -122,13 +110,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
+@@ -122,13 +111,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot
setPeriod(CraftTask.CANCEL);
return true;
}