and some more patches

This commit is contained in:
Jake Potrebic 2023-09-21 21:05:18 -07:00
parent 2bc818efd4
commit 24fd5aea0c
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
51 changed files with 189 additions and 189 deletions

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent
This will allow you to change the players name or skin on login.
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 1202a60cf955dbfbfc2135c06d3304f215b23c2c..1b00de7f44169a10702dab64c4b4f40e08afd3f9 100644
index 1202a60cf955dbfbfc2135c06d3304f215b23c2c..41de3c342f1dae9fc6af1b4938a676d337bcf5fa 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -292,8 +292,16 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@ -20,9 +20,9 @@ index 1202a60cf955dbfbfc2135c06d3304f215b23c2c..1b00de7f44169a10702dab64c4b4f40e
server.getPluginManager().callEvent(asyncEvent);
+ profile = asyncEvent.getPlayerProfile();
+ profile.complete();
+ gameProfile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
+ playerName = gameProfile.getName();
+ uniqueId = gameProfile.getId();
+ gameprofile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
+ playerName = gameprofile.getName();
+ uniqueId = gameprofile.getId();
+ // Paper end
if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {

View File

@ -22,7 +22,7 @@ index c14ebcc46c033834a14de5d6335a4dcc7830069d..6ad9b294aadf96465834cde1ff1cda17
if (Float.isNaN(f)) {
f = 0;
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 1b00de7f44169a10702dab64c4b4f40e08afd3f9..69564543d143c697db0ffee959c41a2163371bbe 100644
index 41de3c342f1dae9fc6af1b4938a676d337bcf5fa..f870c20ecce27ebd893107a35e1b8f15e462ff85 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -293,11 +293,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@ -30,15 +30,15 @@ index 1b00de7f44169a10702dab64c4b4f40e08afd3f9..69564543d143c697db0ffee959c41a21
// Paper start
- com.destroystokyo.paper.profile.PlayerProfile profile = org.bukkit.Bukkit.createProfile(uniqueId, playerName);
+ com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile);
+ com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(gameprofile);
AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile);
server.getPluginManager().callEvent(asyncEvent);
profile = asyncEvent.getPlayerProfile();
- profile.complete();
+ profile.complete(true); // Paper - setPlayerProfileAPI
gameProfile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
playerName = gameProfile.getName();
uniqueId = gameProfile.getId();
gameprofile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
playerName = gameprofile.getName();
uniqueId = gameprofile.getId();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
index b17fe83bcd7bde44ee8c1f872fffa8bf40707c50..aac78c13361b19efa7b43a0c95458390f1ba8340 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 732238a60dacd83b6572f6f79763f112e5fe9611..17886c426f4d95a71e034b4fd24c2b6e5cf5bc45 100644
index 717f23a92017a589e639c09e15377e30f602d8fe..1f5d20f46ac358855f857a2c5fb348233b56bf2e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -969,7 +969,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -859,7 +859,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handlePickItem(ServerboundPickItemPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose game version
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 4d003aa1066a1fd56683be9ebe4095dddcb1ed83..6c50a39f96700352a3cde0aed953b138193605fb 100644
index 712bee34303ca3ceec4520e265f4defdc27ea8ff..3597b4f98c73b781a3f2389e563e3dc2c2f711fe 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -582,6 +582,13 @@ public final class CraftServer implements Server {
@@ -585,6 +585,13 @@ public final class CraftServer implements Server {
return this.bukkitVersion;
}

View File

@ -17,7 +17,7 @@ keeping long lived large direct buffers in cache.
Set system properly at server startup if not set already to help protect from this.
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index f847527bf22fa34817dee79e61a47545b1e1f7bc..3250274384fabb11e241837007e543cb81dd3b6d 100644
index c561677e81095ab6735d81a414a249838b135f7a..224be855fd16b37c8766c3c07b81905d50d5518d 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -26,6 +26,7 @@ public class Main {

View File

@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 047562e1df93347f629b529ca0647697e22ecf48..8b1a92c1a0e9505ebc11de0e6b54b48343ef8e60 100644
index d50878653132218dd494e0e5ed6fc3a32d4f1465..ad7f14d78fea3e6aba9576114463907b292c45a0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -887,6 +887,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -862,6 +862,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
private boolean hasStopped = false;
public volatile boolean hasFullyShutdown = false; // Paper
@ -40,7 +40,7 @@ index 047562e1df93347f629b529ca0647697e22ecf48..8b1a92c1a0e9505ebc11de0e6b54b483
private final Object stopLock = new Object();
public final boolean hasStopped() {
synchronized (this.stopLock) {
@@ -901,6 +902,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -876,6 +877,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hasStopped) return;
this.hasStopped = true;
}
@ -48,7 +48,7 @@ index 047562e1df93347f629b529ca0647697e22ecf48..8b1a92c1a0e9505ebc11de0e6b54b483
// Paper start - kill main thread, and kill it hard
shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper
@@ -1003,6 +1005,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1004,6 +1006,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
public void safeShutdown(boolean waitForShutdown, boolean isRestarting) {
this.isRestarting = isRestarting;
@ -57,27 +57,27 @@ index 047562e1df93347f629b529ca0647697e22ecf48..8b1a92c1a0e9505ebc11de0e6b54b483
// Paper end
this.running = false;
if (waitForShutdown) {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 0c7f280bae81bbb492d5780a43e5ffda0f58756a..238a7bc87ab49da1f0fa3c733dd512fdffbd8ffc 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -183,6 +183,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
} catch (Exception exception) {
ServerLoginPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
MutableComponent ichatmutablecomponent = Component.translatable("multiplayer.disconnect.invalid_player_data");
+ // Paper start
+ if (MinecraftServer.getServer().isDebugging()) {
+ exception.printStackTrace();
+ }
+ // Paper end
this.connection.send(new ClientboundDisconnectPacket(ichatmutablecomponent));
this.connection.disconnect(ichatmutablecomponent);
diff --git a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
index ea26375d6f23b14a8a1cd926fe410713551de99d..496ac1d2fd43c5ddfe7fa7a8b72a75860ec43443 100644
--- a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
@@ -130,6 +130,11 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
this.connection.resumeInboundAfterProtocolChange();
} catch (Exception exception) {
ServerConfigurationPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
+ // Paper start
+ if (MinecraftServer.getServer().isDebugging()) {
+ exception.printStackTrace();
+ }
+ // Paper end
this.connection.send(new ClientboundDisconnectPacket(ServerConfigurationPacketListenerImpl.DISCONNECT_REASON_INVALID_DATA));
this.connection.disconnect(ServerConfigurationPacketListenerImpl.DISCONNECT_REASON_INVALID_DATA);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6c50a39f96700352a3cde0aed953b138193605fb..0b57122e8c684a41b1163c95ee322adbdb81f7c3 100644
index 3597b4f98c73b781a3f2389e563e3dc2c2f711fe..64663e74d85979f857d748f0c252c0568f5d95ae 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1006,6 +1006,7 @@ public final class CraftServer implements Server {
@@ -1009,6 +1009,7 @@ public final class CraftServer implements Server {
plugin.getDescription().getFullName(),
"This plugin is not properly shutting down its async tasks when it is being reloaded. This may cause conflicts with the newly loaded version of the plugin"
));

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 17886c426f4d95a71e034b4fd24c2b6e5cf5bc45..b20da25677ea5e69d6994b8dbe5ad0ee8e096039 100644
index 1f5d20f46ac358855f857a2c5fb348233b56bf2e..7f4bae60e44d9624871b5b447ea2df11f95d82fe 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1617,6 +1617,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1507,6 +1507,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) { // Paper

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Deobfuscate stacktraces in log messages, crash reports, and
diff --git a/build.gradle.kts b/build.gradle.kts
index eecadeb81317834741b083fe8c5da77519d196a3..f037aff2f85f5ece47198f3957689a589045a95b 100644
index 7f005b9a41064f1929e8d9cb53c5ab207d3a333d..dfb43cf7be60733f3ab142de66139971bca1b1fe 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -37,6 +37,7 @@ dependencies {
@ -14,8 +14,8 @@ index eecadeb81317834741b083fe8c5da77519d196a3..f037aff2f85f5ece47198f3957689a58
implementation("org.spongepowered:configurate-yaml:4.1.2") // Paper - config files
implementation("commons-lang:commons-lang:2.6")
+ implementation("net.fabricmc:mapping-io:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
runtimeOnly("org.xerial:sqlite-jdbc:3.42.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.0.33")
runtimeOnly("org.xerial:sqlite-jdbc:3.43.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.1.0")
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
@@ -121,6 +122,18 @@ tasks.check {
}
@ -470,7 +470,7 @@ index 2d5494d2813b773e60ddba6790b750a9a08f21f8..0b210bdf7c1f5962afbd44195af6f84f
}
}
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index 30a58229aa6dac5039511d0c0df5f2912ea7de9f..abe37c7c3c6f5ab73afd738ec78f06d7e4d2ed96 100644
index 226cba0c1eeedd9e80acd603c46b802c183db1fa..1d714d3eff11ed14f218656008190017494d4830 100644
--- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java
@@ -32,6 +32,7 @@ public class CrashReport {
@ -494,27 +494,27 @@ index 52eb3176437113f9a0ff85d10ce5c2415e1b5570..b54ddd0ba0b001fbcb1838a838ca4890
}
}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 99d5fd192a4cf1ac2739520a111b8dd854ff2f57..dc3dea801a673462e767ad37268ec77ac95d214c 100644
index 62df5c51fa11f85ec2fad20c0ea5aa6241294e8a..81e49a770fd8a10e987f3e67a5ab99fc39d5e47f 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -64,13 +64,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
});
public static final AttributeKey<ConnectionProtocol> ATTRIBUTE_PROTOCOL = AttributeKey.valueOf("protocol");
public static final LazyLoadedValue<NioEventLoopGroup> NETWORK_WORKER_GROUP = new LazyLoadedValue<>(() -> {
@@ -75,13 +75,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
public static final AttributeKey<ConnectionProtocol.CodecData<?>> ATTRIBUTE_SERVERBOUND_PROTOCOL = AttributeKey.valueOf("serverbound_protocol");
public static final AttributeKey<ConnectionProtocol.CodecData<?>> ATTRIBUTE_CLIENTBOUND_PROTOCOL = AttributeKey.valueOf("clientbound_protocol");
public static final Supplier<NioEventLoopGroup> NETWORK_WORKER_GROUP = Suppliers.memoize(() -> {
- return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Client IO #%d").setDaemon(true).build());
+ return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Client IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper
});
public static final LazyLoadedValue<EpollEventLoopGroup> NETWORK_EPOLL_WORKER_GROUP = new LazyLoadedValue<>(() -> {
public static final Supplier<EpollEventLoopGroup> NETWORK_EPOLL_WORKER_GROUP = Suppliers.memoize(() -> {
- return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Client IO #%d").setDaemon(true).build());
+ return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Client IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper
});
public static final LazyLoadedValue<DefaultEventLoopGroup> LOCAL_WORKER_GROUP = new LazyLoadedValue<>(() -> {
public static final Supplier<DefaultEventLoopGroup> LOCAL_WORKER_GROUP = Suppliers.memoize(() -> {
- return new DefaultEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Client IO #%d").setDaemon(true).build());
+ return new DefaultEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Client IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper
});
private final PacketFlow receiving;
private final Queue<Connection.PacketHolder> queue = Queues.newConcurrentLinkedQueue();
@@ -205,7 +205,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
private final Queue<Consumer<Connection>> pendingActions = Queues.newConcurrentLinkedQueue();
@@ -195,7 +195,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
}
@ -524,7 +524,7 @@ index 99d5fd192a4cf1ac2739520a111b8dd854ff2f57..dc3dea801a673462e767ad37268ec77a
protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet<?> packet) {
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index ba75c854faed13c60ae5464c4685373b99ef42c2..a3e839c8166a7fee282a764127d76cf0232e6c38 100644
index f72c1a4baff6ac9a3b1df83ece3925e2b1678df9..967817ad15146407668361a85c89be6beb6a73f9 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -195,6 +195,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -536,7 +536,7 @@ index ba75c854faed13c60ae5464c4685373b99ef42c2..a3e839c8166a7fee282a764127d76cf0
paperConfigurations.initializeWorldDefaultsConfiguration();
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash);
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2838e035204e95defce0d7488248b2e57bf71fab..e96890be7f03b7cc846fe850d4169e09b5d40eab 100644
index 4307b72acc389ccab97b2b7f3f824ddeca5a3cda..6bb7f2050e93f63045ea608672751da28138d3f8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -221,7 +221,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -550,7 +550,7 @@ index 2838e035204e95defce0d7488248b2e57bf71fab..e96890be7f03b7cc846fe850d4169e09
}
@Override public LevelChunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI
@@ -1467,7 +1469,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1235,7 +1237,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (entity.isRemoved()) {
// Paper start
if (DEBUG_ENTITIES) {
@ -559,41 +559,41 @@ index 2838e035204e95defce0d7488248b2e57bf71fab..e96890be7f03b7cc846fe850d4169e09
getAddToWorldStackTrace(entity).printStackTrace();
}
// Paper end
diff --git a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
index 496ac1d2fd43c5ddfe7fa7a8b72a75860ec43443..6c2a5b2cb57fe799cc1c5002662894ad6e2b22aa 100644
--- a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
@@ -132,7 +132,7 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
ServerConfigurationPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
// Paper start
if (MinecraftServer.getServer().isDebugging()) {
- exception.printStackTrace();
+ io.papermc.paper.util.TraceUtil.printStackTrace(exception);
}
// Paper end
this.connection.send(new ClientboundDisconnectPacket(ServerConfigurationPacketListenerImpl.DISCONNECT_REASON_INVALID_DATA));
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index fbf375534e2b8bd6ef052c4625764f4f8feb2ed6..bb9e65eee7e0ca0f715cd5791c47579a57b1b577 100644
index d870fbec236a3660f12e0f45cf9431067b18468b..c98d3c5afcce17a6f13f8d456b9f77b1f2a4f3f0 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -51,10 +51,10 @@ public class ServerConnectionListener {
@@ -52,10 +52,10 @@ public class ServerConnectionListener {
private static final Logger LOGGER = LogUtils.getLogger();
public static final LazyLoadedValue<NioEventLoopGroup> SERVER_EVENT_GROUP = new LazyLoadedValue<>(() -> {
public static final Supplier<NioEventLoopGroup> SERVER_EVENT_GROUP = Suppliers.memoize(() -> {
- return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).build());
+ return new NioEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Server IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper
});
public static final LazyLoadedValue<EpollEventLoopGroup> SERVER_EPOLL_EVENT_GROUP = new LazyLoadedValue<>(() -> {
public static final Supplier<EpollEventLoopGroup> SERVER_EPOLL_EVENT_GROUP = Suppliers.memoize(() -> {
- return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).build());
+ return new EpollEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Epoll Server IO #%d").setDaemon(true).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(LOGGER)).build()); // Paper
});
final MinecraftServer server;
public volatile boolean running;
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 238a7bc87ab49da1f0fa3c733dd512fdffbd8ffc..9858f907e58fa606510f87efbdf8793c35ec711c 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -185,7 +185,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
MutableComponent ichatmutablecomponent = Component.translatable("multiplayer.disconnect.invalid_player_data");
// Paper start
if (MinecraftServer.getServer().isDebugging()) {
- exception.printStackTrace();
+ io.papermc.paper.util.TraceUtil.printStackTrace(exception);
}
// Paper end
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
index 6599f874d9f97e9ef4862039ecad7277bbc5fd91..7edd4b88eb0476f0630630bc4681e859bd145b2b 100644
index 5db27d7bcaaa2eeaeeb08401513d8d23f6cb63c7..ce43cb0152ba07c6c21e08142d65813d47c3b63b 100644
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
+++ b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
@@ -364,7 +364,7 @@ public class OldUsersConverter {
@@ -359,7 +359,7 @@ public class OldUsersConverter {
try {
root = NbtIo.readCompressed(new java.io.FileInputStream(file5));
} catch (Exception exception) {
@ -602,7 +602,7 @@ index 6599f874d9f97e9ef4862039ecad7277bbc5fd91..7edd4b88eb0476f0630630bc4681e859
ServerInternalException.reportInternalException(exception); // Paper
}
@@ -378,7 +378,7 @@ public class OldUsersConverter {
@@ -373,7 +373,7 @@ public class OldUsersConverter {
try {
NbtIo.writeCompressed(root, new java.io.FileOutputStream(file2));
} catch (Exception exception) {
@ -612,7 +612,7 @@ index 6599f874d9f97e9ef4862039ecad7277bbc5fd91..7edd4b88eb0476f0630630bc4681e859
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 246606164117e8140ab0892ec1326503b414a1ab..4d052f4cde791100f04b822899f0f436feaa23ea 100644
index c9a6a56dfd25601bc0a11e5ddb349dba372c0e18..9cb4c145a36de0fe5be148b854ebb6f2a8446f49 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -603,7 +603,7 @@ public class LevelChunk extends ChunkAccess {
@ -641,10 +641,10 @@ index 3c1992e212a6d6f1db4d5b807b38d71913619fc0..9c1aff17aabd062640e3f451a2ef8c50
CraftAsyncScheduler() {
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index a9bd33b58a6a3296b70eaaaea3adbee74724e448..7071327fab87d53e794374c701d7c2748c439aaa 100644
index e71041d41eae31cce73d8817c4f95f16c8c600aa..71dbda5ae954b31ca3915de8823b552a09dfcab8 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -105,7 +105,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -105,7 +105,7 @@ public class WatchdogThread extends Thread
log.log( Level.SEVERE, "During the run of the server, a plugin set an excessive velocity on an entity" );
log.log( Level.SEVERE, "This may be the cause of the issue, or it may be entirely unrelated" );
log.log( Level.SEVERE, org.bukkit.craftbukkit.CraftServer.excessiveVelEx.getMessage());
@ -653,7 +653,7 @@ index a9bd33b58a6a3296b70eaaaea3adbee74724e448..7071327fab87d53e794374c701d7c274
{
log.log( Level.SEVERE, "\t\t" + stack );
}
@@ -192,7 +192,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -191,7 +191,7 @@ public class WatchdogThread extends Thread
}
log.log( Level.SEVERE, "\tStack:" );
//

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API
diff --git a/build.gradle.kts b/build.gradle.kts
index f037aff2f85f5ece47198f3957689a589045a95b..d1f2469815cc0dd742777b18421db7d83deac83f 100644
index dfb43cf7be60733f3ab142de66139971bca1b1fe..b81b99a7767e3b0d3549e49529e98efdb7334101 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -46,6 +46,7 @@ dependencies {
@ -792,10 +792,10 @@ index 4379b9948f1eecfe6fd7dea98e298ad5f761019a..3f081183521603824430709886a9cc31
LOOK,
JUMP,
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0b57122e8c684a41b1163c95ee322adbdb81f7c3..d07c3a06ab9e6f65090b8df999b7edcfc1b32727 100644
index 64663e74d85979f857d748f0c252c0568f5d95ae..5918b0296cf011f562e219984e6ad12a975318fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2774,5 +2774,11 @@ public final class CraftServer implements Server {
@@ -2777,5 +2777,11 @@ public final class CraftServer implements Server {
public boolean isStopping() {
return net.minecraft.server.MinecraftServer.getServer().hasStopped();
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Option for maximum exp value when merging orbs
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 81c77354a856956283fc149980a9a09e99b544f5..f120e9f2fa6919419f354f164d415a16a19ea9b0 100644
index 0b45481cdbbfbe4e1756e19e696e1c11d8fccd00..b71024ebd675f4afd7ad2aa96393532758a28b63 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -686,16 +686,30 @@ public class CraftEventFactory {
@@ -688,16 +688,30 @@ public class CraftEventFactory {
net.minecraft.world.entity.ExperienceOrb xp = (net.minecraft.world.entity.ExperienceOrb) entity;
double radius = world.spigotConfig.expMerge;
if (radius > 0) {

View File

@ -9,10 +9,10 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor
metadata such as spawn reason, or conditionally move data from source to target.
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index f120e9f2fa6919419f354f164d415a16a19ea9b0..10eb0eed4bf0cc93e4e32c282735c2863f10837c 100644
index b71024ebd675f4afd7ad2aa96393532758a28b63..7aba049b426a25981376205410acf41327993d30 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -696,7 +696,7 @@ public class CraftEventFactory {
@@ -698,7 +698,7 @@ public class CraftEventFactory {
if (e instanceof net.minecraft.world.entity.ExperienceOrb) {
net.minecraft.world.entity.ExperienceOrb loopItem = (net.minecraft.world.entity.ExperienceOrb) e;
// Paper start

View File

@ -5,15 +5,15 @@ Subject: [PATCH] Fix PotionEffect ignores icon flag
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index f0457dd3d179dab3e164279f30690058549e530a..5e874253a150bda008d8da29691ddeaad0fee1de 100644
index 607e48cf2eb50f477bcacca636cacf27f01342ef..02b7780a05f0119c2d1e9d379321105822629793 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -443,7 +443,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public boolean addPotionEffect(PotionEffect effect, boolean force) {
- this.getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
+ this.getHandle().addEffect(new MobEffectInstance(MobEffect.byId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon
- this.getHandle().addEffect(new MobEffectInstance(CraftPotionEffectType.bukkitToMinecraft(effect.getType()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
+ this.getHandle().addEffect(new MobEffectInstance(CraftPotionEffectType.bukkitToMinecraft(effect.getType()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon
return true;
}

View File

@ -8,7 +8,7 @@ Adds a new method to fetch the location of a player's bed without generating any
getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index ec7ea1ef632bea761ca8b9603059a12fb72dfa47..63208cf28a7ea005f9f328281676ed113ae23a00 100644
index 872adf91703baa24d67f417e7a45309f92984da9..80694a1d660a10909408c9b3169dda7847bf295e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -12,6 +12,7 @@ import net.minecraft.nbt.CompoundTag;

View File

@ -10,22 +10,22 @@ Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8b1a92c1a0e9505ebc11de0e6b54b48343ef8e60..ccf238c12c416e2aa7ee83a14bbbb96f5b2f8b51 100644
index ad7f14d78fea3e6aba9576114463907b292c45a0..020c6ee8df9a97ca84f1fb36b03abfcd5df24744 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -927,6 +927,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -902,6 +902,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
+ this.server.waitForAsyncTasksShutdown(); // Paper
}
// CraftBukkit end
if (this.getConnection() != null) {
this.getConnection().stop();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d07c3a06ab9e6f65090b8df999b7edcfc1b32727..7909cf20ab3cd4948ed13c6eba0cdf503b557a70 100644
index 5918b0296cf011f562e219984e6ad12a975318fb..4c4cee10d688aa0a3aab29f42c4cd8fd22488796 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1016,6 +1016,31 @@ public final class CraftServer implements Server {
@@ -1019,6 +1019,31 @@ public final class CraftServer implements Server {
org.spigotmc.WatchdogThread.hasStarted = true; // Paper - Disable watchdog early timeout on reload
}

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Ensure EntityRaider respects game and entity rules for
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
index d8834abadc82617a2d09506432102211ea99b0b7..06d4c1787b1ee4976e6ed1773d3ff7130aebc2d0 100644
index b35fcab88e9fd883a854c6861b6c69d725105539..49e07b33fccfe339712e5d1bd72e6c0edbd2e922 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -312,6 +312,7 @@ public abstract class Raider extends PatrollingMonster {

View File

@ -13,10 +13,10 @@ A config is provided if you rather let players use these exploits, and let
them destroy the worlds End Portals and get on top of the nether easy.
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 75d827f1eecb24f7ab985bdea2bbf65b8478fc8c..d646660f988994d4fdb05901349c5946a2f6c48c 100644
index c0227cda09b9ca508c1de1fbe1e57afd743a9426..93529defa5d36bb9b4c69eedda9b7ac3d0a189ce 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -168,6 +168,7 @@ public class Explosion {
@@ -169,6 +169,7 @@ public class Explosion {
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
BlockPos blockposition = BlockPos.containing(d4, d5, d6);
BlockState iblockdata = this.level.getBlockState(blockposition);
@ -24,7 +24,7 @@ index 75d827f1eecb24f7ab985bdea2bbf65b8478fc8c..d646660f988994d4fdb05901349c5946
FluidState fluid = iblockdata.getFluidState(); // Paper
if (!this.level.isInWorldBounds(blockposition)) {
@@ -369,7 +370,7 @@ public class Explosion {
@@ -371,7 +372,7 @@ public class Explosion {
}
// CraftBukkit end
@ -34,10 +34,10 @@ index 75d827f1eecb24f7ab985bdea2bbf65b8478fc8c..d646660f988994d4fdb05901349c5946
this.level.getProfiler().push("explosion_blocks");
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 52a44510d0499df56d2ebef0963fe8164eda7301..221a1e66814dda35feff9fa9ca0fe54feec335f9 100644
index 8b0c85d341c75e86421fc7c72aefcce83a165075..ea11bea03a15bfd79b82da60c48bfb23a44acda4 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -518,6 +518,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -516,6 +516,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {
@ -73,7 +73,7 @@ index 7646b66bc5ba0288608de0d836c7307e02eebe67..36b196c8834c4eb873bfca0b12f1fc2b
public co.aikar.timings.Timing getTiming() {
if (timing == null) {
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index 9e70f5ba6ff0935d245f357131b062c1cc7058fc..4f6b7ed4809086811f0460544ba2ec0606f0f5da 100644
index 6c90a37f8f98be975b9f961259aaadd03b091760..7248a8c51d0e285e2296826e48782f721265605b 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
@@ -199,6 +199,12 @@ public class PistonBaseBlock extends DirectionalBlock {
@ -115,7 +115,7 @@ index 9e70f5ba6ff0935d245f357131b062c1cc7058fc..4f6b7ed4809086811f0460544ba2ec06
world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 2451bb61e304fbe5cdfd6bbb248575e9e1135075..74f84bfcb1da6186c7a6783512c2fc7ba995215f 100644
index 916d7b35145345cb3bf5ca46df38eae0512c4e95..a5942b6683d38f067f8ca1dfbe467b72df242632 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -229,7 +229,7 @@ public abstract class BlockBehaviour implements FeatureElement {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Fix villager trading demand - MC-163962
Prevent demand from going negative and tending to negative infinity
diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
index 67f34a1670cb51a3d2aca3140800ad9b92533d84..dc5908374565dd3080679779cbfe7620a4810015 100644
index a580011cd3b2b7129f2d09f37a3c26cdaafeefe8..1d755d04515f20dbd69931084b4cc894e52d35c9 100644
--- a/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
+++ b/src/main/java/net/minecraft/world/item/trading/MerchantOffer.java
@@ -115,7 +115,7 @@ public class MerchantOffer {
@@ -130,7 +130,7 @@ public class MerchantOffer {
}
public void updateDemand() {

View File

@ -15,7 +15,7 @@ Previously maps would load all chunks in a certain radius depending on
five ticks that movement occur in anyways.
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index 9b55b04ab2769c6089d16a9c7bc61ca41683559f..7a5e5fa67ed5625cfbe74ba8ea8810095100e836 100644
index 592bdf191f8787cf35d8844f66371c92179545ad..709928f6220c2148f95afa94c34df2a87cff0e1f 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -134,9 +134,9 @@ public class MapItem extends ComplexItem {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index 7a5e5fa67ed5625cfbe74ba8ea8810095100e836..75b110c6fb685390306fe3b8504aeea9bd6deedd 100644
index 709928f6220c2148f95afa94c34df2a87cff0e1f..53515854d05a0c27a65f71193424236a21b11f5f 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -250,14 +250,13 @@ public class MapItem extends ComplexItem {

View File

@ -32,18 +32,18 @@ This patch fixes https://bugs.mojang.com/browse/MC-188840
This patch also fixes rail duping and carpet duping.
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index 4f6b7ed4809086811f0460544ba2ec0606f0f5da..e14967a745c21ff48a88fa0f22cc296a73b43d92 100644
index 7248a8c51d0e285e2296826e48782f721265605b..48ee146dea30f7d8c48c6bee7a1547ad2a69959d 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
@@ -412,14 +412,26 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -413,14 +413,26 @@ public class PistonBaseBlock extends DirectionalBlock {
}
for (k = list.size() - 1; k >= 0; --k) {
- blockposition3 = (BlockPos) list.get(k);
for (j = list.size() - 1; j >= 0; --j) {
- blockposition3 = (BlockPos) list.get(j);
- iblockdata1 = world.getBlockState(blockposition3);
+ // Paper start - fix a variety of piston desync dupes
+ boolean allowDesync = io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPistonDuplication;
+ BlockPos oldPos = blockposition3 = (BlockPos) list.get(k);
+ BlockPos oldPos = blockposition3 = (BlockPos) list.get(j);
+ iblockdata1 = allowDesync ? world.getBlockState(oldPos) : null;
+ // Paper end - fix a variety of piston desync dupes
blockposition3 = blockposition3.relative(enumdirection1);
@ -51,18 +51,18 @@ index 4f6b7ed4809086811f0460544ba2ec0606f0f5da..e14967a745c21ff48a88fa0f22cc296a
BlockState iblockdata2 = (BlockState) Blocks.MOVING_PISTON.defaultBlockState().setValue(PistonBaseBlock.FACING, dir);
world.setBlock(blockposition3, iblockdata2, 68);
- world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockposition3, iblockdata2, (BlockState) list1.get(k), dir, retract, false));
- world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockposition3, iblockdata2, (BlockState) list1.get(j), dir, retract, false));
+ // Paper start - fix a variety of piston desync dupes
+ if (!allowDesync) {
+ iblockdata1 = world.getBlockState(oldPos);
+ map.replace(oldPos, iblockdata1);
+ }
+ world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockposition3, iblockdata2, allowDesync ? list1.get(k) : iblockdata1, dir, retract, false));
+ world.setBlockEntity(MovingPistonBlock.newMovingBlockEntity(blockposition3, iblockdata2, allowDesync ? list1.get(j) : iblockdata1, dir, retract, false));
+ if (!allowDesync) {
+ world.setBlock(oldPos, Blocks.AIR.defaultBlockState(), Block.UPDATE_CLIENTS | Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_MOVE_BY_PISTON | 1024); // set air to prevent later physics updates from seeing this block
+ }
+ // Paper end - fix a variety of piston desync dupes
aiblockdata[j++] = iblockdata1;
aiblockdata[i++] = iblockdata1;
}
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java

View File

@ -7,7 +7,7 @@ If the falling block dies during teleportation (entity#move), then we need
to detect that by placing a check after the move.
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 5b37b5c45bad8d8d262f46a117e3fc858cb40485..562462729d0262bac5968583b064124167437449 100644
index b8c8b10656e4151c8c19b8cecc3bc7502dd57d3d..c64dcceabc41c11542b535d104b7f43172032842 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -131,6 +131,11 @@ public class FallingBlockEntity extends Entity {

View File

@ -14,10 +14,10 @@ behaviour, we need to move all of this dangerous logic outside
of the move call and into an appropriate place in the tick method.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b20da25677ea5e69d6994b8dbe5ad0ee8e096039..b9fdfa115262a1f16a2bbffa373c3438b38adbb3 100644
index 7f4bae60e44d9624871b5b447ea2df11f95d82fe..0790b86a4cb1068041d8e94aef84067b3039a055 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1443,6 +1443,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -1333,6 +1333,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.move(MoverType.PLAYER, new Vec3(d6, d7, d8));
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b9fdfa115262a1f16a2bbffa373c3438b38adbb3..cff8b643efadcc153b03af1335885376746b48be 100644
index 0790b86a4cb1068041d8e94aef84067b3039a055..f16327556a5302c319b164897d2c5b3b4883ed31 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3096,16 +3096,40 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -2951,16 +2951,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!this.player.containerMenu.stillValid(this.player)) {
ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
} else {
@ -37,18 +37,18 @@ index b9fdfa115262a1f16a2bbffa373c3438b38adbb3..cff8b643efadcc153b03af1335885376
+ recipeName = CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey());
+ makeAll = event.isShiftClick();
+ }
+ if (!(this.player.containerMenu instanceof RecipeBookMenu<?>)) {
+ if (!(this.player.containerMenu instanceof RecipeBookMenu<?> recipeBookMenu)) {
+ return;
+ }
+ // Paper end
// Cast to keyed should be safe as the recipe will never be a MerchantRecipe.
- this.server.getRecipeManager().byKey(CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey())).ifPresent((irecipe) -> {
- ((RecipeBookMenu) this.player.containerMenu).handlePlacement(event.isShiftClick(), irecipe, this.player);
- this.server.getRecipeManager().byKey(CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey())).ifPresent((recipeholder) -> {
- ((RecipeBookMenu) this.player.containerMenu).handlePlacement(event.isShiftClick(), recipeholder, this.player);
+ // Paper start
+ final boolean finalMakeAll = makeAll;
+ this.server.getRecipeManager().byKey(recipeName).ifPresent((irecipe) -> {
+ ((RecipeBookMenu) this.player.containerMenu).handlePlacement(finalMakeAll, irecipe, this.player);
+ this.server.getRecipeManager().byKey(recipeName).ifPresent((recipeholder) -> {
+ recipeBookMenu.handlePlacement(finalMakeAll, recipeholder, this.player);
+ // Paper end
});
// CraftBukkit end

View File

@ -9,10 +9,10 @@ on harddrives.
-DPaper.enable-sync-chunk-writes=true to enable
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
index d144fc518442762e45f213550a9b0a21f77fcdd1..818289e831e3dad29345c43265e2efd7689bc500 100644
index 97e9a3e567a53c21aff8c525259b9dd83f222ebf..0d0ed4cb50364828d0a028ee69654e23b3b8d913 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -144,7 +144,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
@@ -145,7 +145,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
this.maxWorldSize = this.get("max-world-size", (integer) -> {
return Mth.clamp(integer, 1, 29999984);
}, 29999984);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add permission for command blocks
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 58a1a54b676922ef0862dcab98e7aada5de80311..cf47536a2e37d53406fc9cb3f09095e034af8e15 100644
index bdf11a98614c9c12d3112f437651be81d0d9872a..3622708c453feb6da3d5be192291d63abbe83068 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -404,7 +404,7 @@ public class ServerPlayerGameMode {
@@ -402,7 +402,7 @@ public class ServerPlayerGameMode {
BlockEntity tileentity = this.level.getBlockEntity(pos);
Block block = iblockdata.getBlock();
@ -18,10 +18,10 @@ index 58a1a54b676922ef0862dcab98e7aada5de80311..cf47536a2e37d53406fc9cb3f09095e0
return false;
} else if (this.player.blockActionRestricted(this.level, pos, this.gameModeForPlayer)) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index cff8b643efadcc153b03af1335885376746b48be..4de14bd6390537730f764137390be4e7861d9894 100644
index f16327556a5302c319b164897d2c5b3b4883ed31..dc5bcf6cf46d32961da9a2a6e9691ab30bb96045 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -880,7 +880,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -770,7 +770,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
@ -30,7 +30,7 @@ index cff8b643efadcc153b03af1335885376746b48be..4de14bd6390537730f764137390be4e7
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
} else {
BaseCommandBlock commandblocklistenerabstract = null;
@@ -947,7 +947,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -837,7 +837,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (!this.server.isCommandBlockEnabled()) {
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c99d24008792b07d5e2984261215de944482006b..ffd7e11b16604050e87a6b8aac08948fd3311bd1 100644
index f57d9a298a6e3be63c37ed7e14c99b154d372709..7b182384ca7f2b36513856e247072c3c5c05b5e7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -721,8 +721,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -636,8 +636,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public void setPos(double x, double y, double z) {
@ -19,7 +19,7 @@ index c99d24008792b07d5e2984261215de944482006b..ffd7e11b16604050e87a6b8aac08948f
}
protected AABB makeBoundingBox() {
@@ -4196,6 +4196,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4128,6 +4128,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public final void setPosRaw(double x, double y, double z) {
@ -28,10 +28,10 @@ index c99d24008792b07d5e2984261215de944482006b..ffd7e11b16604050e87a6b8aac08948f
+ }
+ public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
+ // Paper end
// Paper start - rewrite chunk system
if (this.updatingSectionStatus) {
LOGGER.error("Refusing to update position for entity " + this + " to position " + new Vec3(x, y, z) + " since it is processing a section status update", new Throwable());
@@ -4219,6 +4224,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z);
int i = Mth.floor(x);
@@ -4145,6 +4150,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.levelCallback.onMove();
}

View File

@ -8,10 +8,10 @@ makes it so that the server keeps the last difficulty used instead
of restoring the server.properties every single load.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index ccf238c12c416e2aa7ee83a14bbbb96f5b2f8b51..c09adcb869edf273c633ce996b048173ded89703 100644
index 020c6ee8df9a97ca84f1fb36b03abfcd5df24744..ac7c70533659c5683f72ded537f76cb6ff4e3777 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -797,7 +797,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -782,7 +782,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper
// CraftBukkit start
// this.updateMobSpawningFlags();
@ -20,7 +20,7 @@ index ccf238c12c416e2aa7ee83a14bbbb96f5b2f8b51..c09adcb869edf273c633ce996b048173
this.forceTicks = false;
// CraftBukkit end
@@ -1725,11 +1725,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1731,11 +1731,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
@ -40,7 +40,7 @@ index ccf238c12c416e2aa7ee83a14bbbb96f5b2f8b51..c09adcb869edf273c633ce996b048173
}
}
@@ -1743,7 +1746,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1749,7 +1752,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
while (iterator.hasNext()) {
ServerLevel worldserver = (ServerLevel) iterator.next();
@ -63,7 +63,7 @@ index 89be3991ef4fb2deb7276c5409cb571a7fb1f821..9c272f7cf8cbd2bbe147e57f7fabe135
return Component.translatable("commands.difficulty.success", difficulty.getDisplayName());
}, true);
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index a3e839c8166a7fee282a764127d76cf0232e6c38..31bdf41a3e914c79e42f85b7f0aef439f35288f1 100644
index 967817ad15146407668361a85c89be6beb6a73f9..5d90fc103577a5dab63daf9a23ba46da7eba1e18 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -325,7 +325,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -76,23 +76,23 @@ index a3e839c8166a7fee282a764127d76cf0232e6c38..31bdf41a3e914c79e42f85b7f0aef439
@Override
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 15a70bad66eb2508f58ff184061c2d19e45297e1..f80645fe0e1f9ad2a70ea33c5dc6a8c02ff262ec 100644
index fcf875c6145c2428cab7a801442f34adc098b3ce..b70165b6ffce01aadf30af33746d347457dc150a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1203,7 +1203,7 @@ public class ServerPlayer extends Player {
@@ -1162,7 +1162,7 @@ public class ServerPlayer extends Player {
this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
this.connection.send(new ClientboundRespawnPacket(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation(), this.getPortalCooldown()));
this.connection.send(new ClientboundRespawnPacket(this.createCommonSpawnInfo(worldserver), (byte) 3));
- this.connection.send(new ClientboundChangeDifficultyPacket(this.level().getDifficulty(), this.level().getLevelData().isDifficultyLocked()));
+ this.connection.send(new ClientboundChangeDifficultyPacket(worldserver.getDifficulty(), this.level().getLevelData().isDifficultyLocked())); // Paper - fix difficulty sync issue
PlayerList playerlist = this.server.getPlayerList();
playerlist.sendPlayerPermissionLevel(this);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4de14bd6390537730f764137390be4e7861d9894..3ddf29100807d5882e20395466d420fb169c2f87 100644
index dc5bcf6cf46d32961da9a2a6e9691ab30bb96045..c6b5bc584fc117240c4290ba48dd71e5d70c2abb 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3361,7 +3361,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@@ -3153,7 +3153,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {
@ -102,10 +102,10 @@ index 4de14bd6390537730f764137390be4e7861d9894..3ddf29100807d5882e20395466d420fb
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 7909cf20ab3cd4948ed13c6eba0cdf503b557a70..e9376086ea756f39a9766aa698ed0eba9401aaaa 100644
index 4c4cee10d688aa0a3aab29f42c4cd8fd22488796..cc28da02a5736508bc82f31401646de2c0d7ab99 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -955,8 +955,8 @@ public final class CraftServer implements Server {
@@ -958,8 +958,8 @@ public final class CraftServer implements Server {
org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot
this.console.paperConfigurations.reloadConfigs(this.console);
for (ServerLevel world : this.console.getAllLevels()) {
@ -117,10 +117,10 @@ index 7909cf20ab3cd4948ed13c6eba0cdf503b557a70..e9376086ea756f39a9766aa698ed0eba
for (SpawnCategory spawnCategory : SpawnCategory.values()) {
if (CraftSpawnCategory.isValidForLimits(spawnCategory)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index b34067a6bc3bf61ca94929bb8e9677deef686077..eb7a3a89ad7174e57d8ce98a67725c0d329b5d88 100644
index b266cd21fec4c48d2fc4676eb30b1bfdaa4acd98..4f40c0fcab774647cc89c04d51ae47444bc88874 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1150,7 +1150,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1155,7 +1155,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setDifficulty(Difficulty difficulty) {

View File

@ -6,12 +6,12 @@ Subject: [PATCH] Paper dumpitem command
Let's you quickly view the item in your hands NBT data
diff --git a/src/main/java/io/papermc/paper/command/PaperCommand.java b/src/main/java/io/papermc/paper/command/PaperCommand.java
index 5bfa245a621a0bf7ef60cd01f4c04576b770384e..a8b41d6a42e23a7cd839cc3d5e5cae84860f802c 100644
index 43573b5ef76c8bb42411c3707cb13d90d531b905..a27c90ea7af63b0d42f202ed1a7dab6e42daed9f 100644
--- a/src/main/java/io/papermc/paper/command/PaperCommand.java
+++ b/src/main/java/io/papermc/paper/command/PaperCommand.java
@@ -41,6 +41,7 @@ public final class PaperCommand extends Command {
@@ -40,6 +40,7 @@ public final class PaperCommand extends Command {
commands.put(Set.of("dumpplugins"), new DumpPluginsCommand());
commands.put(Set.of("fixlight"), new FixLightCommand());
commands.put(Set.of("debug", "chunkinfo", "holderinfo"), new ChunkDebugCommand());
commands.put(Set.of("syncloadinfo"), new SyncLoadInfoCommand());
+ commands.put(Set.of("dumpitem"), new DumpItemCommand());

View File

@ -22,10 +22,10 @@ wants it to collect even faster, they can restore that setting back to 1 instead
Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e9376086ea756f39a9766aa698ed0eba9401aaaa..0e552fdcc48b0f3f68cbf65113b94782863cb092 100644
index cc28da02a5736508bc82f31401646de2c0d7ab99..970a604108c0b7e410af356e3d12559af0b0b78b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -382,7 +382,7 @@ public final class CraftServer implements Server {
@@ -385,7 +385,7 @@ public final class CraftServer implements Server {
this.overrideSpawnLimits();
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
@ -34,7 +34,7 @@ index e9376086ea756f39a9766aa698ed0eba9401aaaa..0e552fdcc48b0f3f68cbf65113b94782
this.minimumAPI = this.configuration.getString("settings.minimum-api");
this.loadIcon();
@@ -935,7 +935,7 @@ public final class CraftServer implements Server {
@@ -938,7 +938,7 @@ public final class CraftServer implements Server {
this.console.setMotd(config.motd);
this.overrideSpawnLimits();
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
@ -44,7 +44,7 @@ index e9376086ea756f39a9766aa698ed0eba9401aaaa..0e552fdcc48b0f3f68cbf65113b94782
this.printSaveWarning = false;
console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index eb7a3a89ad7174e57d8ce98a67725c0d329b5d88..328bc95dd9298c1f666c35836ea157367f7ef1cd 100644
index 4f40c0fcab774647cc89c04d51ae47444bc88874..6137e49ba4f7dd121bbb7b13add3d63285df52d5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -279,7 +279,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@ -84,7 +84,7 @@ index eb7a3a89ad7174e57d8ce98a67725c0d329b5d88..328bc95dd9298c1f666c35836ea15736
}
return true;
@@ -444,9 +456,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -436,9 +448,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot
// Paper start - Optimize this method
ChunkPos chunkPos = new ChunkPos(x, z);
@ -98,7 +98,7 @@ index eb7a3a89ad7174e57d8ce98a67725c0d329b5d88..328bc95dd9298c1f666c35836ea15736
if (immediate == null) {
immediate = world.getChunkSource().chunkMap.getUnloadingChunk(x, z);
}
@@ -454,7 +469,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -446,7 +461,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
if (!(immediate instanceof ImposterProtoChunk) && !(immediate instanceof net.minecraft.world.level.chunk.LevelChunk)) {
return false; // not full status
}
@ -107,7 +107,7 @@ index eb7a3a89ad7174e57d8ce98a67725c0d329b5d88..328bc95dd9298c1f666c35836ea15736
world.getChunk(x, z); // make sure we're at ticket level 32 or lower
return true;
}
@@ -480,7 +495,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -472,7 +487,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// we do this so we do not re-read the chunk data on disk
}
@ -116,7 +116,7 @@ index eb7a3a89ad7174e57d8ce98a67725c0d329b5d88..328bc95dd9298c1f666c35836ea15736
world.getChunkSource().getChunk(x, z, ChunkStatus.FULL, true);
return true;
// Paper end
@@ -2208,6 +2223,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -2174,6 +2189,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
io.papermc.paper.chunk.system.ChunkSystem.scheduleChunkLoad(this.getHandle(), x, z, gen, ChunkStatus.FULL, true, priority, (c) -> {
net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c;

View File

@ -5,10 +5,10 @@ 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 c09adcb869edf273c633ce996b048173ded89703..d62c09f7328af63112d9e6f1a06844047dbf6570 100644
index ac7c70533659c5683f72ded537f76cb6ff4e3777..e82e5df0abf64b27733beedb4a545a0a1a2119f3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -870,7 +870,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -845,7 +845,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
this.isSaving = true;
@ -17,7 +17,7 @@ index c09adcb869edf273c633ce996b048173ded89703..d62c09f7328af63112d9e6f1a0684404
flag3 = this.saveAllChunks(suppressLogs, flush, force);
} finally {
this.isSaving = false;
@@ -1380,13 +1380,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1368,13 +1368,28 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.status = this.buildServerStatus();
}
@ -53,10 +53,10 @@ index c09adcb869edf273c633ce996b048173ded89703..d62c09f7328af63112d9e6f1a0684404
// Paper start - move executeAll() into full server tick timing
try (co.aikar.timings.Timing ignored = MinecraftTimings.processTasksTimer.startTiming()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 1c327067d488cc916d082a797b161cb7836ffa2e..3f5d572994bc8b3f1e106105dc0bb202ad005b8c 100644
index 7aceefc28f310e704ca8803e95c40ada13718988..70a7abf4738cc5da94d7465884d9a5a1dd7c828c 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -452,6 +452,15 @@ public class ServerChunkCache extends ChunkSource {
@@ -603,6 +603,15 @@ public class ServerChunkCache extends ChunkSource {
} // Paper - Timings
}
@ -73,10 +73,10 @@ index 1c327067d488cc916d082a797b161cb7836ffa2e..3f5d572994bc8b3f1e106105dc0bb202
public void close() throws IOException {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e96890be7f03b7cc846fe850d4169e09b5d40eab..02ba7e25c649832aba2e742cb76be9d2b6b6f954 100644
index 6bb7f2050e93f63045ea608672751da28138d3f8..b84a5fcda10711c896c9a670343d961b9536f888 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1281,6 +1281,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1051,6 +1051,37 @@ public class ServerLevel extends Level implements WorldGenLevel {
return !this.server.isUnderSpawnProtection(this, pos, player) && this.getWorldBorder().isWithinBounds(pos);
}
@ -112,13 +112,13 @@ index e96890be7f03b7cc846fe850d4169e09b5d40eab..02ba7e25c649832aba2e742cb76be9d2
+ // Paper end
+
public void save(@Nullable ProgressListener progressListener, boolean flush, boolean savingDisabled) {
// Paper start - rewrite chunk system - add close param
this.save(progressListener, flush, savingDisabled, false);
ServerChunkCache chunkproviderserver = this.getChunkSource();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index f80645fe0e1f9ad2a70ea33c5dc6a8c02ff262ec..e087b62f88157d57eb037feb0d39c076b286f755 100644
index b70165b6ffce01aadf30af33746d347457dc150a..0661ed6cac8da2a1cc94abe7e1017fcd04a9e9c2 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -189,6 +189,7 @@ import org.bukkit.inventory.MainHand;
@@ -184,6 +184,7 @@ import org.bukkit.inventory.MainHand;
public class ServerPlayer extends Player {
private static final Logger LOGGER = LogUtils.getLogger();
@ -127,10 +127,10 @@ index f80645fe0e1f9ad2a70ea33c5dc6a8c02ff262ec..e087b62f88157d57eb037feb0d39c076
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
public ServerGamePacketListenerImpl connection;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 97199ae30edfaaacb9ea9d29846ee131395815e6..a8dcd1a07b835f665c74a8a531fef84435716b13 100644
index fdd518b5ea21ae617069fd03429712de4b44841b..2de6d47c2289faac019e4f68dcc7df910a03e206 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -535,6 +535,7 @@ public abstract class PlayerList {
@@ -522,6 +522,7 @@ public abstract class PlayerList {
protected void save(ServerPlayer player) {
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
@ -138,7 +138,7 @@ index 97199ae30edfaaacb9ea9d29846ee131395815e6..a8dcd1a07b835f665c74a8a531fef844
this.playerIo.save(player);
ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
@@ -1125,10 +1126,22 @@ public abstract class PlayerList {
@@ -1119,10 +1120,22 @@ public abstract class PlayerList {
}
public void saveAll() {

View File

@ -8,10 +8,10 @@ We have stored UUID in plenty of places that did not get DFU'd
So just look for old format and load it if it exists.
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
index 1d13bc15c56faa69699fb3ad39210233d6b6934d..7e94ebe06fc62293e665d6db19e42d947e7eb30f 100644
index ad0251b73d21b36bf19e9aa649817b4da2d0a6b4..84fc2adf591f02a14862f7c1cd645c2efde55c3d 100644
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
@@ -196,6 +196,12 @@ public class CompoundTag implements Tag {
@@ -233,6 +233,12 @@ public class CompoundTag implements Tag {
}
public void putUUID(String key, UUID value) {
@ -24,7 +24,7 @@ index 1d13bc15c56faa69699fb3ad39210233d6b6934d..7e94ebe06fc62293e665d6db19e42d94
this.tags.put(key, NbtUtils.createUUID(value));
}
@@ -204,10 +210,20 @@ public class CompoundTag implements Tag {
@@ -241,10 +247,20 @@ public class CompoundTag implements Tag {
* You must use {@link #hasUUID(String)} before or else it <b>will</b> throw an NPE.
*/
public UUID getUUID(String key) {
@ -46,18 +46,18 @@ index 1d13bc15c56faa69699fb3ad39210233d6b6934d..7e94ebe06fc62293e665d6db19e42d94
return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4;
}
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index 1e7ba8d82269d2d375b2f2d3fc21ed922cce0942..7bc60901297d27d88efb401d02b4bc06d8b28874 100644
index 4388f2a8b05f5ed2f0934c1693299a4c92072adc..b65dcff9812dbc3256c080ac264c4aafd83ce276 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -76,6 +76,11 @@ public final class NbtUtils {
if (nbt.contains("Name", 8)) {
string = nbt.getString("Name");
}
@@ -72,6 +72,11 @@ public final class NbtUtils {
@Nullable
public static GameProfile readGameProfile(CompoundTag nbt) {
UUID uUID = nbt.hasUUID("Id") ? nbt.getUUID("Id") : Util.NIL_UUID;
+ // Paper start - support string UUID's
+ if (nbt.contains("Id", 8)) {
+ if (nbt.contains("Id", Tag.TAG_STRING)) {
+ uUID = UUID.fromString(nbt.getString("Id"));
+ }
+ // Paper end
String string = nbt.getString("Name");
if (nbt.hasUUID("Id")) {
uUID = nbt.getUUID("Id");
try {

View File

@ -8,7 +8,7 @@ public net.minecraft.world.entity.Entity isInRain()Z
public net.minecraft.world.entity.Entity isInBubbleColumn()Z
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 4dc676f29f04ba8d52b2fe3778347d2c2f46eebe..5052432652c2e7f09a233e267bece5fb1e3e3bf1 100644
index c7cd18de51c5e7c9d194ba65902084194d4408ec..91d199250d856baa869258282bb04ed5897b14e9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1312,5 +1312,40 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {