Update Paper

This commit is contained in:
Spottedleaf 2024-05-17 18:23:14 -07:00
parent 509de1c265
commit 151264ebf9
9 changed files with 168 additions and 176 deletions

View File

@ -2,7 +2,7 @@ group=dev.folia
version=1.20.6-R0.1-SNAPSHOT
mcVersion=1.20.6
paperRef=4fd58a1b8fcb4e044b87a4d4af2f20da53fdb3b3
paperRef=d8d59e0cdeda3f7e9da337b6d489f306fc5e76c9
org.gradle.caching=true
org.gradle.parallel=true

View File

@ -11,10 +11,10 @@ the schedulers depending on the result of the ownership
check.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 5d1b55fdbcbe63f6b42b694d05211a3cc691a09d..b4327a55c422380ca6b3a1dc47c3adbe76de4655 100644
index 71f1c361ebccbe83193c37ec3a90faa4085001c3..67c021f6d5d2afed92c7ceb4f511e3a43bbe2417 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2905,6 +2905,14 @@ public final class Bukkit {
@@ -2902,6 +2902,14 @@ public final class Bukkit {
return server.isOwnedByCurrentRegion(entity);
}
// Paper end - Folia region threading API

View File

@ -5,34 +5,38 @@ Subject: [PATCH] Build changes
diff --git a/build.gradle.kts b/build.gradle.kts
index 079bf6878538a1c223ac912f29f6df79a1167218..b1d621ed91c74790fd5b66339c044ec444de62ef 100644
index 4998aff0b7cb084dcda15c6a18bbe45e99b6000a..eb2f9941b24af591f1e56339b97f5284a765cf81 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -12,8 +12,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
@@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
val alsoShade: Configuration by configurations.creating
dependencies {
- implementation(project(":paper-api"))
- implementation(project(":paper-mojangapi"))
+ // Folia start
+ implementation(project(":folia-api"))
+ implementation("io.papermc.paper:paper-mojangapi:${project.version}") {
+ exclude("io.papermc.paper", "paper-api")
+ }
+ // Folia end
+ implementation(project(":folia-api")) // Folia
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -79,7 +83,7 @@ tasks.jar {
@@ -80,14 +80,14 @@ tasks.jar {
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
- "Implementation-Version" to "git-Paper-$implementationVersion",
+ "Implementation-Version" to "git-Folia-$implementationVersion", // Folia
- "Implementation-Title" to "Paper",
+ "Implementation-Title" to "Folia", // Folia
"Implementation-Version" to implementationVersion,
"Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit",
- "Specification-Title" to "Paper",
+ "Specification-Title" to "Folia", // Folia
"Specification-Version" to project.version,
@@ -138,7 +142,7 @@ fun TaskContainer.registerRunTask(
"Specification-Vendor" to "Paper Team",
- "Brand-Id" to "papermc:paper",
- "Brand-Name" to "Paper",
+ "Brand-Id" to "papermc:folia", // Folia
+ "Brand-Name" to "Folia", // Folia
"Build-Number" to (build ?: ""),
"Build-Time" to Instant.now().toString(),
"Git-Branch" to gitBranch, // Paper
@@ -144,7 +144,7 @@ fun TaskContainer.registerRunTask(
name: String,
block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) {
@ -69,55 +73,43 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..cb60d58d4a7556dd896f31d0cd249f86
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..e2f704c115fd6e00960bb56bb0779f1100c89c17 100644
index 532306cacd52579cdf37e4aca25887b1ed3ba6a1..29bd788ae8bc61c1e62a4f84b9e259931a7041ce 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -31,8 +31,8 @@ public class PaperVersionFetcher implements VersionFetcher {
@Nonnull
@Override
public Component getVersionMessage(@Nonnull String serverVersion) {
- String[] parts = serverVersion.substring("git-Paper-".length()).split("[-\\s]");
- final Component updateMessage = getUpdateStatusMessage("PaperMC/Paper", GITHUB_BRANCH_NAME, parts[0]);
+ String[] parts = serverVersion.substring("git-Folia-".length()).split("[-\\s]"); // Folia
+ final Component updateMessage = getUpdateStatusMessage("PaperMC/Folia", GITHUB_BRANCH_NAME, parts[0]); // Folia
final Component history = getHistory();
@@ -49,7 +49,7 @@ public class PaperVersionFetcher implements VersionFetcher {
if (build.buildNumber().isEmpty() && build.gitCommit().isEmpty()) {
updateMessage = text("You are running a development version without access to version information", color(0xFF5300));
} else {
- updateMessage = getUpdateStatusMessage("PaperMC/Paper", build);
+ updateMessage = getUpdateStatusMessage("PaperMC/Folia", build); // Folia
}
final @Nullable Component history = this.getHistory();
return history != null ? TextComponent.ofChildren(updateMessage, Component.newline(), history) : updateMessage;
@@ -85,7 +85,7 @@ public class PaperVersionFetcher implements VersionFetcher {
if (siteApiVersion == null) { return -1; }
@@ -86,7 +86,7 @@ public class PaperVersionFetcher implements VersionFetcher {
private static int fetchDistanceFromSiteApi(final ServerBuildInfo build, final int jenkinsBuild) {
try {
try (BufferedReader reader = Resources.asCharSource(
- new URL("https://api.papermc.io/v2/projects/paper/versions/" + siteApiVersion),
+ new URL("https://api.papermc.io/v2/projects/folia/versions/" + siteApiVersion), // Folia
try (final BufferedReader reader = Resources.asCharSource(
- URI.create("https://api.papermc.io/v2/projects/paper/versions/" + build.minecraftVersionId()).toURL(),
+ URI.create("https://api.papermc.io/v2/projects/folia/versions/" + build.minecraftVersionId()).toURL(), // Folia
Charsets.UTF_8
).openBufferedStream()) {
JsonObject json = new Gson().fromJson(reader, JsonObject.class);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8dc2f9df367c849ca333bf1a1fd92ff91617b548..5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1924,7 +1924,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
- return "Paper"; // Paper
+ return "Folia"; // Paper // Folia - Folia
}
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 57db399bc1d3b6b015740b059987bc8d9bcc3101..d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -268,7 +268,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {
- private final String serverName = "Paper"; // Paper
+ private final String serverName = "Folia"; // Folia // Paper
private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft");
final JsonObject json = new Gson().fromJson(reader, JsonObject.class);
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
index 790bad0494454ca12ee152e3de6da3da634d9b20..e741201fdbea0dbbc0e42313ebd33368014c9dc4 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
@@ -42,9 +42,9 @@ public record ServerBuildInfoImpl(
this(
getManifestAttribute(manifest, ATTRIBUTE_BRAND_ID)
.map(Key::key)
- .orElse(BRAND_PAPER_ID),
+ .orElse(Key.key("papermc", "folia")), // Folia
getManifestAttribute(manifest, ATTRIBUTE_BRAND_NAME)
- .orElse(BRAND_PAPER_NAME),
+ .orElse("Folia"), // Folia
SharedConstants.getCurrentVersion().getId(),
SharedConstants.getCurrentVersion().getName(),
getManifestAttribute(manifest, ATTRIBUTE_BUILD_NUMBER)
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
index 774556a62eb240da42e84db4502e2ed43495be17..e9b6ca3aa25e140467ae866d572483050ea3fa0e 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java

View File

@ -9355,10 +9355,10 @@ index 0000000000000000000000000000000000000000..cf9b66afc1762dbe2c625f09f9e804ca
+ }
+}
diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java
index e6c7f62ed379a78645933670299e4fcda8540ed1..c81a2a013457741302fe406ea9d1f9460bf0f48a 100644
index 59d7e8a3d83d3ab7aa28606401bb129ccaeff240..164202089b4ad0ab832a444e818ffd39aa966e70 100644
--- a/src/main/java/net/minecraft/commands/CommandSourceStack.java
+++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java
@@ -68,7 +68,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
@@ -67,7 +67,7 @@ public class CommandSourceStack implements ExecutionCommandSource<CommandSourceS
public boolean bypassSelectorPermissions = false; // Paper - add bypass for selector permissions
public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) {
@ -9368,7 +9368,7 @@ index e6c7f62ed379a78645933670299e4fcda8540ed1..c81a2a013457741302fe406ea9d1f946
protected CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity, boolean silent, CommandResultCallback resultStorer, EntityAnchorArgument.Anchor entityAnchor, CommandSigningContext signedArguments, TaskChainer messageChainTaskQueue) {
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index aa2fca6917fb67fe0e9ba067d11487c3a274f675..e53dba6d265007d556d85f6007643b26ba77083b 100644
index 24086a82e1687cb1925398218b18c2384fa8f6e3..5e5a0fea0612d9d4521f818faf7c9bd77351d379 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -160,13 +160,13 @@ public class Commands {
@ -9463,7 +9463,7 @@ index aa2fca6917fb67fe0e9ba067d11487c3a274f675..e53dba6d265007d556d85f6007643b26
SaveOffCommand.register(this.dispatcher);
SaveOnCommand.register(this.dispatcher);
SetPlayerIdleTimeoutCommand.register(this.dispatcher);
@@ -493,9 +493,12 @@ public class Commands {
@@ -506,9 +506,12 @@ public class Commands {
}
// Paper start - Perf: Async command map building
new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper - Brigadier API
@ -10070,10 +10070,10 @@ index 57e76b53e5e314c3e6b8856010f7a84188121582..9f07a1a5e2c082d16de068de6f47bf8f
}
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b403c2cb1ca 100644
index dbc86b8d4d2af6e5f7e678f2bb77fd39b85c04c5..cd63ccf69ce701079d780afaff0d784ec0e4f535 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -207,7 +207,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -204,7 +204,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private static final int OVERLOADED_TICKS_THRESHOLD = 20;
private static final long OVERLOADED_WARNING_INTERVAL_NANOS = 10L * TimeUtil.NANOSECONDS_PER_SECOND;
private static final int OVERLOADED_TICKS_WARNING_INTERVAL = 100;
@ -10082,7 +10082,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
private static final long PREPARE_LEVELS_DEFAULT_DELAY_NANOS = 10L * TimeUtil.NANOSECONDS_PER_MILLISECOND;
private static final int MAX_STATUS_PLAYER_SAMPLE = 12;
private static final int SPAWN_POSITION_SEARCH_RADIUS = 5;
@@ -244,8 +244,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -241,8 +241,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
private volatile boolean running;
private volatile boolean isRestarting = false; // Paper - flag to signify we're attempting to restart
private boolean stopped;
@ -10092,7 +10092,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
protected final Proxy proxy;
private boolean onlineMode;
private boolean preventProxyConnections;
@@ -299,7 +298,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -296,7 +295,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public org.bukkit.craftbukkit.CraftServer server;
public OptionSet options;
public org.bukkit.command.ConsoleCommandSender console;
@ -10100,8 +10100,8 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
+ //public static int currentTick; // Paper - improve tick loop // Folia - region threading
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod;
public Commands vanillaCommandDispatcher;
@@ -313,13 +312,41 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper - don't store the vanilla dispatcher
@@ -310,13 +309,41 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final double[] recentTps = new double[ 3 ];
// Spigot end
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
@ -10144,7 +10144,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system
@@ -355,7 +382,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -352,7 +379,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.port = -1;
this.levels = Maps.newLinkedHashMap();
this.running = true;
@ -10153,7 +10153,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
this.tickTimesNanos = new long[100];
this.aggregatedTickTimesNanos = 0L;
this.lastTickNanos = Util.getNanos();
@@ -649,7 +676,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -645,7 +672,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
this.addLevel(world); // Paper - Put world into worldlist before initing the world; move up
@ -10176,7 +10176,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
// Paper - Put world into worldlist before initing the world; move up
this.getPlayerList().addWorldborderListener(world);
@@ -661,6 +702,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -657,6 +698,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.forceDifficulty();
for (ServerLevel worldserver : this.getAllLevels()) {
this.prepareLevels(worldserver.getChunkSource().chunkMap.progressListener, worldserver);
@ -10184,7 +10184,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
//worldserver.entityManager.tick(); // SPIGOT-6526: Load pending entities so they are available to the API // Paper - rewrite chunk system, not required to "tick" anything
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
}
@@ -725,7 +767,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -724,7 +766,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldProperties.setSpawn(BlockPos.ZERO.above(80), 0.0F);
} else {
ServerChunkCache chunkproviderserver = world.getChunkSource();
@ -10193,7 +10193,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
// CraftBukkit start
if (world.generator != null) {
Random rand = new Random(world.getSeed());
@@ -746,6 +788,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -745,6 +787,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (i < world.getMinBuildHeight()) {
BlockPos blockposition = chunkcoordintpair.getWorldPosition();
@ -10201,7 +10201,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
i = world.getHeight(Heightmap.Types.WORLD_SURFACE, blockposition.getX() + 8, blockposition.getZ() + 8);
}
@@ -816,14 +859,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -815,14 +858,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
int i = worldserver.getGameRules().getInt(GameRules.RULE_SPAWN_CHUNK_RADIUS); // CraftBukkit - per-world
int j = i > 0 ? Mth.square(ChunkProgressListener.calculateDiameter(i)) : 0;
@ -10218,7 +10218,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
// Iterator iterator = this.levels.values().iterator();
if (true) {
@@ -845,7 +884,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -844,7 +883,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
// this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
@ -10227,7 +10227,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
// CraftBukkit end
worldloadlistener.stop();
// CraftBukkit start
@@ -949,7 +988,37 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -948,7 +987,37 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// CraftBukkit end
@ -10265,7 +10265,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
// CraftBukkit start - prevent double stopping on multiple threads
synchronized(this.stopLock) {
if (this.hasStopped) return;
@@ -959,7 +1028,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -958,7 +1027,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper start - kill main thread, and kill it hard
shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper
@ -10274,7 +10274,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
MinecraftServer.LOGGER.info("Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PAPER)");
while (this.getRunningThread().isAlive()) {
this.getRunningThread().stop();
@@ -987,12 +1056,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -986,12 +1055,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getConnection().stop();
this.isSaving = true;
if (this.playerList != null) {
@ -10296,7 +10296,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
MinecraftServer.LOGGER.info("Saving worlds");
Iterator iterator = this.getAllLevels().iterator();
@@ -1008,6 +1084,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1007,6 +1083,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.saveAllChunks(false, true, false, true); // Paper - rewrite chunk system - move closing into here
this.isSaving = false;
@ -10308,7 +10308,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
this.resources.close();
try {
@@ -1064,6 +1145,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1063,6 +1144,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
// Paper end
this.running = false;
@ -10316,7 +10316,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
if (waitForShutdown) {
try {
this.serverThread.join();
@@ -1145,10 +1227,23 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1144,10 +1226,23 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.statusIcon = (ServerStatus.Favicon) this.loadStatusIcon().orElse(null); // CraftBukkit - decompile error
this.status = this.buildServerStatus();
@ -10341,7 +10341,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
// this is going to be the first thing the tick process does anyways, so move done and run it after
// everything is init before watchdog tick.
// anything at 3+ won't be caught here but also will trip watchdog....
@@ -1201,10 +1296,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1200,10 +1295,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
// Spigot start
@ -10354,7 +10354,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
final long diff = currentTime - tickSection;
final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
tps1.add(currentTps, diff);
@@ -1224,7 +1319,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1223,7 +1318,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.debugCommandProfilerDelayStart) {
this.debugCommandProfilerDelayStart = false;
@ -10363,7 +10363,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
}
//MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time
@@ -1232,9 +1327,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1231,9 +1326,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.nextTickTimeNanos += i;
this.startMetricsRecordingTick();
this.profiler.push("tick");
@ -10374,7 +10374,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
this.profiler.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + i, this.nextTickTimeNanos);
@@ -1397,21 +1490,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1396,21 +1489,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public TickTask wrapRunnable(Runnable runnable) {
@ -10399,7 +10399,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
boolean flag = this.pollTaskInternal();
this.mayHaveDelayedTasks = flag;
@@ -1424,33 +1512,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1423,33 +1511,20 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
static final long TASK_EXECUTION_FAILURE_BACKOFF = 5L * 1000L; // 5us
@ -10441,7 +10441,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
// it's shown to be bad to constantly hit the queue (chunk loads slow to a crawl), even if no tasks are executed.
// so, backoff to prevent this
return;
@@ -1459,13 +1534,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1458,13 +1533,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming();
try {
for (;;) {
@ -10457,7 +10457,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
}
// note: negative values reduce the time
@@ -1478,7 +1553,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1477,7 +1552,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
double overuseCount = (double)overuse/(double)MAX_CHUNK_EXEC_TIME;
long extraSleep = (long)Math.round(overuseCount*CHUNK_TASK_QUEUE_BACKOFF_MIN_TIME);
@ -10466,7 +10466,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
return;
}
}
@@ -1489,6 +1564,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1488,6 +1563,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - execute chunk tasks mid tick
private boolean pollTaskInternal() {
@ -10474,7 +10474,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
if (super.pollTask()) {
this.executeMidTickTasks(); // Paper - execute chunk tasks mid tick
return true;
@@ -1511,6 +1587,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1510,6 +1586,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error
@ -10482,7 +10482,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
this.getProfiler().incrementCounter("runTask");
super.doRunTask(ticktask);
}
@@ -1557,43 +1634,83 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1556,43 +1633,83 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return false;
}
@ -10577,7 +10577,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
}
}
} finally {
@@ -1603,29 +1720,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1602,29 +1719,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - Incremental chunk and player saving
io.papermc.paper.util.CachedLists.reset(); // Paper
// Paper start - move executeAll() into full server tick timing
@ -10611,7 +10611,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot
co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper
@@ -1638,28 +1743,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1637,28 +1742,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
@ -10642,7 +10642,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
}
@@ -1667,6 +1754,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1666,6 +1753,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public abstract boolean isTickTimeLoggingEnabled();
@ -10655,7 +10655,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
private ServerStatus buildServerStatus() {
ServerStatus.Players serverping_serverpingplayersample = this.buildPlayerStatus();
@@ -1674,7 +1767,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1673,7 +1766,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
private ServerStatus.Players buildPlayerStatus() {
@ -10664,7 +10664,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
int i = this.getMaxPlayers();
if (this.hidesOnlinePlayers()) {
@@ -1695,31 +1788,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1694,31 +1787,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
@ -10702,7 +10702,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper
this.profiler.popPush("levels");
//Iterator iterator = this.getAllLevels().iterator(); // Paper - Throw exception on world create while being ticked; moved down
@@ -1727,7 +1807,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1726,7 +1806,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
// Run tasks that are waiting on processing
MinecraftTimings.processQueueTimer.startTiming(); // Spigot
@ -10711,7 +10711,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
this.processQueue.remove().run();
}
MinecraftTimings.processQueueTimer.stopTiming(); // Spigot
@@ -1735,13 +1815,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1734,13 +1814,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper
// Send time updates to everyone, it will get the right time from the world the player is in.
// Paper start - Perf: Optimize time updates
@ -10728,7 +10728,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
continue;
}
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
@@ -1754,14 +1834,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1753,14 +1833,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper end - Perf: Optimize time updates
MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
@ -10746,7 +10746,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
this.profiler.push(() -> {
String s = String.valueOf(worldserver);
@@ -1780,7 +1857,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1779,7 +1856,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
worldserver.timings.doTick.startTiming(); // Spigot
@ -10755,7 +10755,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
// Paper start
for (final io.papermc.paper.chunk.SingleThreadChunkRegionManager regionManager : worldserver.getChunkSource().chunkMap.regionManagers) {
regionManager.recalculateRegions();
@@ -1796,17 +1873,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1795,17 +1872,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.pop();
this.profiler.pop();
@ -10778,7 +10778,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
MinecraftTimings.playerListTimer.stopTiming(); // Spigot // Paper
if (SharedConstants.IS_RUNNING_IN_IDE && this.tickRateManager.runsNormally()) {
GameTestTicker.SINGLETON.tick();
@@ -1815,7 +1893,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1814,7 +1892,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.popPush("server gui refresh");
MinecraftTimings.tickablesTimer.startTiming(); // Spigot // Paper
@ -10787,7 +10787,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
((Runnable) this.tickables.get(i)).run();
}
MinecraftTimings.tickablesTimer.stopTiming(); // Spigot // Paper
@@ -1823,7 +1901,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1822,7 +1900,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.popPush("send chunks");
iterator = this.playerList.getPlayers().iterator();
@ -10796,7 +10796,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
entityplayer.connection.chunkSender.sendNextChunks(entityplayer);
@@ -2168,7 +2246,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2167,7 +2245,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public int getTickCount() {
@ -10805,7 +10805,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
}
public int getSpawnProtectionRadius() {
@@ -2223,6 +2301,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2222,6 +2300,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void invalidateStatus() {
@ -10821,7 +10821,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
this.lastServerStatus = 0L;
}
@@ -2237,6 +2324,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2236,6 +2323,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public void executeIfPossible(Runnable runnable) {
@ -10829,7 +10829,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
if (this.isStopped()) {
throw new io.papermc.paper.util.ServerStopRejectedExecutionException("Server already shutting down"); // Paper - do not prematurely disconnect players on stop
} else {
@@ -2532,7 +2620,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2540,7 +2628,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public long getAverageTickTimeNanos() {
@ -10843,7 +10843,7 @@ index 5e5eeb5c954de1db5fa8ee57d456cf46cfebfd75..240ab19712f35b6860b8a4a963a85b40
}
public long[] getTickTimesNanos() {
@@ -2900,14 +2993,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2908,14 +3001,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public ProfileResults stopTimeProfiler() {
@ -12160,10 +12160,10 @@ index 812f2adc6fc20aa126e629284fe594a923b24540..0a5e6961fb37e9a53cd39b1bd233e020
}
}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index eb4fc900164d1fb3a78653ae8bc42ea30323f5b7..05bc06fcf508e74c717a7f71a2c7ed7c568e846a 100644
index 2eb9c584cc77237f1c82d880a51a3f8b51008d73..bd333ffb44798069e180cad67c07d86425253024 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -464,9 +464,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -463,9 +463,9 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
}
@Override
@ -12176,7 +12176,7 @@ index eb4fc900164d1fb3a78653ae8bc42ea30323f5b7..05bc06fcf508e74c717a7f71a2c7ed7c
}
@Override
@@ -788,7 +788,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -787,7 +787,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
Waitable[] waitableArray = new Waitable[1]; // Paper
rconConsoleSource.prepareForCommand();
final java.util.concurrent.atomic.AtomicReference<String> command = new java.util.concurrent.atomic.AtomicReference<>(s); // Paper
@ -12185,7 +12185,7 @@ index eb4fc900164d1fb3a78653ae8bc42ea30323f5b7..05bc06fcf508e74c717a7f71a2c7ed7c
CommandSourceStack wrapper = rconConsoleSource.createCommandSourceStack();
RemoteServerCommandEvent event = new RemoteServerCommandEvent(rconConsoleSource.getBukkitSender(wrapper), s);
this.server.getPluginManager().callEvent(event);
@@ -812,7 +812,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -811,7 +811,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
ConsoleInput serverCommand = new ConsoleInput(event.getCommand(), wrapper);
this.server.dispatchServerCommand(event.getSender(), serverCommand);
} // Paper
@ -14293,7 +14293,7 @@ index ca56a0b596976448da6bb2a0e82b3d5cd4133e12..559b6d0e3611b506ff10e5ae7c42b35f
for (ServerPlayer player : ServerLevel.this.players) {
player.getBukkitEntity().onEntityRemove(entity);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 8437316888c6056060a2780652147590b6fe7443..ea396c3b2a7d738ec4331d332b5cff550c9d9ffb 100644
index c10401e587a710d49c4af481c1e531b4bf51f755..080c0128e4fab68bcf9739737a44c736e1f87bc0 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -199,7 +199,7 @@ import org.bukkit.inventory.MainHand;
@ -15039,7 +15039,7 @@ index 1351423a12c19a01f602a202832372a399e6a867..888cf5257fba032b9edd95a89e71ca8b
}
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 8ac5d8ccf731100a1be690cb2ed1be82cadba8ed..e25918c403ddcca87dd64d36b06f7466e2c99bd8 100644
index 308aef9c4933b2bcdd622a34b68efab4a220fe4d..f907dbb55369395058091dd75ae435d2025d94dd 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -107,6 +107,10 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@ -15221,7 +15221,7 @@ index 8aff5129f85ab5729b3da2e465871be62d15bdf2..8044271ff01dfc6808f5a3b60be74f6d
Collections.shuffle( this.connections );
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f6476848664b046221 100644
index b9b3277c8ed94e0cd30b20b9c00a33eaad48e5ac..b4c4e72ddd09231747f82962a9d2883c6415ce30 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -300,7 +300,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -15553,7 +15553,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866
// Evil plugins still listening to deprecated event
final PlayerChatEvent queueEvent = new PlayerChatEvent(player, event.getMessage(), event.getFormat(), event.getRecipients());
queueEvent.setCancelled(event.isCancelled());
@@ -2506,6 +2558,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2493,6 +2545,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (s.isEmpty()) {
ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send an empty message");
} else if (this.getCraftPlayer().isConversing()) {
@ -15561,7 +15561,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866
final String conversationInput = s;
this.server.processQueue.add(new Runnable() {
@Override
@@ -2741,8 +2794,25 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2724,8 +2777,25 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Spigot End
public void switchToConfig() {
@ -15588,7 +15588,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866
this.send(ClientboundStartConfigurationPacket.INSTANCE);
this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND);
}
@@ -2768,7 +2838,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2751,7 +2821,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.resetLastActionTime();
this.player.setShiftKeyDown(packet.isUsingSecondaryAction());
@ -15597,7 +15597,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866
if (!worldserver.getWorldBorder().isWithinBounds(entity.blockPosition())) {
return;
}
@@ -2912,6 +2982,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2895,6 +2965,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
switch (packetplayinclientcommand_enumclientcommand) {
case PERFORM_RESPAWN:
if (this.player.wonGame) {
@ -15610,7 +15610,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866
this.player.wonGame = false;
this.player = this.server.getPlayerList().respawn(this.player, this.server.getLevel(this.player.getRespawnDimension()), true, null, true, RespawnReason.END_PORTAL, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag.END_PORTAL); // Paper - Expand PlayerRespawnEvent
CriteriaTriggers.CHANGED_DIMENSION.trigger(this.player, Level.END, Level.OVERWORLD);
@@ -2920,6 +2996,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2903,6 +2979,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return;
}
@ -15629,7 +15629,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866
this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
if (this.server.isHardcore()) {
this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - Expand PlayerGameModeChangeEvent
@@ -3291,7 +3379,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3274,7 +3362,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start - auto recipe limit
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
@ -15638,7 +15638,7 @@ index 5e9202bc7fc649764568b55d66ba0d684118c00c..29e2a74dfbece35cd4b5c4f647684866
return;
}
}
@@ -3460,7 +3548,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3443,7 +3531,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.filterTextPacket(list).thenAcceptAsync((list1) -> {
this.updateSignText(packet, list1);
@ -16397,10 +16397,10 @@ index 99a7e9eb75231c15bd8bb24fbb4e296bc9fdedff..695f5b452d0abc4e474e8e55134a122d
public Component getDeathMessage() {
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
index 359a2f0492a9b938a4f015c546e100e0092ae1d4..6f13f96bcc401673be45c8ed62e62ca2b43ce36c 100644
index dd9638bdb228a53e72820e0e7cf6fe6fcc08fe4b..0fa04cab50f885f0e03215859c4919c843521d59 100644
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
@@ -157,13 +157,13 @@ public class DamageSource {
@@ -173,13 +173,13 @@ public class DamageSource {
LivingEntity entityliving1 = killed.getKillCredit();
String s1 = s + ".player";
@ -17437,7 +17437,7 @@ index 2bc85351e6e52f90da5fdb29d8d042a06132d742..8d3737dc1381cb0c179912c7cb215e15
/**
* Invoked only when the entity is truly removed from the server, never to be added to any world.
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 6e043457a29a890bcefd27fc5bb07c1a7e4e30f7..ed1aa10948897780aefa9a2b4034abb4c7efbb17 100644
index 517e10c3d8b1549cd30fd0e7cf2bcb35e88eb8ed..533ecd7e2666c2735483953e5a0426939e928ec5 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -256,7 +256,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -18634,10 +18634,10 @@ index 5b32364f1452e1b395b91921d045060fd94881b8..51f2ec6dd466c12282a68d07b46b8478
boolean flag = false;
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
index 1fb1e729d6879568d8b4943071fa940325b2e5b0..0c4b158d574ad0e9e257532ac3b9a3a34497216f 100644
index 519755b7f8bc7e8bb9fab135fc5bf7de3a9419f9..b3b7c61db5e640acdc9f4aa70ebf1d8b8e3ec272 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
@@ -46,6 +46,78 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
@@ -45,6 +45,78 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
entityHitResult.getEntity().hurt(this.damageSources().thrown(this, this.getOwner()), 0.0F);
}
@ -18716,7 +18716,7 @@ index 1fb1e729d6879568d8b4943071fa940325b2e5b0..0c4b158d574ad0e9e257532ac3b9a3a3
@Override
protected void onHit(HitResult hitResult) {
super.onHit(hitResult);
@@ -55,6 +127,20 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
@@ -54,6 +126,20 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
}
if (!this.level().isClientSide && !this.isRemoved()) {
@ -18737,7 +18737,7 @@ index 1fb1e729d6879568d8b4943071fa940325b2e5b0..0c4b158d574ad0e9e257532ac3b9a3a3
Entity entity = this.getOwner();
if (entity instanceof ServerPlayer) {
@@ -113,6 +199,14 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
@@ -112,6 +198,14 @@ public class ThrownEnderpearl extends ThrowableItemProjectile {
}
@ -19327,7 +19327,7 @@ index ea0aee88c7d901034427db201c1b2430f8a1d522..2a147a839e78b1d7bfb5eea869754025
return player;
}
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index dc88014c4d9f172cc54e5d77b488128f9ffbc73d..1234203335675df14aadc029792ce56ba61dbc51 100644
index 082b804f4793f72e76361f5427f0358273454b3d..f079fc7ada73dbf5cf21ae78ec4aaebdaa116b1a 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -878,17 +878,18 @@ public class Explosion {
@ -19904,7 +19904,7 @@ index 54972cce2314eff774250101df43a9b7074e9604..0c4942895a83ce1392dd1e71a00ab6d0
}
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
index 4459685d1fb655f93a523ae50b62d6b97785ed90..318e4939591cc51c0a72f82d51084d140b9d12c4 100644
index 85d598c3354ee62f0fd1b26e485e0084967c0380..8492c8fd3ff448d559b33f27b549180918aedeea 100644
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
@@ -365,7 +365,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
@ -21823,10 +21823,10 @@ index 7a69564572357a7acc043e35b9c113beeb738951..f71661ef4250d3b668fffeea7cd74a28
LevelChunkTicks<T> levelChunkTicks = this.allContainers.get(l);
if (levelChunkTicks == null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78..e4015835ebaa5fb96cbe90f7f9640fe5b5cb713e 100644
index 2fa5507aa2153a05208077f9547c165a1099b5bb..08e374191b474a1300a70096f2b0138b309e4b80 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -311,7 +311,7 @@ public final class CraftServer implements Server {
@@ -307,7 +307,7 @@ public final class CraftServer implements Server {
private final io.papermc.paper.potion.PaperPotionBrewer potionBrewer; // Paper - Custom Potion Mixes
// Paper start - Folia region threading API
@ -21835,7 +21835,7 @@ index d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78..e4015835ebaa5fb96cbe90f7f9640fe5
private final io.papermc.paper.threadedregions.scheduler.FoliaAsyncScheduler asyncScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaAsyncScheduler();
private final io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler globalRegionScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler();
@@ -379,6 +379,12 @@ public final class CraftServer implements Server {
@@ -375,6 +375,12 @@ public final class CraftServer implements Server {
return io.papermc.paper.util.TickThread.isTickThreadFor(((org.bukkit.craftbukkit.entity.CraftEntity) entity).getHandleRaw());
}
// Paper end - Folia reagion threading API
@ -21848,7 +21848,7 @@ index d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78..e4015835ebaa5fb96cbe90f7f9640fe5
static {
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
@@ -971,6 +977,9 @@ public final class CraftServer implements Server {
@@ -936,6 +942,9 @@ public final class CraftServer implements Server {
// NOTE: Should only be called from DedicatedServer.ah()
public boolean dispatchServerCommand(CommandSender sender, ConsoleInput serverCommand) {
@ -21858,7 +21858,7 @@ index d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78..e4015835ebaa5fb96cbe90f7f9640fe5
if (sender instanceof Conversable) {
Conversable conversable = (Conversable) sender;
@@ -990,12 +999,46 @@ public final class CraftServer implements Server {
@@ -955,12 +964,46 @@ public final class CraftServer implements Server {
}
}
@ -21905,7 +21905,7 @@ index d50b1f84dfb6e30fd0d0dd2ee66f874681ad6b78..e4015835ebaa5fb96cbe90f7f9640fe5
if (this.commandMap.dispatch(sender, commandLine)) {
return true;
}
@@ -3254,7 +3297,7 @@ public final class CraftServer implements Server {
@@ -3240,7 +3283,7 @@ public final class CraftServer implements Server {
@Override
public int getCurrentTick() {
@ -22706,7 +22706,7 @@ index a2d336ceb52b63db5c03432ee7bc94dc6a742b82..cf9282a46534319308e9ccf69f332a5c
// Paper end - more teleport API / async chunk API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5f896948d158651cd9837364759dbfbcce6b7d21..81f442d23582049757353d9aba02d612e6058299 100644
index 7e6116963d835d4606ef3d93b69d3e44b61288e1..c03015738313ba802436ed8a047623c02e94a06e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -647,7 +647,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -22749,7 +22749,7 @@ index 5f896948d158651cd9837364759dbfbcce6b7d21..81f442d23582049757353d9aba02d612
entry.updatePlayer(this.getHandle());
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 547ab158cd0cbf51da06ea97740cfce34bca651b..570fb9e4c6750666c8a498e896520bd4bdb3610e 100644
index 34b91eff3190848bae38b20e1d956ece497b1473..9aa832a851b78197759c6d8d5c5159f33e3870f8 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -942,7 +942,7 @@ public class CraftEventFactory {
@ -22770,7 +22770,7 @@ index 547ab158cd0cbf51da06ea97740cfce34bca651b..570fb9e4c6750666c8a498e896520bd4
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
@@ -2143,7 +2143,7 @@ public class CraftEventFactory {
@@ -2140,7 +2140,7 @@ public class CraftEventFactory {
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemStack.copyWithCount(1));
org.bukkit.event.block.BlockDispenseEvent event = new org.bukkit.event.block.BlockDispenseEvent(bukkitBlock, craftItem.clone(), CraftVector.toBukkit(to));
@ -22792,10 +22792,10 @@ index e85b9bb3f9c225d289a4959921970b9963881199..b00e3b9b628f3d2a2fdbf1d2c7790496
if (!this.isAsyncScheduler && !task.isSync()) {
this.asyncScheduler.handle(task, delay);
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index a1c9989df460d7ae3666fffe7968750832a30b85..521b9c19e3d50a0ecc59cdcce0a7d7d79544085b 100644
index 5a382907285a288f2a223189e690d3dbdf45594c..8248cd6c908c82b6b7a18df7410a9a4a46a91959 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -383,6 +383,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -387,6 +387,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
throw new InvalidPluginException("Unsupported API version " + pdf.getAPIVersion());
}

View File

@ -270,10 +270,10 @@ index ab42bc721d5b6c17c2ca6c7153b757571aea05e8..2887699c16b9452ce948f8b945c595ca
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
index af35ff560a02daca7a130322fccbb52160e2db98..e6422dd9175e1e87580c9f3930ce486d1cfe730d 100644
index 81f5e1d866128af8fb2acc13aca715580fdf9886..a1485f913ee824620083f9726fdf5812f9d2dc5f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java
@@ -27,8 +27,16 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
@@ -28,8 +28,16 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud
super(server, entity);
}
@ -324,10 +324,10 @@ index ccda0d7a96c201905f0f62dcb0e5b278a51dee9f..3ba6c46e0f5bc5f6b5994d41aaa9c4dd
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
index 62fe1ae5cfdcba84d8d1456a9939e4649aea8794..e7f6a14956d0131c2089285e6fbf0223f3e8e340 100644
index 5232fbef0d014edd32a5d18d4a1500ab215313f5..461419d42cc7fe47311d798a637cf2f2c0025364 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
@@ -25,6 +25,7 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow {
@@ -26,6 +26,7 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow {
@Override
public net.minecraft.world.entity.projectile.Arrow getHandle() {
@ -335,7 +335,7 @@ index 62fe1ae5cfdcba84d8d1456a9939e4649aea8794..e7f6a14956d0131c2089285e6fbf0223
return (net.minecraft.world.entity.projectile.Arrow) this.entity;
}
@@ -89,6 +90,13 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow {
@@ -90,6 +91,13 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow {
return true;
}
@ -347,8 +347,8 @@ index 62fe1ae5cfdcba84d8d1456a9939e4649aea8794..e7f6a14956d0131c2089285e6fbf0223
+ // Folia end - region threading
+
@Override
public void setBasePotionType(PotionType potionType) {
if (potionType != null) {
public void setBasePotionData(PotionData data) {
this.setBasePotionType(CraftPotionUtil.fromBukkit(data));
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java
index cbfca242f820d238b112f8ce64e9de8398c48a1c..c5f0cd5e69a20f1fffcd017385bf9fab59630ffc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAxolotl.java
@ -1079,10 +1079,10 @@ index 1359d25a32b4a5d5e8e68ce737bd19f7b5afaf69..0be7f84a50b7568d0c639f5906b5ca76
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
index 939a0713c74dd92273190017d3976d894f002d95..51c96a085ca8b164435bafdc4f269f43e8f8fe6d 100644
index 2124b31ca4d994ad159556d47a315004b7246265..17773f2629f372b671898640ac87021593452407 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
@@ -60,8 +60,16 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
@@ -75,8 +75,16 @@ public class CraftFireball extends AbstractProjectile implements Fireball {
}
// Paper end - Expose power on fireball projectiles
@ -1415,7 +1415,7 @@ index 37007775d27598e319c0c78929c6a808b697724a..17265ad2eaa38259f3c311c1c73576a7
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java
index 8746f80d08df5501b32958eb123aa7d814573ddf..c6c6eb55f4649e18beef9832c2ea7b9d1515666f 100644
index 9b6ff0f64966c78a3233860bb0840182b52f01bc..a9b9bebee183992d0abd4de78efae078f41fe4ec 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHorse.java
@@ -13,8 +13,16 @@ public class CraftHorse extends CraftAbstractHorse implements Horse {
@ -1693,7 +1693,7 @@ index aa351df679f300018367244c7ccb3e5a59e9276f..9a24e70d574c854fa48510603bee7b0e
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
index 0ad16ee7b33582d214dab41eeee378d52c8e38ed..874c6690ec46d482757093296bbcf1864382e13b 100644
index 351f42842b780d053cd2e5bad9ae299449141b10..6329f0b069fc03eef14e2c85525c93b47b8d3945 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java
@@ -14,8 +14,16 @@ public class CraftLlama extends CraftChestedHorse implements Llama, com.destroys
@ -2224,7 +2224,7 @@ index 2638c341bc02f201f7ab17fdebcdbdf3a7ec05bf..0f5c2d31a2dea13a46ba81e353393633
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 81f442d23582049757353d9aba02d612e6058299..92f08b13da2e13cf375d8794e54f7292140545d7 100644
index c03015738313ba802436ed8a047623c02e94a06e..96201b5b458d8e0cbebf586062fac1ec2d81fdd0 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -667,7 +667,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -2236,7 +2236,7 @@ index 81f442d23582049757353d9aba02d612e6058299..92f08b13da2e13cf375d8794e54f7292
final ServerGamePacketListenerImpl connection = this.getHandle().connection;
if (connection != null) {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause);
@@ -2294,9 +2294,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2291,9 +2291,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this;
}
@ -2254,7 +2254,7 @@ index 81f442d23582049757353d9aba02d612e6058299..92f08b13da2e13cf375d8794e54f7292
}
public void setHandle(final ServerPlayer entity) {
@@ -3332,7 +3339,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3329,7 +3336,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
{
if ( CraftPlayer.this.getHealth() <= 0 && CraftPlayer.this.isOnline() )
{
@ -2895,7 +2895,7 @@ index 5e7fef664c56d6087502e56a0eb4fc07d34ade9f..7538d449e24a8d680628f31b22924e7d
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
index 93b42b970b174b800cf89cb0d12cf3d2574323bd..e21207d107be5dcae30add4d4e68e33979020b89 100644
index 42462fac097aeb1cfd367f8c240da63f513ec5a8..bee84fee81eb8fca431d982ea88df71b3136c182 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java
@@ -61,8 +61,17 @@ public class CraftThrownPotion extends CraftThrowableProjectile implements Throw

View File

@ -10,10 +10,10 @@ the impact from scaling the region threads, but is not a fix
to the underlying issue.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 240ab19712f35b6860b8a4a963a85b403c2cb1ca..d260b41ae96eb6da429853ac115c155829a04c62 100644
index cd63ccf69ce701079d780afaff0d784ec0e4f535..b28c82e4a49ae5ae58bdb43e012afd5ef4a839f3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1522,6 +1522,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1521,6 +1521,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia end - region threading
public final void executeMidTickTasks() {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Throw UnsupportedOperationException() for broken APIs
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e4015835ebaa5fb96cbe90f7f9640fe5b5cb713e..57963e9e427e2533ae9cdbd1e98ff3dfadbdebac 100644
index 08e374191b474a1300a70096f2b0138b309e4b80..273c37b63df3f14488586f9217c7b19a8f3d8ad5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1284,6 +1284,7 @@ public final class CraftServer implements Server {
@@ -1270,6 +1270,7 @@ public final class CraftServer implements Server {
@Override
public World createWorld(WorldCreator creator) {
@ -16,7 +16,7 @@ index e4015835ebaa5fb96cbe90f7f9640fe5b5cb713e..57963e9e427e2533ae9cdbd1e98ff3df
Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP");
//Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes.
Preconditions.checkArgument(creator != null, "WorldCreator cannot be null");
@@ -1466,6 +1467,7 @@ public final class CraftServer implements Server {
@@ -1452,6 +1453,7 @@ public final class CraftServer implements Server {
@Override
public boolean unloadWorld(World world, boolean save) {

View File

@ -9,7 +9,7 @@ data deserialization and is racey even in Vanilla. But in Folia,
some accesses may throw and as such we need to fix this directly.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ea396c3b2a7d738ec4331d332b5cff550c9d9ffb..da87c4825c67e62ae238877f1fb3220f4c57f553 100644
index 080c0128e4fab68bcf9739737a44c736e1f87bc0..95b72e49469554983e07205b0bd462eec6c9fd86 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -672,7 +672,7 @@ public class ServerPlayer extends Player {
@ -22,7 +22,7 @@ index ea396c3b2a7d738ec4331d332b5cff550c9d9ffb..da87c4825c67e62ae238877f1fb3220f
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index ed1aa10948897780aefa9a2b4034abb4c7efbb17..a1e90547816ebf0811e7b22af793f40015d6c4f3 100644
index 533ecd7e2666c2735483953e5a0426939e928ec5..a7c0527dd7a8cc30bb42e7ce1342b3f11862ee81 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4382,6 +4382,11 @@ public abstract class LivingEntity extends Entity implements Attackable {

View File

@ -1376,10 +1376,10 @@ index 9f07a1a5e2c082d16de068de6f47bf8fb06ba99a..662a9e4f48cfc314b9d619a813122b1a
if (exception instanceof ReportedException) {
ReportedException reportedexception = (ReportedException) exception;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d260b41ae96eb6da429853ac115c155829a04c62..49a121862fbb823a00753d99d24d04c87479fcd1 100644
index b28c82e4a49ae5ae58bdb43e012afd5ef4a839f3..4c9c227c1395744128f347e9303f8a13667a4aa3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1638,6 +1638,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1637,6 +1637,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia start - region threading
public void tickServer(long startTime, long scheduledEnd, long targetBuffer,
io.papermc.paper.threadedregions.TickRegions.TickRegionData region) {
@ -1387,7 +1387,7 @@ index d260b41ae96eb6da429853ac115c155829a04c62..49a121862fbb823a00753d99d24d04c8
if (region != null) {
region.world.getCurrentWorldData().updateTickData();
if (region.world.checkInitialised.get() != ServerLevel.WORLD_INIT_CHECKED) {
@@ -1672,10 +1673,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1671,10 +1672,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Folia start - region threading
if (region != null) {
@ -1404,7 +1404,7 @@ index d260b41ae96eb6da429853ac115c155829a04c62..49a121862fbb823a00753d99d24d04c8
for (Entity entity : region.world.getCurrentWorldData().getLocalEntitiesCopy()) {
if (!io.papermc.paper.util.TickThread.isTickThreadFor(entity) || entity.isRemoved()) {
continue;
@@ -1683,8 +1690,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1682,8 +1689,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw();
if (bukkit != null) {
bukkit.taskScheduler.executeTick();
@ -1416,7 +1416,7 @@ index d260b41ae96eb6da429853ac115c155829a04c62..49a121862fbb823a00753d99d24d04c8
}
// Folia end - region threading
@@ -1704,6 +1714,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1703,6 +1713,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
this.profiler.push("save");
final boolean fullSave = autosavePeriod > 0 && io.papermc.paper.threadedregions.RegionizedServer.getCurrentTick() % autosavePeriod == 0; // Folia - region threading
@ -1424,7 +1424,7 @@ index d260b41ae96eb6da429853ac115c155829a04c62..49a121862fbb823a00753d99d24d04c8
try {
this.isSaving = true;
if (playerSaveInterval > 0) {
@@ -1717,6 +1728,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1716,6 +1727,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} finally {
this.isSaving = false;
}
@ -1432,7 +1432,7 @@ index d260b41ae96eb6da429853ac115c155829a04c62..49a121862fbb823a00753d99d24d04c8
this.profiler.pop();
// Paper end - Incremental chunk and player saving
io.papermc.paper.util.CachedLists.reset(); // Paper
@@ -1790,6 +1802,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1789,6 +1801,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void tickChildren(BooleanSupplier shouldKeepTicking, io.papermc.paper.threadedregions.TickRegions.TickRegionData region) { // Folia - region threading
@ -1440,7 +1440,7 @@ index d260b41ae96eb6da429853ac115c155829a04c62..49a121862fbb823a00753d99d24d04c8
final io.papermc.paper.threadedregions.RegionizedWorldData regionizedWorldData = io.papermc.paper.threadedregions.TickRegionScheduler.getCurrentRegionizedWorldData(); // Folia - regionised ticking
if (region == null) this.getPlayerList().getPlayers().forEach((entityplayer) -> { // Folia - region threading
entityplayer.connection.suspendFlushing();
@@ -1858,12 +1871,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1857,12 +1870,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
worldserver.timings.doTick.startTiming(); // Spigot
@ -1455,7 +1455,7 @@ index d260b41ae96eb6da429853ac115c155829a04c62..49a121862fbb823a00753d99d24d04c8
worldserver.timings.doTick.stopTiming(); // Spigot
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
@@ -1881,7 +1896,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1880,7 +1895,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.popPush("connection");
MinecraftTimings.connectionTimer.startTiming(); // Spigot // Paper
if (region == null) this.getConnection().tick(); // Folia - region threading