Fix javadoc errors, remove unused classes

This commit is contained in:
Nassim Jahnke 2024-01-26 21:34:40 +01:00
parent fe53b0e76f
commit 1ed50dade8
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
19 changed files with 191 additions and 1287 deletions

View File

@ -3596,7 +3596,7 @@ index 0000000000000000000000000000000000000000..b71404be2c82f7db35272b367af861e9
+}
diff --git a/src/main/java/ca/spottedleaf/concurrentutil/map/SWMRHashTable.java b/src/main/java/ca/spottedleaf/concurrentutil/map/SWMRHashTable.java
new file mode 100644
index 0000000000000000000000000000000000000000..a037bb57bedc0cde6b979f5c1f9669678fa7bd16
index 0000000000000000000000000000000000000000..4289b984badd6f9167c86193454a630b9a40f9f5
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/concurrentutil/map/SWMRHashTable.java
@@ -0,0 +1,1673 @@
@ -3724,7 +3724,7 @@ index 0000000000000000000000000000000000000000..a037bb57bedc0cde6b979f5c1f966967
+ /**
+ * Constructs this map with the specified capacity and load factor.
+ * @param capacity specified capacity, > 0
+ * @param loadFactor specified load factor, > 0 && finite
+ * @param loadFactor specified load factor, > 0 and finite
+ */
+ public SWMRHashTable(final int capacity, final float loadFactor) {
+ final int tableSize = getCapacityFor(capacity);
@ -3772,7 +3772,7 @@ index 0000000000000000000000000000000000000000..a037bb57bedc0cde6b979f5c1f966967
+ * with the specified load factor.
+ * All of the specified map's entries are copied into this map.
+ * @param capacity specified capacity, > 0
+ * @param loadFactor specified load factor, > 0 && finite
+ * @param loadFactor specified load factor, > 0 and finite
+ * @param other The specified map.
+ */
+ public SWMRHashTable(final int capacity, final float loadFactor, final Map<K, V> other) {
@ -5275,7 +5275,7 @@ index 0000000000000000000000000000000000000000..a037bb57bedc0cde6b979f5c1f966967
+}
diff --git a/src/main/java/ca/spottedleaf/concurrentutil/map/SWMRLong2ObjectHashTable.java b/src/main/java/ca/spottedleaf/concurrentutil/map/SWMRLong2ObjectHashTable.java
new file mode 100644
index 0000000000000000000000000000000000000000..1e98f778ffa0a7bb00ebccaaa8bde075183e41f0
index 0000000000000000000000000000000000000000..94fca3c9b31ca4e40688209e419e93320b0f7c34
--- /dev/null
+++ b/src/main/java/ca/spottedleaf/concurrentutil/map/SWMRLong2ObjectHashTable.java
@@ -0,0 +1,672 @@
@ -5370,7 +5370,7 @@ index 0000000000000000000000000000000000000000..1e98f778ffa0a7bb00ebccaaa8bde075
+ /**
+ * Constructs this map with the specified capacity and load factor.
+ * @param capacity specified capacity, > 0
+ * @param loadFactor specified load factor, > 0 && finite
+ * @param loadFactor specified load factor, > 0 and finite
+ */
+ public SWMRLong2ObjectHashTable(final int capacity, final float loadFactor) {
+ final int tableSize = getCapacityFor(capacity);
@ -5418,7 +5418,7 @@ index 0000000000000000000000000000000000000000..1e98f778ffa0a7bb00ebccaaa8bde075
+ * with the specified load factor.
+ * All of the specified map's entries are copied into this map.
+ * @param capacity specified capacity, > 0
+ * @param loadFactor specified load factor, > 0 && finite
+ * @param loadFactor specified load factor, > 0 and finite
+ * @param other The specified map.
+ */
+ public SWMRLong2ObjectHashTable(final int capacity, final float loadFactor, final SWMRLong2ObjectHashTable<V> other) {

View File

@ -84,7 +84,7 @@ index 809fdf2da78293391aa5c60c04f4ad652b152eec..955b0abd4019fc45df84719eee6bf413
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index b5256eefb64808ae15bd622a8eccbe13454b4564..82d5c749a70f7a808c073263e861e09913c529d4 100644
index 5f12fce84e0ec001dc43523753883a098434fcb6..d6a1b9bbf9737ed884ecf4af31e1521f46807405 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2454,7 +2454,13 @@ public final class CraftServer implements Server {
@ -103,7 +103,7 @@ index b5256eefb64808ae15bd622a8eccbe13454b4564..82d5c749a70f7a808c073263e861e099
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 686d6376322dab126393198da87e02827ec0fda2..5edad60f75a14b63ad704a68a3920f180ae82c40 100644
index c8f0570b7d37a0c0bddb0a65c36fb32de584df8f..02060584892d630d91f58e864ed34656ee738572 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -122,6 +122,7 @@ public class Main {
@ -114,6 +114,26 @@ index 686d6376322dab126393198da87e02827ec0fda2..5edad60f75a14b63ad704a68a3920f18
this.acceptsAll(Main.asList("nogui"), "Disables the graphical console");
this.acceptsAll(Main.asList("nojline"), "Disables jline and emulates the vanilla console");
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 905adf97c0d1f0d1c774a6835a5dffcfea884e58..c017ce2ca1bc535795c958a2e509af2adf88efa9 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -26,6 +26,7 @@ import org.bukkit.scheduler.BukkitWorker;
/**
* The fundamental concepts for this implementation:
+ * <ul>
* <li>Main thread owns {@link #head} and {@link #currentTick}, but it may be read from any thread</li>
* <li>Main thread exclusively controls {@link #temp} and {@link #pending}.
* They are never to be accessed outside of the main thread; alternatives exist to prevent locking.</li>
@@ -41,6 +42,7 @@ import org.bukkit.scheduler.BukkitWorker;
* <li>Sync tasks are only to be removed from runners on the main thread when coupled with a removal from pending and temp.</li>
* <li>Most of the design in this scheduler relies on queuing special tasks to perform any data changes on the main thread.
* When executed from inside a synchronous method, the scheduler will be updated before next execution by virtue of the frequent {@link #parsePending()} calls.</li>
+ * </ul>
*/
public class CraftScheduler implements BukkitScheduler {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java
index 5ac25dab93fd4c9e9533c80d1ca3d93446d7a365..245ad120a36b6defca7e6889faae1ca5fc33d0c7 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java

View File

@ -2089,7 +2089,7 @@ index 0000000000000000000000000000000000000000..a743703502cea333bd4231b6557de50e
+}
diff --git a/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java
new file mode 100644
index 0000000000000000000000000000000000000000..653cbd10c7280f3aeeaaff712d083dde461da092
index 0000000000000000000000000000000000000000..8066e27ff88454cb4bc8075d936e58a067dbe9b4
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/util/set/OptimizedSmallEnumSet.java
@@ -0,0 +1,71 @@
@ -2098,7 +2098,7 @@ index 0000000000000000000000000000000000000000..653cbd10c7280f3aeeaaff712d083dde
+import java.util.Collection;
+
+/**
+ * @author Spottedleaf <Spottedleaf@users.noreply.github.com>
+ * @author Spottedleaf &lt;Spottedleaf@users.noreply.github.com>
+ */
+public final class OptimizedSmallEnumSet<E extends Enum<E>> {
+
@ -3482,10 +3482,10 @@ index 0000000000000000000000000000000000000000..cea9c098ade00ee87b8efc8164ab72f5
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f77198de3f0692c24b3b0ae085f3a80d0
index 0000000000000000000000000000000000000000..7ae65f05eb2219a63a108728e4137b245775d08b
--- /dev/null
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -0,0 +1,533 @@
@@ -0,0 +1,532 @@
+package io.papermc.paper.util;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
@ -3800,7 +3800,6 @@ index 0000000000000000000000000000000000000000..6d60bb9f77198de3f0692c24b3b0ae08
+ * Ensures the target code is running on the main thread
+ * @param reason
+ * @param run
+ * @return
+ */
+ public static void ensureMain(String reason, Runnable run) {
+ if (!isMainThread()) {
@ -7934,10 +7933,10 @@ index bf46aa3bd46ffabe92d58aa45ea0dfe6c98d94aa..23b83f8e98d681895b4e23cda4f3d50f
if (original instanceof CraftItemStack) {
CraftItemStack stack = (CraftItemStack) original;
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 905adf97c0d1f0d1c774a6835a5dffcfea884e58..2b80ddb42c8e5fd32b37f89e894353167c8a698e 100644
index c017ce2ca1bc535795c958a2e509af2adf88efa9..0f7c3a44acf3c59ae43605e573f9da7f7c594647 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -44,6 +44,7 @@ import org.bukkit.scheduler.BukkitWorker;
@@ -46,6 +46,7 @@ import org.bukkit.scheduler.BukkitWorker;
*/
public class CraftScheduler implements BukkitScheduler {
@ -7945,7 +7944,7 @@ index 905adf97c0d1f0d1c774a6835a5dffcfea884e58..2b80ddb42c8e5fd32b37f89e89435316
/**
* The start ID for the counter.
*/
@@ -192,6 +193,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -194,6 +195,11 @@ public class CraftScheduler implements BukkitScheduler {
this.runTaskTimer(plugin, (Object) task, delay, period);
}
@ -7957,7 +7956,7 @@ index 905adf97c0d1f0d1c774a6835a5dffcfea884e58..2b80ddb42c8e5fd32b37f89e89435316
public BukkitTask runTaskTimer(Plugin plugin, Object runnable, long delay, long period) {
CraftScheduler.validate(plugin, runnable);
if (delay < 0L) {
@@ -415,13 +421,20 @@ public class CraftScheduler implements BukkitScheduler {
@@ -417,13 +423,20 @@ public class CraftScheduler implements BukkitScheduler {
task.run();
task.timings.stopTiming(); // Spigot
} catch (final Throwable throwable) {

View File

@ -1838,7 +1838,7 @@ index f53e223e2412846b82298233459ec9953bc0a63e..87e7071a381540be3b1db55f5d606e9e
public Player.Spigot spigot()
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 2b80ddb42c8e5fd32b37f89e894353167c8a698e..bd1057681d0c7470c497b873ff18abf03a0a6a66 100644
index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad0f25cc0d 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -1,5 +1,6 @@
@ -1848,7 +1848,7 @@ index 2b80ddb42c8e5fd32b37f89e894353167c8a698e..bd1057681d0c7470c497b873ff18abf0
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.ArrayList;
@@ -194,7 +195,8 @@ public class CraftScheduler implements BukkitScheduler {
@@ -196,7 +197,8 @@ public class CraftScheduler implements BukkitScheduler {
}
public BukkitTask scheduleInternalTask(Runnable run, int delay, String taskName) {
@ -1858,7 +1858,7 @@ index 2b80ddb42c8e5fd32b37f89e894353167c8a698e..bd1057681d0c7470c497b873ff18abf0
return handle(task, delay);
}
@@ -275,7 +277,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -277,7 +279,7 @@ public class CraftScheduler implements BukkitScheduler {
}
return false;
}
@ -1867,7 +1867,7 @@ index 2b80ddb42c8e5fd32b37f89e894353167c8a698e..bd1057681d0c7470c497b873ff18abf0
this.handle(task, 0L);
for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) {
@@ -310,7 +312,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -312,7 +314,7 @@ public class CraftScheduler implements BukkitScheduler {
}
}
}
@ -1876,7 +1876,7 @@ index 2b80ddb42c8e5fd32b37f89e894353167c8a698e..bd1057681d0c7470c497b873ff18abf0
this.handle(task, 0L);
for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) {
if (taskPending == task) {
@@ -417,9 +419,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -419,9 +421,7 @@ public class CraftScheduler implements BukkitScheduler {
if (task.isSync()) {
this.currentTask = task;
try {
@ -1886,7 +1886,7 @@ index 2b80ddb42c8e5fd32b37f89e894353167c8a698e..bd1057681d0c7470c497b873ff18abf0
} catch (final Throwable throwable) {
// Paper start
String msg = String.format(
@@ -453,8 +453,10 @@ public class CraftScheduler implements BukkitScheduler {
@@ -455,8 +455,10 @@ public class CraftScheduler implements BukkitScheduler {
this.runners.remove(task.getTaskId());
}
}
@ -1897,7 +1897,7 @@ index 2b80ddb42c8e5fd32b37f89e894353167c8a698e..bd1057681d0c7470c497b873ff18abf0
this.debugHead = this.debugHead.getNextHead(currentTick);
}
@@ -491,6 +493,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -493,6 +495,7 @@ public class CraftScheduler implements BukkitScheduler {
}
private void parsePending() {
@ -1905,7 +1905,7 @@ index 2b80ddb42c8e5fd32b37f89e894353167c8a698e..bd1057681d0c7470c497b873ff18abf0
CraftTask head = this.head;
CraftTask task = head.getNext();
CraftTask lastTask = head;
@@ -509,6 +512,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -511,6 +514,7 @@ public class CraftScheduler implements BukkitScheduler {
task.setNext(null);
}
this.head = lastTask;

View File

@ -192,10 +192,10 @@ index d9daf07132c46548964a75588b69d7a74680e917..66994aa135037919219e0bbcabe7de9f
try {
filechannel.close();
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index bd1057681d0c7470c497b873ff18abf03a0a6a66..f39c836970572fe2e29e794a6af35332af8f7424 100644
index a3ccc2da0927cc49e5fcfbd863e648ad0f25cc0d..dc7872afbdd06eb976bee6aee56a40b44084c24a 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -434,6 +434,8 @@ public class CraftScheduler implements BukkitScheduler {
@@ -436,6 +436,8 @@ public class CraftScheduler implements BukkitScheduler {
msg,
throwable);
}
@ -204,7 +204,7 @@ index bd1057681d0c7470c497b873ff18abf03a0a6a66..f39c836970572fe2e29e794a6af35332
// Paper end
} finally {
this.currentTask = null;
@@ -441,7 +443,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -443,7 +445,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending();
} else {
this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass()));

View File

@ -9,10 +9,10 @@ One report of a suspected memory leak with the system.
This adds additional overhead to asynchronous task dispatching
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index f39c836970572fe2e29e794a6af35332af8f7424..b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2 100644
index dc7872afbdd06eb976bee6aee56a40b44084c24a..af3997e47aff9c43dc5019f1b0267effe1df5205 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -442,7 +442,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -444,7 +444,7 @@ public class CraftScheduler implements BukkitScheduler {
}
this.parsePending();
} else {
@ -21,7 +21,7 @@ index f39c836970572fe2e29e794a6af35332af8f7424..b1e61ce608eeacdbb70849c1e3e39daf
this.executor.execute(new com.destroystokyo.paper.ServerSchedulerReportingWrapper(task)); // Paper
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
@@ -459,7 +459,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -461,7 +461,7 @@ public class CraftScheduler implements BukkitScheduler {
this.pending.addAll(temp);
temp.clear();
MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper
@ -30,7 +30,7 @@ index f39c836970572fe2e29e794a6af35332af8f7424..b1e61ce608eeacdbb70849c1e3e39daf
}
private void addTask(final CraftTask task) {
@@ -523,10 +523,15 @@ public class CraftScheduler implements BukkitScheduler {
@@ -525,10 +525,15 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public String toString() {

View File

@ -546,7 +546,7 @@ index 0000000000000000000000000000000000000000..7ac27392a8647ef7d0dc78efe78703e9
+ @NotNull GameProfile buildGameProfile();
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
index 6d60bb9f77198de3f0692c24b3b0ae085f3a80d0..e5a7a77fda0c7e81c8535ef8cfaca2222b0d79fb 100644
index 7ae65f05eb2219a63a108728e4137b245775d08b..b08190d604f7f95f771a4da115cc50c38c5f1691 100644
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -1,5 +1,7 @@
@ -565,7 +565,7 @@ index 6d60bb9f77198de3f0692c24b3b0ae085f3a80d0..e5a7a77fda0c7e81c8535ef8cfaca222
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftWorld;
@@ -361,6 +364,10 @@ public final class MCUtil {
@@ -360,6 +363,10 @@ public final class MCUtil {
return run.get();
}
@ -612,7 +612,7 @@ index adb472c175cc6f6ced7075a37423d6c898fd5ccb..1ec0f3a7148c2f412421772f6e1dff0b
String s1 = name.toLowerCase(Locale.ROOT);
GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 883c053baea5968a978f1619ebb170647fe15eef..22f5ff1e6f03fc46eb05eaf95ca6f8e2bac1f894 100644
index e7ad8c2d40568a243b6d3b2a28065083802afe5d..5c9415a5771191b7e3fec02f5a9ad569e735c4aa 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -260,6 +260,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException;

View File

@ -159,10 +159,10 @@ index 0000000000000000000000000000000000000000..3c1992e212a6d6f1db4d5b807b38d719
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc163a4a0f 100644
index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30bfe61bd0 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -75,7 +75,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -77,7 +77,7 @@ public class CraftScheduler implements BukkitScheduler {
/**
* Main thread logic only
*/
@ -171,7 +171,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
new Comparator<CraftTask>() {
@Override
public int compare(final CraftTask o1, final CraftTask o2) {
@@ -92,12 +92,13 @@ public class CraftScheduler implements BukkitScheduler {
@@ -94,12 +94,13 @@ public class CraftScheduler implements BukkitScheduler {
/**
* These are tasks that are currently active. It's provided for 'viewing' the current state.
*/
@ -187,7 +187,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
private final Executor executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %d").build());
private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) {
@Override
@@ -106,12 +107,31 @@ public class CraftScheduler implements BukkitScheduler {
@@ -108,12 +109,31 @@ public class CraftScheduler implements BukkitScheduler {
}
};
private CraftAsyncDebugger debugTail = this.debugHead;
@ -219,7 +219,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
@Override
public int scheduleSyncDelayedTask(final Plugin plugin, final Runnable task) {
return this.scheduleSyncDelayedTask(plugin, task, 0L);
@@ -234,7 +254,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -236,7 +256,7 @@ public class CraftScheduler implements BukkitScheduler {
} else if (period < CraftTask.NO_REPEATING) {
period = CraftTask.NO_REPEATING;
}
@ -228,7 +228,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
}
@Override
@@ -250,6 +270,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -252,6 +272,11 @@ public class CraftScheduler implements BukkitScheduler {
if (taskId <= 0) {
return;
}
@ -240,7 +240,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
CraftTask task = this.runners.get(taskId);
if (task != null) {
task.cancel0();
@@ -292,6 +317,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -294,6 +319,11 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public void cancelTasks(final Plugin plugin) {
Preconditions.checkArgument(plugin != null, "Cannot cancel tasks of null plugin");
@ -252,7 +252,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
final CraftTask task = new CraftTask(
new Runnable() {
@Override
@@ -331,6 +361,13 @@ public class CraftScheduler implements BukkitScheduler {
@@ -333,6 +363,13 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public boolean isCurrentlyRunning(final int taskId) {
@ -266,7 +266,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
final CraftTask task = this.runners.get(taskId);
if (task == null) {
return false;
@@ -349,6 +386,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -351,6 +388,11 @@ public class CraftScheduler implements BukkitScheduler {
if (taskId <= 0) {
return false;
}
@ -278,7 +278,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
for (CraftTask task = this.head.getNext(); task != null; task = task.getNext()) {
if (task.getTaskId() == taskId) {
return task.getPeriod() >= CraftTask.NO_REPEATING; // The task will run
@@ -360,6 +402,12 @@ public class CraftScheduler implements BukkitScheduler {
@@ -362,6 +404,12 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public List<BukkitWorker> getActiveWorkers() {
@ -291,7 +291,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
final ArrayList<BukkitWorker> workers = new ArrayList<BukkitWorker>();
for (final CraftTask taskObj : this.runners.values()) {
// Iterator will be a best-effort (may fail to grab very new values) if called from an async thread
@@ -397,6 +445,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -399,6 +447,11 @@ public class CraftScheduler implements BukkitScheduler {
pending.add(task);
}
}
@ -303,7 +303,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
return pending;
}
@@ -404,6 +457,11 @@ public class CraftScheduler implements BukkitScheduler {
@@ -406,6 +459,11 @@ public class CraftScheduler implements BukkitScheduler {
* This method is designed to never block or wait for locks; an immediate execution of all current tasks.
*/
public void mainThreadHeartbeat(final int currentTick) {
@ -315,7 +315,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
this.currentTick = currentTick;
final List<CraftTask> temp = this.temp;
this.parsePending();
@@ -443,7 +501,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -445,7 +503,7 @@ public class CraftScheduler implements BukkitScheduler {
this.parsePending();
} else {
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
@ -324,7 +324,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
// We don't need to parse pending
// (async tasks must live with race-conditions if they attempt to cancel between these few lines of code)
}
@@ -462,7 +520,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -464,7 +522,7 @@ public class CraftScheduler implements BukkitScheduler {
//this.debugHead = this.debugHead.getNextHead(currentTick); // Paper
}
@ -333,7 +333,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
final AtomicReference<CraftTask> tail = this.tail;
CraftTask tailTask = tail.get();
while (!tail.compareAndSet(tailTask, task)) {
@@ -471,7 +529,13 @@ public class CraftScheduler implements BukkitScheduler {
@@ -473,7 +531,13 @@ public class CraftScheduler implements BukkitScheduler {
tailTask.setNext(task);
}
@ -348,7 +348,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
task.setNextRun(this.currentTick + delay);
this.addTask(task);
return task;
@@ -494,8 +558,8 @@ public class CraftScheduler implements BukkitScheduler {
@@ -496,8 +560,8 @@ public class CraftScheduler implements BukkitScheduler {
return id;
}
@ -359,7 +359,7 @@ index b1e61ce608eeacdbb70849c1e3e39daf37b3f2a2..215310984100722757d9dd38182f7cbc
CraftTask head = this.head;
CraftTask task = head.getNext();
CraftTask lastTask = head;
@@ -514,7 +578,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -516,7 +580,7 @@ public class CraftScheduler implements BukkitScheduler {
task.setNext(null);
}
this.head = lastTask;

View File

@ -13,10 +13,10 @@ Shulkers) may need to be changed in order for it to re-save properly
No more crashing though.
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
index e5a7a77fda0c7e81c8535ef8cfaca2222b0d79fb..ff8a983e23bcf73ec3f7dd98c48640183647ad4d 100644
index b08190d604f7f95f771a4da115cc50c38c5f1691..8235d23dc9778b9444288d58ffdb5d515df56bf9 100644
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -537,4 +537,19 @@ public final class MCUtil {
@@ -536,4 +536,19 @@ public final class MCUtil {
public static int getTicketLevelFor(net.minecraft.world.level.chunk.ChunkStatus status) {
return net.minecraft.server.level.ChunkMap.MAX_VIEW_DISTANCE + net.minecraft.world.level.chunk.ChunkStatus.getDistance(status);
}

View File

@ -7,10 +7,10 @@ Subject: [PATCH] Fix CraftScheduler#runTaskTimerAsynchronously(Plugin,
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index 215310984100722757d9dd38182f7cbc163a4a0f..acb2af336184c0215c409c748b56fddd8d1fb4be 100644
index c6ce8ed5fa73ee6221332083b3376b30bfe61bd0..71a147df3bcbd5bb82934da3e6e14326746cf2e3 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -196,7 +196,7 @@ public class CraftScheduler implements BukkitScheduler {
@@ -198,7 +198,7 @@ public class CraftScheduler implements BukkitScheduler {
@Override
public void runTaskTimerAsynchronously(Plugin plugin, Consumer<? super BukkitTask> task, long delay, long period) throws IllegalArgumentException {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add getMainThreadExecutor to BukkitScheduler
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
index acb2af336184c0215c409c748b56fddd8d1fb4be..700932b65e4fda560d684b0aa079bcee3923f73e 100644
index 71a147df3bcbd5bb82934da3e6e14326746cf2e3..e85b9bb3f9c225d289a4959921970b9963881199 100644
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
@@ -651,4 +651,15 @@ public class CraftScheduler implements BukkitScheduler {
@@ -653,4 +653,15 @@ public class CraftScheduler implements BukkitScheduler {
public BukkitTask runTaskTimerAsynchronously(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException {
throw new UnsupportedOperationException("Use BukkitRunnable#runTaskTimerAsynchronously(Plugin, long, long)");
}

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ Subject: [PATCH] incremental chunk and player saving
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index b27cdfd527d9234b51eba7bb642968fa886d460e..a0972ad233ce1582fd4d054eba282d47ddbc10d3 100644
index 365b11eb92e76cda975a5989a556abcf4c8fdaa4..0b1de9a1b7ae9ed7a938b8f3482d82a106644b7a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -908,7 +908,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -17,7 +17,7 @@ index b27cdfd527d9234b51eba7bb642968fa886d460e..a0972ad233ce1582fd4d054eba282d47
flag3 = this.saveAllChunks(suppressLogs, flush, force);
} finally {
this.isSaving = false;
@@ -1387,16 +1387,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1388,16 +1388,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
--this.ticksUntilAutosave;

View File

@ -71,7 +71,7 @@ index 6f2452de76e8f5fcc1367066e0e753740764eb98..e047dee632022abfe05865d1e71838be
cause = cause.getCause();
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 18a3d611b141b79683af7241e3c0598320f27516..39352b74491a799f12667e2a8578ed08042d84cd 100644
index b7e6533ab3eb0898b053b11ed782aaa503bdde58..e530f4b4a9f097e0a54b56d0f33a7d05a93c67f0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -296,7 +296,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -121,14 +121,14 @@ index 18a3d611b141b79683af7241e3c0598320f27516..39352b74491a799f12667e2a8578ed08
// CraftBukkit end
if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics();
@@ -997,7 +1014,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getProfileCache().save(false); // Paper - Perf: Async GameProfileCache saving
@@ -998,7 +1015,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Spigot end
+ // Paper start - move final shutdown items here
+ LOGGER.info("Flushing Chunk IO");
+ // Paper end - move final shutdown items here
io.papermc.paper.chunk.system.io.RegionFileIOThread.close(true); // Paper // Paper - rewrite chunk system
io.papermc.paper.chunk.system.io.RegionFileIOThread.close(true); // Paper - rewrite chunk system
+ // Paper start - move final shutdown items here
+ LOGGER.info("Closing Thread Pool");
+ Util.shutdownExecutors(); // Paper
@ -143,7 +143,7 @@ index 18a3d611b141b79683af7241e3c0598320f27516..39352b74491a799f12667e2a8578ed08
}
public String getLocalIp() {
@@ -1094,6 +1125,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1095,6 +1126,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected void runServer() {
try {
@ -151,7 +151,7 @@ index 18a3d611b141b79683af7241e3c0598320f27516..39352b74491a799f12667e2a8578ed08
if (!this.initServer()) {
throw new IllegalStateException("Failed to initialize server");
}
@@ -1103,6 +1135,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1104,6 +1136,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.status = this.buildServerStatus();
// Spigot start
@ -170,7 +170,7 @@ index 18a3d611b141b79683af7241e3c0598320f27516..39352b74491a799f12667e2a8578ed08
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( this.recentTps, 20 );
// Paper start - further improve server tick loop
@@ -1184,6 +1228,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1185,6 +1229,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis);
}
} catch (Throwable throwable) {
@ -183,7 +183,7 @@ index 18a3d611b141b79683af7241e3c0598320f27516..39352b74491a799f12667e2a8578ed08
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);
CrashReport crashreport = MinecraftServer.constructOrExtractCrashReport(throwable);
@@ -1208,15 +1258,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1209,15 +1259,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.services.profileCache().clearExecutor();
}
@ -203,7 +203,7 @@ index 18a3d611b141b79683af7241e3c0598320f27516..39352b74491a799f12667e2a8578ed08
}
}
@@ -1285,6 +1335,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1286,6 +1336,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public TickTask wrapRunnable(Runnable runnable) {
@ -216,7 +216,7 @@ index 18a3d611b141b79683af7241e3c0598320f27516..39352b74491a799f12667e2a8578ed08
return new TickTask(this.tickCount, runnable);
}
@@ -2110,7 +2166,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2111,7 +2167,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.worldData.setDataConfiguration(worlddataconfiguration);
this.resources.managers.updateRegistryTags(this.registryAccess());
net.minecraft.world.item.alchemy.PotionBrewing.reload(); // Paper - Custom Potion Mixes

View File

@ -19,10 +19,10 @@ index 6b3cde6d4d1e63bec01f502f2027ee9fddac08aa..46449728f69ee7d4f78470f8da23c055
private MinecraftTimings() {}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 39352b74491a799f12667e2a8578ed08042d84cd..ddbce431af1eb13ad135f7cd36f0c3c6430a5ae4 100644
index e530f4b4a9f097e0a54b56d0f33a7d05a93c67f0..6498e05e45468979bc5140e54920ed9c528c19bd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1356,8 +1356,79 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1357,8 +1357,79 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return flag;
}

View File

@ -2613,7 +2613,7 @@ index cc888bbcd6a50124fa553bc4a8ffd1e8885d3856..f42dd9602805e9d538506ee4e3eac7e2
// Paper start - Affects Spawning API
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index fd3828d2074c7e369dbea6a25d9bac436f624750..5e6caf9ca811a2fbca4ac93f6c61d3d8606e02db 100644
index fd3828d2074c7e369dbea6a25d9bac436f624750..d5ccc0e74397359fbcd2907dbf9249eca0fd5acf 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -299,6 +299,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -2627,7 +2627,7 @@ index fd3828d2074c7e369dbea6a25d9bac436f624750..5e6caf9ca811a2fbca4ac93f6c61d3d8
}
// Paper start - Cancel hit for vanished players
@@ -340,6 +344,370 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -340,6 +344,366 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return true;
}
// Paper end - Cancel hit for vanished players
@ -2799,10 +2799,6 @@ index fd3828d2074c7e369dbea6a25d9bac436f624750..5e6caf9ca811a2fbca4ac93f6c61d3d8
+ }
+ }
+
+ /**
+ * @reason Route to optimized call
+ * @author Spottedleaf
+ */
+ @Override
+ public final net.minecraft.world.phys.BlockHitResult clip(final ClipContext clipContext) {
+ // can only do this in this class, as not everything that implements BlockGetter can retrieve chunks
@ -2998,7 +2994,7 @@ index fd3828d2074c7e369dbea6a25d9bac436f624750..5e6caf9ca811a2fbca4ac93f6c61d3d8
@Override
public boolean isClientSide() {
return this.isClientSide;
@@ -963,7 +1331,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -963,7 +1327,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override
public boolean noCollision(@Nullable Entity entity, AABB box) {
if (entity instanceof net.minecraft.world.entity.decoration.ArmorStand && !entity.level().paperConfig().entities.armorStands.doCollisionEntityLookups) return false;

View File

@ -2034,10 +2034,10 @@ index 5eaf8585df1f885f4a08fdd06ff4bb730961e400..ab2e84f85da7931e133ad5f0d2686cd1
EntityCallbacks() {}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 5e6caf9ca811a2fbca4ac93f6c61d3d8606e02db..b33bb001a48788e727e2f01788a6163024121bf3 100644
index d5ccc0e74397359fbcd2907dbf9249eca0fd5acf..8f437225d2a4e08ca47873cd42277d9f0f9f5529 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1896,4 +1896,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1892,4 +1892,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return ret;
}
// Paper end

View File

@ -50,10 +50,10 @@ index 0000000000000000000000000000000000000000..5c42823726e70ce6c9d0121d07431548
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ddbce431af1eb13ad135f7cd36f0c3c6430a5ae4..5c26ccc4d58254afce7ece906600a86364e01af8 100644
index 6498e05e45468979bc5140e54920ed9c528c19bd..a7fb5d121a9fd59d5a3951075e975533721cb87f 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1690,6 +1690,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1691,6 +1691,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - BlockPhysicsEvent

View File

@ -8,7 +8,7 @@ Areas affected by lag comepnsation:
- Eating food items
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5c26ccc4d58254afce7ece906600a86364e01af8..fa2b4cdd4c4e2c1df3e378a7c706f06c3361ad53 100644
index a7fb5d121a9fd59d5a3951075e975533721cb87f..90ae7e8c81f6a9ede8aeaeec3bf784023522cefc 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -311,6 +311,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -19,7 +19,7 @@ index 5c26ccc4d58254afce7ece906600a86364e01af8..fa2b4cdd4c4e2c1df3e378a7c706f06c
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
@@ -1689,6 +1690,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1690,6 +1691,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Iterator iterator = this.getAllLevels().iterator(); // Paper - Throw exception on world create while being ticked; move down
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();