Update paperweight to 1.2.0 (#6901)

This commit is contained in:
Jason 2021-11-16 21:00:14 -08:00 committed by GitHub
parent 51b7b609f1
commit f3830bc214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 119 additions and 155 deletions

View File

@ -109,29 +109,3 @@ c net/minecraft/world/level/saveddata/maps/WorldMap$WorldMapHumanTracker net/min
# CraftBukkit adds a level resource key to LevelStorageSource#createAccess
c net/minecraft/world/level/storage/Convertable net/minecraft/world/level/storage/LevelStorageSource
m (Ljava/lang/String;Lnet/minecraft/resources/ResourceKey;)Lnet/minecraft/world/level/storage/Convertable$ConversionSession; c createAccess
# Missed mappings - these should work as they are unmodified by CraftBukkit but don't for some reason
c net/minecraft/network/NetworkManager net/minecraft/network/Connection
m (Lnet/minecraft/network/protocol/Packet;Lio/netty/util/concurrent/GenericFutureListener;Lnet/minecraft/network/EnumProtocol;Lnet/minecraft/network/EnumProtocol;)V a doSendPacket
c net/minecraft/server/gui/ServerGUI net/minecraft/server/gui/MinecraftServerGui
m (Ljavax/swing/JTextArea;Ljavax/swing/JScrollPane;Ljava/lang/String;)V a print
c net/minecraft/server/level/PlayerChunk net/minecraft/server/level/ChunkHolder
m (Lnet/minecraft/world/level/World;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/world/level/block/state/IBlockData;)V a broadcastBlockEntityIfNeeded
c net/minecraft/server/level/PlayerChunkMap net/minecraft/server/level/ChunkMap
m (Lnet/minecraft/world/level/chunk/ChunkStatus;I)Lnet/minecraft/world/level/chunk/ChunkStatus; a getDependencyStatus
c net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetSet net/minecraft/world/entity/ai/behavior/StartAttacking
m (Lnet/minecraft/world/entity/EntityInsentient;Lnet/minecraft/world/entity/EntityLiving;)V a setAttackTarget
c net/minecraft/world/entity/ai/behavior/BehaviorMakeLove net/minecraft/world/entity/ai/behavior/VillagerMakeLove
m (Lnet/minecraft/world/entity/npc/EntityVillager;Lnet/minecraft/core/BlockPosition;)Z a canReach
c net/minecraft/world/level/block/MultifaceBlock net/minecraft/world/level/block/MultifaceBlock
m (Lnet/minecraft/world/level/block/state/IBlockData;Lnet/minecraft/world/level/IBlockAccess;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/core/EnumDirection;)Lnet/minecraft/world/level/block/state/IBlockData; c getStateForPlacement
c net/minecraft/server/players/UserCache net/minecraft/server/players/GameProfileCache
m (Ljava/lang/String;)Ljava/util/Optional; getProfile get
p 0 name

View File

@ -22,7 +22,3 @@ c net/minecraft/world/level/chunk/LevelChunk net/minecraft/world/level/chunk/Chu
# Paper changes type
c net/minecraft/core/MappedRegistry net/minecraft/core/RegistryMaterials
f Lit/unimi/dsi/fastutil/objects/Reference2IntOpenHashMap; toId bw
# Remove streams from Mob AI System changes type from EnumSet to com.destroystokyo.paper.util.set.OptimizedSmallEnumSet
c net/minecraft/world/entity/ai/goal/Goal net/minecraft/world/entity/ai/goal/PathfinderGoal
m ()Lcom/destroystokyo/paper/util/set/OptimizedSmallEnumSet; getFlags i

View File

@ -2,7 +2,7 @@ plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "7.1.0" apply false
id("io.papermc.paperweight.core") version "1.1.14"
id("io.papermc.paperweight.core") version "1.2.0"
}
allprojects {

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -7,7 +7,7 @@ Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index c6a38fefbb1c0e0483a1d0468dd4e7c2b3881097..4a2edc70432a45931fcc0e98be3ca900df02814b 100644
index 756a2ab6ad416f55fa3864cff9818473840b04fc..701a2ffd04df48d437b2cb963dd150af99725b6e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -225,4 +225,13 @@ public class PaperConfig {
@ -1312,7 +1312,7 @@ index 5f243953d6d9710280bd099b7560c18d30dddfa0..0e7c09c80509c83a52f32f735a1b1996
// CraftBukkit end
this.chatVisibility = packet.getChatVisibility();
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0ed1d4b09b4d540a0bf420d8f63eb31fcfc7b8c2..fbf2a0d697b1ece82983154cdf585a101df391f4 100644
index fd4bfb2b373acec07ca77414c8527b8d416b1b49..cab69dfc5be1ebbabab5a750b6119c65a6cf0320 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -161,6 +161,8 @@ import org.apache.logging.log4j.LogManager;
@ -1396,28 +1396,29 @@ index 0ed1d4b09b4d540a0bf420d8f63eb31fcfc7b8c2..fbf2a0d697b1ece82983154cdf585a10
Player player = this.getCraftPlayer();
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server));
this.cserver.getPluginManager().callEvent(event);
@@ -2634,30 +2645,28 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2634,30 +2645,30 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
return;
}
- // CraftBukkit start
+ // CraftBukkit start // Paper start - Adventure
Player player = this.player.getBukkitEntity();
int x = packetplayinupdatesign.getPos().getX();
int y = packetplayinupdatesign.getPos().getY();
int z = packetplayinupdatesign.getPos().getZ();
int x = packet.getPos().getX();
int y = packet.getPos().getY();
int z = packet.getPos().getZ();
- String[] lines = new String[4];
+ List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>();
for (int i = 0; i < list.size(); ++i) {
- TextFilter.FilteredText itextfilter_a = (TextFilter.FilteredText) list.get(i);
-
for (int i = 0; i < signText.size(); ++i) {
- TextFilter.FilteredText itextfilter_a = (TextFilter.FilteredText) signText.get(i);
+ TextFilter.FilteredText currentLine = signText.get(i);
if (this.player.isTextFilteringEnabled()) {
- lines[i] = ChatFormatting.stripFormatting(new TextComponent(ChatFormatting.stripFormatting(itextfilter_a.getFiltered())).getString());
+ lines.add(net.kyori.adventure.text.Component.text(list.get(i).getFiltered()));
+ lines.add(net.kyori.adventure.text.Component.text(currentLine.getFiltered()));
} else {
- lines[i] = ChatFormatting.stripFormatting(new TextComponent(ChatFormatting.stripFormatting(itextfilter_a.getRaw())).getString());
+ lines.add(net.kyori.adventure.text.Component.text(list.get(i).getRaw()));
+ lines.add(net.kyori.adventure.text.Component.text(currentLine.getRaw()));
}
}
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Properly fix item duplication bug
Credit to prplz for figuring out the real issue
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 7e7bbb6817ceddbbb90c1ac45d8e974d3f95c089..d4614faa22485dce226f3dc17ef984212ac8fcb9 100644
index da722cddaaa8c40715748de81104a5b213c2fea8..a61798909aee1b73b62c88c22fa6cfc1fe2a5942 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2128,7 +2128,7 @@ public class ServerPlayer extends Player {
@ -19,10 +19,10 @@ index 7e7bbb6817ceddbbb90c1ac45d8e974d3f95c089..d4614faa22485dce226f3dc17ef98421
@Override
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9026dd91f8d874209bbfd4cdfd3c41e37cdd7560..6eb01dcf59fda2656b6d93b0c39380302665f930 100644
index 9c7843c2623fce4ec423acbcc0c76a35b1bd5969..36bb3b502a26ab43f442d85b3cad4a1de0a5bda8 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2810,7 +2810,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2812,7 +2812,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
public final boolean isDisconnected() {

View File

@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7759bf2afb9edeaca24726aace9358a8d5eafc64..652703b1582e63148658a3a9d2604afa55674c23 100644
index 89588d6478ebd7d4892dceb03026dff89e1844db..7b6e6e646511bc47d2215c512b4d839b3f3a1c55 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2769,14 +2769,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2771,14 +2771,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) {

View File

@ -5,18 +5,18 @@ Subject: [PATCH] Fix exploit that allowed colored signs to be created
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8c2242d7e443bee26741608c65d314d8902f5765..4cbdf64b0e6271a1cf0f31d486d8fad4f941b913 100644
index 25ea7a94407dfdb613ee15de4eb2a9c3252c6b27..e83232f18871a04fadbc053b1e1e7f94d2492159 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2775,9 +2775,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2777,9 +2777,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
TextFilter.FilteredText currentLine = signText.get(i);
for (int i = 0; i < list.size(); ++i) {
if (this.player.isTextFilteringEnabled()) {
- lines.add(net.kyori.adventure.text.Component.text(list.get(i).getFiltered()));
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getFiltered())));
- lines.add(net.kyori.adventure.text.Component.text(currentLine.getFiltered()));
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getFiltered())));
} else {
- lines.add(net.kyori.adventure.text.Component.text(list.get(i).getRaw()));
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getRaw())));
- lines.add(net.kyori.adventure.text.Component.text(currentLine.getRaw()));
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getRaw())));
}
}
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);

View File

@ -159,7 +159,7 @@ index 0fda52841b5e1643efeda92106124998abc4e0aa..fe79c0add4f7cb18d487c5bb9415c40c
public static Timing getTickList(ServerLevel worldserver, String timingsType) {
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index 15e71c00f98721e609dfab341395313db95cdfc7..c29da813f5fcba07860314914180c9d9a3ec560a 100644
index 73b49d24cd428e2328d56f5f42333a25a1d6ebae..a89ccdf2ea517d2ec38c9433bdc26802884ed988 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -1,5 +1,6 @@
@ -2278,7 +2278,7 @@ index a5e438a834826161c52ca9db57d234d9ff80a591..b8bc1b9b8e8a33df90a963f9f9769292
@Override
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
index aa96017819712f42e16c7eac57222301600b66a5..802e0259f660c05afb2b772f0e617d819b19c7cc 100644
index 70f2a946f50ca6be2ffaef8db8c1c03a729c757b..4f45ac04a219e619c13b31befd2c4e452057079c 100644
--- a/src/main/java/net/minecraft/server/MCUtil.java
+++ b/src/main/java/net/minecraft/server/MCUtil.java
@@ -505,4 +505,8 @@ public final class MCUtil {
@ -2291,7 +2291,7 @@ index aa96017819712f42e16c7eac57222301600b66a5..802e0259f660c05afb2b772f0e617d81
+ }
}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index fb0b3c5770f66cc3590f5ac4e690a33cb6179be3..7ce854edba32ffcafaa5268d4bb2822a5233e40b 100644
index 6f30e10d59416799edbe362951ce61733e37b256..2b8b47f121b78cc5fe166c4280a327ddcf799b77 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -217,6 +217,7 @@ public class Main {
@ -2303,7 +2303,7 @@ index fb0b3c5770f66cc3590f5ac4e690a33cb6179be3..7ce854edba32ffcafaa5268d4bb2822a
DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataFixers.getDataFixer(), minecraftsessionservice, gameprofilerepository, usercache, LoggerChunkProgressListener::new);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 13f94e196ffd9f37e8049a4a76bc83389ff58d84..50d4948034036b0ec6cdf447f03743baa33ab2ac 100644
index cb2ca56df7f2adedff2ebdd26957c23164b56255..7a7c501b1dffb4928aa74edd684d79f7fa312789 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1001,7 +1001,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -2316,7 +2316,7 @@ index 13f94e196ffd9f37e8049a4a76bc83389ff58d84..50d4948034036b0ec6cdf447f03743ba
public String getLocalIp() {
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index bbf2dee8cdd2d8239d9230b1a7fff4f07c2edaf8..ffa3dc07ec566464ce10abe793de61efa9673fe9 100644
index 1072998cd4b00bd74e8aed9a17fbf67e31a595cd..7e3f4bb1ce723adbea8622aec8cce73faccfc664 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -151,6 +151,18 @@ public class ChunkHolder {
@ -2348,7 +2348,7 @@ index bbf2dee8cdd2d8239d9230b1a7fff4f07c2edaf8..ffa3dc07ec566464ce10abe793de61ef
ChunkHolder.FullChunkStatus playerchunk_state1 = ChunkHolder.getFullChunkStatus(this.ticketLevel);
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index a85f96c5cb661082962cd768eaf41affb8e2fe15..6d7f1fcd1709967acadd67b610c15f61d95a211b 100644
index cec5e220bcbed01f45afc75f653b5937ffea25cc..d445990c843ad86215be238c4b44166903bb7fda 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -447,6 +447,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -2627,7 +2627,7 @@ index a85f96c5cb661082962cd768eaf41affb8e2fe15..6d7f1fcd1709967acadd67b610c15f61
return this.poiManager;
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 1f3fe980e71c13b5e7852349cba1cb0e4aa42dcd..30b88f0e8ad40438af8a7d5bec1471a60ddd977b 100644
index 4956a9ea1b4545d80468521afe8c5453b53768c3..1603d406b54aefdf337827df164c227a33423f61 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -481,10 +481,128 @@ public class ServerChunkCache extends ChunkSource {
@ -2782,15 +2782,15 @@ index 1f3fe980e71c13b5e7852349cba1cb0e4aa42dcd..30b88f0e8ad40438af8a7d5bec1471a6
@@ -600,6 +723,11 @@ public class ServerChunkCache extends ChunkSource {
}
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) {
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
+ // Paper start - add isUrgent - old sig left in place for dirty nms plugins
+ return getChunkFutureMainThread(i, j, chunkstatus, flag, false);
+ return getChunkFutureMainThread(chunkX, chunkZ, leastStatus, create, false);
+ }
+ private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag, boolean isUrgent) {
+ private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create, boolean isUrgent) {
+ // Paper end
ChunkPos chunkcoordintpair = new ChunkPos(i, j);
ChunkPos chunkcoordintpair = new ChunkPos(chunkX, chunkZ);
long k = chunkcoordintpair.toLong();
int l = 33 + ChunkStatus.getDistance(chunkstatus);
int l = 33 + ChunkStatus.getDistance(leastStatus);
@@ -997,11 +1125,12 @@ public class ServerChunkCache extends ChunkSource {
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
public boolean pollTask() {
@ -2806,7 +2806,7 @@ index 1f3fe980e71c13b5e7852349cba1cb0e4aa42dcd..30b88f0e8ad40438af8a7d5bec1471a6
} finally {
chunkMap.callbackExecutor.run();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index aa9999437b4b1b0b41ebf988e26bc3c3c262e985..5be5f95fe01e0132f9d4477149ba022351d8b2be 100644
index afdb25743ceb404b4681ee2965fe3448f1f1b06a..e4626f6edb845ce751235c4341a608de81857603 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -295,6 +295,78 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -2910,7 +2910,7 @@ index 0d536d72ac918fbd403397ff369d10143ee9c204..be677d437d17b74c6188ce1bd5fc6fdc
private final String name;
private final Comparator<T> comparator;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 678487d92095957d1346cf555486a7f2125f566b..c748446e423e3af92a0fccef45fcea45b158a272 100644
index cc1b855b09d4826f88b0c2b9c08fb901191a2108..1e3d7081467cccf09d4510907388479560f67f67 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -711,6 +711,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser

View File

@ -22,7 +22,7 @@ it only impacts data sent from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0103c76c183d0e866a98c26f2d1cf557ba4f67e8..d24d42ef0a00b9420700e58f555f8448f8d01747 100644
index 2ea1e58cf721a8ae339cbfd6192f3312061249ba..b9f9314befff581e70ae7d8d4eab9040e4e4d26d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -254,6 +254,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -33,26 +33,19 @@ index 0103c76c183d0e866a98c26f2d1cf557ba4f67e8..d24d42ef0a00b9420700e58f555f8448
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
@@ -2847,10 +2848,20 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>();
@@ -2848,6 +2849,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
for (int i = 0; i < list.size(); ++i) {
for (int i = 0; i < signText.size(); ++i) {
TextFilter.FilteredText currentLine = signText.get(i);
+ // Paper start - cap line length - modified clients can send longer data than normal
+ net.minecraft.server.network.TextFilter.FilteredText currentLine = list.get(i);
+ if (MAX_SIGN_LINE_LENGTH > 0 && currentLine.getRaw().length() > MAX_SIGN_LINE_LENGTH) {
+ // This handles multibyte characters as 1
+ int offset = currentLine.getRaw().codePoints().limit(MAX_SIGN_LINE_LENGTH).map(Character::charCount).sum();
+ if (offset < currentLine.getRaw().length()) {
+ list.set(i, currentLine = net.minecraft.server.network.TextFilter.FilteredText.passThrough(currentLine.getRaw().substring(0, offset))); // this will break any filtering, but filtering is NYI as of 1.17
+ signText.set(i, currentLine = net.minecraft.server.network.TextFilter.FilteredText.passThrough(currentLine.getRaw().substring(0, offset))); // this will break any filtering, but filtering is NYI as of 1.17
+ }
+ }
+ // Paper end
if (this.player.isTextFilteringEnabled()) {
- lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getFiltered())));
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getFiltered())));
} else {
- lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(list.get(i).getRaw())));
+ lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getRaw())));
}
}
SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);
lines.add(net.kyori.adventure.text.Component.text(SharedConstants.filterText(currentLine.getFiltered())));

View File

@ -28,7 +28,7 @@ and then catch exceptions and close if they fire.
Part of this commit was authored by: Spottedleaf
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index e5f8c48c8d57ce0df4e7aacdbc3a6d3e9b3cb6e1..3faf9bc694016f3f46576a549814ff8e6070598a 100644
index b96ef2374b689ad715ce3b3a7c0b599a56b4c2d1..a3bfc12e34754dc5f8f53b968451a07f3a0ab496 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -87,6 +87,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -157,8 +157,8 @@ index e5f8c48c8d57ce0df4e7aacdbc3a6d3e9b3cb6e1..3faf9bc694016f3f46576a549814ff8e
+ // Paper end
ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
if (genericfuturelistener != null) {
channelfuture.addListener(genericfuturelistener);
if (callback != null) {
channelfuture.addListener(callback);
}
+ // Paper start
+ if (packet.hasFinishListener()) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Mob Spawner API Enhancements
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index f2c69ce7a33ef69c71e218cdb2f6a429c5e7b531..409467ca9a8a21d1e22e3a08f462e54d6124f6a1 100644
index 24b99df8854902958a72dd14fa15e32f847cc02b..47ca1710ae3ef93a4a1a7444dbabfa534de377c6 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -31,7 +31,7 @@ public abstract class BaseSpawner {
@ -50,7 +50,7 @@ index f2c69ce7a33ef69c71e218cdb2f6a429c5e7b531..409467ca9a8a21d1e22e3a08f462e54d
if (nbt.contains("SpawnPotentials", 9)) {
@@ -259,10 +265,15 @@ public abstract class BaseSpawner {
this.setSpawnData(world, pos, mobspawnerdata);
this.setNextSpawnData(world, pos, mobspawnerdata);
});
}
-
@ -93,7 +93,7 @@ index f2c69ce7a33ef69c71e218cdb2f6a429c5e7b531..409467ca9a8a21d1e22e3a08f462e54d
nbt.putShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
nbt.putShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
index 38dc811970b8f90b11a2b0013da3b6b3b775cbec..6bc17063c7ed9da9a16e2f8ab6117d49729c9b28 100644
index 38dc811970b8f90b11a2b0013da3b6b3b775cbec..b6c1460e342685c9c3c418be786d9b19c006184b 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
@@ -116,4 +116,30 @@ public class CraftCreatureSpawner extends CraftBlockEntityState<SpawnerBlockEnti
@ -122,7 +122,7 @@ index 38dc811970b8f90b11a2b0013da3b6b3b775cbec..6bc17063c7ed9da9a16e2f8ab6117d49
+ entity.put("Item", item.save(new net.minecraft.nbt.CompoundTag()));
+ compound.put("Entity", entity);
+ compound.putInt("Weight", this.getSnapshotNBT().contains("Weight", org.bukkit.craftbukkit.util.CraftMagicNumbers.NBT.TAG_ANY_NUMBER) ? this.getSnapshotNBT().getInt("Weight") : 1);
+ this.getSnapshot().getSpawner().setSpawnData(world.getHandle(), getPosition(), new net.minecraft.world.level.SpawnData(compound));
+ this.getSnapshot().getSpawner().setNextSpawnData(world.getHandle(), getPosition(), new net.minecraft.world.level.SpawnData(compound));
+ this.getSnapshot().getSpawner().spawnPotentials= net.minecraft.world.level.BaseSpawner.EMPTY_POTENTIALS;
+ }
+ // Paper end

View File

@ -8,7 +8,7 @@ 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 4f630156a597f2b8ebe16856d0db2c1723e958cd..335d42592d99d91ae1d99fe1b99122a3bac97a49 100644
index f07dd72d2ba1b3e1d30dab5973ca3785ea517471..f37e55afee9486ec1884461a0a2b89f5204e7d00 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -857,7 +857,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -81,10 +81,10 @@ index 8098875a5c4146dec81f5daed0e34ddfe17a26c6..286863b7eb9ee0389154304e61942dd6
@Override
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7bd2a88de8eaf9d72d9424a39d5df2600bed7e58..c0ae236619bbdf9293fbf1c4a1764a785d16a67b 100644
index 08c7c2f9e87cc5ec3d8fce5ad449df4761ebad8a..001167097afed95f93f54ff0e61220148849dd85 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3022,7 +3022,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3023,7 +3023,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) {
@ -94,7 +94,7 @@ index 7bd2a88de8eaf9d72d9424a39d5df2600bed7e58..c0ae236619bbdf9293fbf1c4a1764a78
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index cb08173bdfe52c8a0d5de70f0421cabaa476647a..da9fc8a99576f13a52ab4830cb09b69b1e406fae 100644
index f647c541c6908cae5f7b64054d71db2971bd5d1d..740bbfdfecd953d91075c507d1f8ee00dd02c9a8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -880,8 +880,8 @@ public final class CraftServer implements Server {

View File

@ -80,7 +80,7 @@ index 1d469a9ea0049687d7686f88382ac14514ad3bee..14d31bc2fb19b1265ee3e72280f2aba2
chunkData.addProperty("queued-for-unload", chunkMap.toDrop.contains(playerChunk.pos.longKey));
chunkData.addProperty("status", status == null ? "unloaded" : status.toString());
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 467449049359c721c27b7cd249b03acc5fb8f3cc..a88d54c2a97b8d9e3c0ba6c4595bcd25dc6f3b80 100644
index 6923c57173ddb220e1a8af16b116ea5678a773fb..88eb25d4ffc57cfe719a5a0591c9617f78c01ec9 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -60,7 +60,7 @@ public class ChunkHolder {
@ -361,7 +361,7 @@ index 467449049359c721c27b7cd249b03acc5fb8f3cc..a88d54c2a97b8d9e3c0ba6c4595bcd25
}
}).exceptionally((throwable) -> {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d70d977290b07fca61fea965a907c9f60a393ba7..324fe352fd108ef1d9f63a224b61c362adafc8d0 100644
index d77aabe4997b816b23a1f39ac353ae5bc7b8e1e4..f0154a13dbdad970042e248b3adc776573ab5d35 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -122,6 +122,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -991,7 +991,7 @@ index d94241bcca4f2fd5e464a860bd356af504dc68b7..1cc4e0a1f3d8235ef88b48e01ca8b78a
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index e5317a994cb9b30293ad54b8fc537f703ef994dc..eb6a802ea12a19a058fb7e23b7418b8b426b4ca0 100644
index 8cef8dca3971cbbb4eddf08ff47eca6874c1ac99..77a6a5883d7e9fba12d0a2c8f3e7f2565d4785b4 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -610,6 +610,26 @@ public class ServerChunkCache extends ChunkSource {
@ -1040,7 +1040,7 @@ index e5317a994cb9b30293ad54b8fc537f703ef994dc..eb6a802ea12a19a058fb7e23b7418b8b
ichunkaccess = (ChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
return ichunkaccess1;
@@ -731,10 +755,12 @@ public class ServerChunkCache extends ChunkSource {
if (flag && !currentlyUnloading) {
if (create && !currentlyUnloading) {
// CraftBukkit end
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
+ if (isUrgent) this.distanceManager.markUrgent(chunkcoordintpair); // Paper - Chunk priority
@ -1052,14 +1052,13 @@ index e5317a994cb9b30293ad54b8fc537f703ef994dc..eb6a802ea12a19a058fb7e23b7418b8b
this.runDistanceManagerUpdates();
playerchunk = this.getVisibleChunkIfPresent(k);
gameprofilerfiller.pop();
@@ -743,8 +769,13 @@ public class ServerChunkCache extends ChunkSource {
}
@@ -744,7 +770,13 @@ public class ServerChunkCache extends ChunkSource {
}
}
-
- return this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(chunkstatus, this.chunkMap);
- return this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(leastStatus, this.chunkMap);
+ // Paper start - Chunk priority
+ CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(chunkstatus, this.chunkMap);
+ CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(leastStatus, this.chunkMap);
+ if (isUrgent) {
+ future.thenAccept(either -> this.distanceManager.clearUrgent(chunkcoordintpair));
+ }
@ -1068,7 +1067,7 @@ index e5317a994cb9b30293ad54b8fc537f703ef994dc..eb6a802ea12a19a058fb7e23b7418b8b
}
private boolean chunkAbsent(@Nullable ChunkHolder holder, int maxLevel) {
@@ -796,6 +827,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -796,6 +828,7 @@ public class ServerChunkCache extends ChunkSource {
}
public boolean runDistanceManagerUpdates() {
@ -1424,7 +1423,7 @@ index 8770fe0db46b01e8b608637df4f1a669a3f4cdde..3c1698ba0d3bc412ab957777d9b5211d
private final String name;
private final Comparator<T> comparator;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8d86b9cacfaf71ec04dd530f3c0d75ee46c517df..14d4ef096624112c732b4c4f15763dc7c287d576 100644
index 001167097afed95f93f54ff0e61220148849dd85..ffdba71ca4a42fee989438799d485826c9bb647a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1545,6 +1545,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -1467,7 +1466,7 @@ index a5fb401e04bf194224d05020fe397e231e2f715c..0e3726495ef10717627dcf4297c944da
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index bed497f56b9b1fa16ef7b91744bb27d228fb5a66..3279ddbafef921e30d40874708acb4f7d32c060e 100644
index 2806d247e92600a592615241a6d07527f6b527e8..9aa75a9e997825c27d57eae992ca58ecbb807dfb 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -223,7 +223,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4b2ec9ff11fd1d164eb883a3ad2944804fb63eff..617d5c7ee88b6e652b4fbb73b3858cad8c15c1d9 100644
index ce4f1ab41ec2e5f656114fbd7b6f825bccf15d17..76794189454f5dd935fcd77e3c89a1ce58a9b570 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
@ -33,7 +33,7 @@ index 4b2ec9ff11fd1d164eb883a3ad2944804fb63eff..617d5c7ee88b6e652b4fbb73b3858cad
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player) {
this.server = server;
this.connection = connection;
@@ -2991,6 +2995,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2992,6 +2996,8 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
private static final ResourceLocation CUSTOM_REGISTER = new ResourceLocation("register");
private static final ResourceLocation CUSTOM_UNREGISTER = new ResourceLocation("unregister");
@ -42,7 +42,7 @@ index 4b2ec9ff11fd1d164eb883a3ad2944804fb63eff..617d5c7ee88b6e652b4fbb73b3858cad
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
@@ -3018,6 +3024,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3019,6 +3025,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
try {
byte[] data = new byte[packet.data.readableBytes()];
packet.data.readBytes(data);
@ -58,7 +58,7 @@ index 4b2ec9ff11fd1d164eb883a3ad2944804fb63eff..617d5c7ee88b6e652b4fbb73b3858cad
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@@ -3027,6 +3042,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3028,6 +3043,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Skip distance map update when spawning disabled.
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index eb6a802ea12a19a058fb7e23b7418b8b426b4ca0..16b406067ac7697ab598f9f27f5e688687f206ee 100644
index 77a6a5883d7e9fba12d0a2c8f3e7f2565d4785b4..6d0c56e4071a990a3b168143e8ac73f8b5ed0379 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -973,7 +973,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -974,7 +974,7 @@ public class ServerChunkCache extends ChunkSource {
int l = this.distanceManager.getNaturalSpawnChunkCount();
// Paper start - per player mob spawning
NaturalSpawner.SpawnState spawnercreature_d; // moved down

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerKickEvent causes
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 18a9d84c9508318132bb9b1dcb01ea11ea018916..71181012314d20e3505543a6d2abe88cb8e17a27 100644
index 87a50ca1d2482a384944e13aac32c3a81659970f..98eb8318413014f0650dc5c80125aa84b51cfc93 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2126,7 +2126,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -57,7 +57,7 @@ index 708ac03d5a849bf09c49547306e4a8c5a5ef8d91..5a8df368a4a25839cd4ac9be6972da2e
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b4e11d39cf1d9791a8fe4ccd297f6afde7a38c7b..b9f1384d742d612dd4d40929dfe812e5ebba4371 100644
index 572a6c57f7c7ad7ce1e8df7ca4a422ea80f967ba..5b26fd65e8d6da6af3bdc5df7bd4e079c6f78444 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -320,7 +320,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -281,7 +281,7 @@ index b4e11d39cf1d9791a8fe4ccd297f6afde7a38c7b..b9f1384d742d612dd4d40929dfe812e5
return;
}
}
@@ -3001,7 +3009,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3002,7 +3010,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> {
@ -290,7 +290,7 @@ index b4e11d39cf1d9791a8fe4ccd297f6afde7a38c7b..b9f1384d742d612dd4d40929dfe812e5
});
// Paper end
}
@@ -3047,7 +3055,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3048,7 +3056,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -299,7 +299,7 @@ index b4e11d39cf1d9791a8fe4ccd297f6afde7a38c7b..b9f1384d742d612dd4d40929dfe812e5
}
} else if (packet.identifier.equals(CUSTOM_UNREGISTER)) {
try {
@@ -3057,7 +3065,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3058,7 +3066,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -308,7 +308,7 @@ index b4e11d39cf1d9791a8fe4ccd297f6afde7a38c7b..b9f1384d742d612dd4d40929dfe812e5
}
} else {
try {
@@ -3075,7 +3083,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -3076,7 +3084,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data);
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@ -342,7 +342,7 @@ index 34dd85bbaa2e693d9b6a4db880b42501b3b9225c..8528cb537ea2329e866dee20fe1e5034
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 7150db24248b72c5ce2006ecff949315c71821d0..c775014177caf0d1138bde1cc5726dc657176325 100644
index d9445e8f95013e687274aa3228faf11745ca4898..73ca3b00cbc8b61ca07ae342fec27c9942034495 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -499,16 +499,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent unload() calls removing tickets for sync loads
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 16b406067ac7697ab598f9f27f5e688687f206ee..f5ccbff7a6b51cf71e28e514d853a500f9acd43f 100644
index 6d0c56e4071a990a3b168143e8ac73f8b5ed0379..d03ca9b30380209397aed5371686e0022bf631d5 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -734,6 +734,8 @@ public class ServerChunkCache extends ChunkSource {
@ -14,15 +14,15 @@ index 16b406067ac7697ab598f9f27f5e688687f206ee..f5ccbff7a6b51cf71e28e514d853a500
+ private long syncLoadCounter; // Paper - prevent plugin unloads from removing our ticket
+
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) {
private CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> getChunkFutureMainThread(int chunkX, int chunkZ, ChunkStatus leastStatus, boolean create) {
// Paper start - add isUrgent - old sig left in place for dirty nms plugins
return getChunkFutureMainThread(i, j, chunkstatus, flag, false);
return getChunkFutureMainThread(chunkX, chunkZ, leastStatus, create, false);
@@ -752,9 +754,12 @@ public class ServerChunkCache extends ChunkSource {
ChunkHolder.FullChunkStatus currentChunkState = ChunkHolder.getFullChunkStatus(playerchunk.getTicketLevel());
currentlyUnloading = (oldChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER) && !currentChunkState.isOrAfter(ChunkHolder.FullChunkStatus.BORDER));
}
+ final Long identifier; // Paper - prevent plugin unloads from removing our ticket
if (flag && !currentlyUnloading) {
if (create && !currentlyUnloading) {
// CraftBukkit end
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
+ identifier = Long.valueOf(this.syncLoadCounter++); // Paper - prevent plugin unloads from removing our ticket
@ -30,7 +30,7 @@ index 16b406067ac7697ab598f9f27f5e688687f206ee..f5ccbff7a6b51cf71e28e514d853a500
if (isUrgent) this.distanceManager.markUrgent(chunkcoordintpair); // Paper - Chunk priority
if (this.chunkAbsent(playerchunk, l)) {
ProfilerFiller gameprofilerfiller = this.level.getProfiler();
@@ -765,12 +770,20 @@ public class ServerChunkCache extends ChunkSource {
@@ -765,13 +770,21 @@ public class ServerChunkCache extends ChunkSource {
playerchunk = this.getVisibleChunkIfPresent(k);
gameprofilerfiller.pop();
if (this.chunkAbsent(playerchunk, l)) {
@ -39,11 +39,12 @@ index 16b406067ac7697ab598f9f27f5e688687f206ee..f5ccbff7a6b51cf71e28e514d853a500
}
}
- }
+ } else { identifier = null; } // Paper - prevent plugin unloads from removing our ticket
// Paper start - Chunk priority
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(chunkstatus, this.chunkMap);
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = this.chunkAbsent(playerchunk, l) ? ChunkHolder.UNLOADED_CHUNK_FUTURE : playerchunk.getOrScheduleFuture(leastStatus, this.chunkMap);
+ // Paper start - prevent plugin unloads from removing our ticket
+ if (flag && !currentlyUnloading) {
+ if (create && !currentlyUnloading) {
+ future.thenAcceptAsync((either) -> {
+ ServerChunkCache.this.distanceManager.removeTicketAtLevel(TicketType.REQUIRED_LOAD, chunkcoordintpair, l, identifier);
+ }, ServerChunkCache.this.mainThreadProcessor);

View File

@ -8,7 +8,7 @@ Sync loading the chunk at this stage would cause it to load
older data, as well as screwing our region state.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 173c9d06b28db3e776c762903a0409234c08b13c..dcb5b1022eb72c50dc1df3654b0c9db7c782517c 100644
index ba1c55c4f2486cae25ce570132d9222f6ab77d49..fe15f8fdb886674278513c5fdbf17f066c9f0b4f 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -341,6 +341,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -49,10 +49,10 @@ index 173c9d06b28db3e776c762903a0409234c08b13c..dcb5b1022eb72c50dc1df3654b0c9db7
}
};
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index f5ccbff7a6b51cf71e28e514d853a500f9acd43f..11907bdf8c2b26d02aac5d7696d5f41d9c7d334d 100644
index d03ca9b30380209397aed5371686e0022bf631d5..e88cae362fa167252aaa785895e378caec6ad757 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -841,6 +841,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -842,6 +842,7 @@ public class ServerChunkCache extends ChunkSource {
public boolean runDistanceManagerUpdates() {
if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority

View File

@ -10,10 +10,10 @@ to be unloaded will simply be unloaded next tick, rather than
immediately.
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 11907bdf8c2b26d02aac5d7696d5f41d9c7d334d..9196be25ff874a0c81868906c5b86bfe4e2968f5 100644
index e88cae362fa167252aaa785895e378caec6ad757..b5c8f3f57d09de4caffeb9f3e20e9bf4daba1cdd 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -908,6 +908,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -909,6 +909,7 @@ public class ServerChunkCache extends ChunkSource {
// CraftBukkit start - modelled on below
public void purgeUnload() {

View File

@ -9,7 +9,7 @@ This patch will be used to optimise out flush calls in later
patches.
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index c327609fdb7641e4dc5fb58d97903fa666eac24d..0b47144cb8ad72efebf10e163f5b442995ef213e 100644
index 3eff1c97dcdc6bd8a0c4b7c5bbead2bd68490a4b..032d65a489d65e9b5b5066dff80c65d2e1b28c82 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -94,6 +94,39 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -91,11 +91,11 @@ index c327609fdb7641e4dc5fb58d97903fa666eac24d..0b47144cb8ad72efebf10e163f5b4429
}
private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1) {
private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1) {
+ // Paper start - add flush parameter
+ this.doSendPacket(packet, genericfuturelistener, enumprotocol, enumprotocol1, true);
+ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, true);
+ }
+ private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1, boolean flush) {
+ private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> callback, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1, boolean flush) {
+ // Paper end - add flush parameter
if (enumprotocol != enumprotocol1) {
this.setProtocol(enumprotocol);
@ -107,8 +107,8 @@ index c327609fdb7641e4dc5fb58d97903fa666eac24d..0b47144cb8ad72efebf10e163f5b4429
- ChannelFuture channelfuture = this.channel.writeAndFlush(packet);
+ ChannelFuture channelfuture = flush ? this.channel.writeAndFlush(packet) : this.channel.write(packet); // Paper - add flush parameter
if (genericfuturelistener != null) {
channelfuture.addListener(genericfuturelistener);
if (callback != null) {
channelfuture.addListener(callback);
@@ -354,6 +400,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
private boolean processQueue() {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Optimise chunk tick iteration
Use a dedicated list of entity ticking chunks to reduce the cost
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 9196be25ff874a0c81868906c5b86bfe4e2968f5..7ea86cbeb72f08d751c14006f428fe5921916061 100644
index b5c8f3f57d09de4caffeb9f3e20e9bf4daba1cdd..d6981bbcf480c5856b51960013d144beba2361b3 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -1006,19 +1006,35 @@ public class ServerChunkCache extends ChunkSource {
@@ -1007,19 +1007,35 @@ public class ServerChunkCache extends ChunkSource {
this.lastSpawnState = spawnercreature_d;
this.level.getProfiler().pop();
@ -54,7 +54,7 @@ index 9196be25ff874a0c81868906c5b86bfe4e2968f5..7ea86cbeb72f08d751c14006f428fe59
chunk.setInhabitedTime(chunk.getInhabitedTime() + j);
if (flag1 && (this.spawnEnemies || this.spawnFriendlies) && this.level.getWorldBorder().isWithinBounds(chunk.getPos()) && !this.chunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, true)) { // Spigot // Paper - optimise isOutsideOfRange
NaturalSpawner.spawnForChunk(this.level, chunk, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag2);
@@ -1029,7 +1045,13 @@ public class ServerChunkCache extends ChunkSource {
@@ -1030,7 +1046,13 @@ public class ServerChunkCache extends ChunkSource {
// this.level.timings.doTickTiles.stopTiming(); // Spigot // Paper
}
}
@ -69,7 +69,7 @@ index 9196be25ff874a0c81868906c5b86bfe4e2968f5..7ea86cbeb72f08d751c14006f428fe59
this.level.timings.chunkTicks.stopTiming(); // Paper
this.level.getProfiler().push("customSpawners");
if (flag1) {
@@ -1038,21 +1060,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -1039,21 +1061,7 @@ public class ServerChunkCache extends ChunkSource {
} // Paper - timings
}

View File

@ -120,10 +120,10 @@ index 98eb8318413014f0650dc5c80125aa84b51cfc93..57cb2722e973cfc8edc845bc7154b8b8
} else {
if (this.haveTime()) {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 7ea86cbeb72f08d751c14006f428fe5921916061..108f2212f8bd00247bf73ff4f3ba42830abad459 100644
index d6981bbcf480c5856b51960013d144beba2361b3..39840403da99252c5d634e99e1da19f6066dee7c 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -1022,6 +1022,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -1023,6 +1023,7 @@ public class ServerChunkCache extends ChunkSource {
Collections.shuffle(shuffled);
iterator = shuffled.iterator();
}
@ -131,7 +131,7 @@ index 7ea86cbeb72f08d751c14006f428fe5921916061..108f2212f8bd00247bf73ff4f3ba4283
try { while (iterator.hasNext()) {
LevelChunk chunk = iterator.next();
ChunkHolder playerchunk = chunk.playerChunk;
@@ -1044,6 +1045,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -1045,6 +1046,7 @@ public class ServerChunkCache extends ChunkSource {
this.level.tickChunk(chunk, k);
// this.level.timings.doTickTiles.stopTiming(); // Spigot // Paper
}

View File

@ -1109,7 +1109,7 @@ index 0000000000000000000000000000000000000000..4eadc15f747528b59349f095171dd5a6
+ }
+}
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 0b47144cb8ad72efebf10e163f5b442995ef213e..03c6cdec727b03c2f61eaae339a2ff58c64d5ebc 100644
index 032d65a489d65e9b5b5066dff80c65d2e1b28c82..580bdaa99129c8edb82b835edfa822892f1cd243 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -93,6 +93,28 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -1176,7 +1176,7 @@ index 82a233b413791eff4bc6b9140b5bbf99354ed671..15fb4ee2066df1c8ce341913a64f350f
worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange);
worldData.addProperty("visible-chunk-count", visibleChunks.size());
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index a98d7b5e755da7ad98d133fc50785e1bf70b4ddd..3db72a4416d3125c37f6c1dc2c3803fbb14b9c97 100644
index a9267e64e54f451c896e35693f469b8563f578f9..326aecc38a7f93fe0d25fb9b772d06f78f99781d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -491,7 +491,7 @@ public class ChunkHolder {
@ -1205,7 +1205,7 @@ index a98d7b5e755da7ad98d133fc50785e1bf70b4ddd..3db72a4416d3125c37f6c1dc2c3803fb
}
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 4d18b217f21ce60b691c6bf964f81129718b8f56..a474e83df65bb48779fe135b14d6a9a3f74d1bf4 100644
index 85c97767cdaf45b24f5764a6a1ef3c56535bb37f..8e0762bc1d705b7df664b6270c4d536f77572b87 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -187,22 +187,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@ -1531,10 +1531,10 @@ index 1cc4e0a1f3d8235ef88b48e01ca8b78a263d2676..0b34536cdffab31a717b613042d70981
+ */ // Paper - replace old loader system
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 108f2212f8bd00247bf73ff4f3ba42830abad459..0d8a47770435c27519af4ebd78835ec787551733 100644
index 39840403da99252c5d634e99e1da19f6066dee7c..6db8c95693772296d947fbc051b97937fd184685 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -928,6 +928,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -929,6 +929,7 @@ public class ServerChunkCache extends ChunkSource {
this.level.timings.doChunkMap.stopTiming(); // Spigot
this.level.getProfiler().popPush("chunks");
this.level.timings.chunks.startTiming(); // Paper - timings
@ -1542,7 +1542,7 @@ index 108f2212f8bd00247bf73ff4f3ba42830abad459..0d8a47770435c27519af4ebd78835ec7
this.tickChunks();
this.level.timings.chunks.stopTiming(); // Paper - timings
this.level.timings.doChunkUnload.startTiming(); // Spigot
@@ -1218,6 +1219,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -1219,6 +1220,7 @@ public class ServerChunkCache extends ChunkSource {
public boolean pollTask() {
try {
boolean execChunkTask = com.destroystokyo.paper.io.chunk.ChunkTaskManager.pollChunkWaitQueue() || ServerChunkCache.this.level.asyncChunkTaskManager.pollNextChunkTask(); // Paper

View File

@ -19,10 +19,10 @@ index eada966d7f108a6081be7a848f5c1dfcb1eed676..a977f7483f37df473096b2234dc1308b
public static final Timing midTickChunkTasks = Timings.ofSafe("Mid Tick Chunk Tasks");
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 0d8a47770435c27519af4ebd78835ec787551733..d7ec783caebd71364c1c3a414bcf1aac271b0574 100644
index 6db8c95693772296d947fbc051b97937fd184685..6589baa5680a154e47e7e28223e2214ca36790f3 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -842,6 +842,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -843,6 +843,7 @@ public class ServerChunkCache extends ChunkSource {
public boolean runDistanceManagerUpdates() {
if (distanceManager.delayDistanceManagerTick) return false; // Paper - Chunk priority
if (this.chunkMap.unloadingPlayerChunk) { net.minecraft.server.MinecraftServer.LOGGER.fatal("Cannot tick distance manager while unloading playerchunks", new Throwable()); throw new IllegalStateException("Cannot tick distance manager while unloading playerchunks"); } // Paper
@ -30,7 +30,7 @@ index 0d8a47770435c27519af4ebd78835ec787551733..d7ec783caebd71364c1c3a414bcf1aac
boolean flag = this.distanceManager.runAllUpdates(this.chunkMap);
boolean flag1 = this.chunkMap.promoteChunkMap();
@@ -851,6 +852,7 @@ public class ServerChunkCache extends ChunkSource {
@@ -852,6 +853,7 @@ public class ServerChunkCache extends ChunkSource {
this.clearCache();
return true;
}

View File

@ -22,10 +22,10 @@ With this change I could get all 200 on at 0ms ping.
So in general this patch should reduce Netty I/O thread load.
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index d7ec783caebd71364c1c3a414bcf1aac271b0574..7470f3ba66c2e894b5a5b0ba392ecabf8b04aff9 100644
index 6589baa5680a154e47e7e28223e2214ca36790f3..4a3dbcfdacb809d162663c379c4e8151be522432 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -1069,7 +1069,24 @@ public class ServerChunkCache extends ChunkSource {
@@ -1070,7 +1070,24 @@ public class ServerChunkCache extends ChunkSource {
this.level.getProfiler().pop();
}