From 2b72b74a36b9e4009bbdb5a30f4b9ad9020d5594 Mon Sep 17 00:00:00 2001 From: Noah van der Aa Date: Thu, 21 Sep 2023 21:00:11 +0200 Subject: [PATCH] more work --- .../server/0009-MC-Utils.patch | 204 ++++---- .../server/0010-Adventure.patch | 489 +++++++++--------- .../server/0011-Paper-command.patch | 8 +- .../server/0012-Paper-Metrics.patch | 2 +- .../server/0013-Paper-Plugins.patch | 22 +- .../server/0014-Timings-v2.patch | 165 +++--- 6 files changed, 430 insertions(+), 460 deletions(-) rename patches/{unapplied => }/server/0009-MC-Utils.patch (97%) rename patches/{unapplied => }/server/0010-Adventure.patch (94%) rename patches/{unapplied => }/server/0011-Paper-command.patch (98%) rename patches/{unapplied => }/server/0012-Paper-Metrics.patch (99%) rename patches/{unapplied => }/server/0013-Paper-Plugins.patch (99%) rename patches/{unapplied => }/server/0014-Timings-v2.patch (94%) diff --git a/patches/unapplied/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch similarity index 97% rename from patches/unapplied/server/0009-MC-Utils.patch rename to patches/server/0009-MC-Utils.patch index 597ed4c2f6..c03d31609e 100644 --- a/patches/unapplied/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -5468,10 +5468,10 @@ index 0000000000000000000000000000000000000000..808d1449ac44ae86a650932365081fba + } +} diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 90edfea7151f2ad259288545d512af7cd1b82f19..01eb418bde1dadbbfa30954f81281199b2fec778 100644 +index 092bfedfb32c38550d1cab1b696feac6df09131f..9870eccc1dc5c2201f12f8e2affe647f6b0375f8 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -117,7 +117,7 @@ public class Util { +@@ -118,7 +118,7 @@ public class Util { } public static long getNanos() { @@ -5501,10 +5501,10 @@ index 2bb5e51f71cbf66819d198505aa4a5ecffd246c6..1834f3efb05fd70c8c1c67733bff5148 @Override public BlockPos immutable() { diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index 29664f7f44ad7dec9cbccd276a14937ca1c4a3bb..64765dab6fed87ffdf4af197d8d5f28a04544db0 100644 +index 666df22c8f847ef7152669540a3844566ef90d78..92095b494a0c4fb89b84f0b1c0376615d28e34ce 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java -@@ -123,7 +123,7 @@ public class CompoundTag implements Tag { +@@ -160,7 +160,7 @@ public class CompoundTag implements Tag { return "TAG_Compound"; } }; @@ -5513,7 +5513,7 @@ index 29664f7f44ad7dec9cbccd276a14937ca1c4a3bb..64765dab6fed87ffdf4af197d8d5f28a protected CompoundTag(Map entries) { this.tags = entries; -@@ -199,6 +199,10 @@ public class CompoundTag implements Tag { +@@ -236,6 +236,10 @@ public class CompoundTag implements Tag { this.tags.put(key, NbtUtils.createUUID(value)); } @@ -5525,23 +5525,23 @@ index 29664f7f44ad7dec9cbccd276a14937ca1c4a3bb..64765dab6fed87ffdf4af197d8d5f28a return NbtUtils.loadUUID(this.get(key)); } diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index e6c4379b0fd7c1338e1713281cd9515cb54acecb..a63e7ee5c42bd51312155feab31c6ec4232e1bc7 100644 +index 427959874b7f167184785a582163029ad4a66df2..344c5af75c4a66bb27f3f422937c6c427c15ed25 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java -@@ -45,7 +45,7 @@ public class PacketEncoder extends MessageToByteEncoder> { - JvmProfiler.INSTANCE.onPacketSent(l, i, channelHandlerContext.channel().remoteAddress(), k); - } - } catch (Throwable var10) { -- LOGGER.error("Error receiving packet {}", i, var10); -+ LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var10); // Paper - Give proper error message +@@ -46,7 +46,7 @@ public class PacketEncoder extends MessageToByteEncoder> { + + JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k); + } catch (Throwable var13) { +- LOGGER.error("Error receiving packet {}", i, var13); ++ LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var13); // Paper - Give proper error message if (packet.isSkippable()) { - throw new SkipPacketException(var10); - } else { + throw new SkipPacketException(var13); + } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8c7d762219e848387b153fb50553b7de58bc9627..e896917b3546f9d075179198c6dcd714f6cddd50 100644 +index 124fad1031d6125bca233541e2d5f256da70ca44..2a7c614df7b9c9405a5dd23e6a888ede7fc86683 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -295,6 +295,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function serverFactory) { AtomicReference atomicreference = new AtomicReference(); -@@ -928,6 +929,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop chunkToSave; @Nullable private final DebugBuffer chunkToSaveHistory; -@@ -70,6 +70,18 @@ public class ChunkHolder { - private boolean wasAccessibleSinceLastSave; +@@ -71,6 +71,18 @@ public class ChunkHolder { private CompletableFuture pendingFullStateConfirmation; + private CompletableFuture sendSync; + private final ChunkMap chunkMap; // Paper + @@ -5624,7 +5624,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c public ChunkHolder(ChunkPos pos, int level, LevelHeightAccessor world, LevelLightEngine lightingProvider, ChunkHolder.LevelChangeListener levelUpdateListener, ChunkHolder.PlayerProvider playersWatchingChunkProvider) { this.futures = new AtomicReferenceArray(ChunkHolder.CHUNK_STATUSES.size()); this.fullChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; -@@ -90,8 +102,23 @@ public class ChunkHolder { +@@ -92,8 +104,23 @@ public class ChunkHolder { this.queueLevel = this.oldTicketLevel; this.setTicketLevel(level); this.changedBlocksPerSection = new ShortSet[world.getSectionsCount()]; @@ -5648,7 +5648,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c // CraftBukkit start public LevelChunk getFullChunkNow() { // Note: We use the oldTicketLevel for isLoaded checks. -@@ -116,20 +143,20 @@ public class ChunkHolder { +@@ -118,20 +145,20 @@ public class ChunkHolder { return ChunkLevel.generationStatus(this.ticketLevel).isOrAfter(leastStatus) ? this.getFutureIfPresentUnchecked(leastStatus) : ChunkHolder.UNLOADED_CHUNK_FUTURE; } @@ -5673,7 +5673,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c CompletableFuture> completablefuture = this.getTickingChunkFuture(); Either either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error -@@ -137,7 +164,7 @@ public class ChunkHolder { +@@ -148,7 +175,7 @@ public class ChunkHolder { } @Nullable @@ -5682,7 +5682,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c CompletableFuture> completablefuture = this.getFullChunkFuture(); Either either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error -@@ -158,6 +185,21 @@ public class ChunkHolder { +@@ -169,6 +196,21 @@ public class ChunkHolder { return null; } @@ -5704,7 +5704,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c @Nullable public ChunkAccess getLastAvailable() { for (int i = ChunkHolder.CHUNK_STATUSES.size() - 1; i >= 0; --i) { -@@ -176,7 +218,7 @@ public class ChunkHolder { +@@ -187,7 +229,7 @@ public class ChunkHolder { return null; } @@ -5713,7 +5713,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c return this.chunkToSave; } -@@ -364,11 +406,11 @@ public class ChunkHolder { +@@ -386,11 +428,11 @@ public class ChunkHolder { return ChunkLevel.fullStatus(this.ticketLevel); } @@ -5727,7 +5727,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c return this.ticketLevel; } -@@ -457,14 +499,31 @@ public class ChunkHolder { +@@ -479,14 +521,31 @@ public class ChunkHolder { this.wasAccessibleSinceLastSave |= flag3; if (!flag2 && flag3) { @@ -5759,7 +5759,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c } boolean flag4 = fullchunkstatus.isOrAfter(FullChunkStatus.BLOCK_TICKING); -@@ -473,11 +532,25 @@ public class ChunkHolder { +@@ -495,11 +554,25 @@ public class ChunkHolder { if (!flag4 && flag5) { this.tickingChunkFuture = chunkStorage.prepareTickingChunk(this); this.scheduleFullChunkPromotion(chunkStorage, this.tickingChunkFuture, executor, FullChunkStatus.BLOCK_TICKING); @@ -5786,7 +5786,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c this.tickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; } -@@ -491,11 +564,24 @@ public class ChunkHolder { +@@ -513,11 +586,24 @@ public class ChunkHolder { this.entityTickingChunkFuture = chunkStorage.prepareEntityTickingChunk(this); this.scheduleFullChunkPromotion(chunkStorage, this.entityTickingChunkFuture, executor, FullChunkStatus.ENTITY_TICKING); @@ -5812,7 +5812,7 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c this.entityTickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; } -@@ -593,4 +679,18 @@ public class ChunkHolder { +@@ -615,4 +701,18 @@ public class ChunkHolder { } }; } @@ -5832,18 +5832,10 @@ index 6d4cd75b9dbddce30b92f83fef96ec0a47e1fe9d..32d186fefa5ff8afedcceacea0c6fa1c + // Paper end } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a185172664c5e4 100644 +index e9cf8686b59c232816b2fde92fc6616f77979a64..a7c18ca224c536b7b97d5889af321f23e637b420 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -68,6 +68,7 @@ import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket; - import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; - import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; - import net.minecraft.network.protocol.game.DebugPackets; -+import io.papermc.paper.util.MCUtil; - import net.minecraft.server.level.progress.ChunkProgressListener; - import net.minecraft.server.network.ServerPlayerConnection; - import net.minecraft.util.CsvOutput; -@@ -175,6 +176,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -167,6 +167,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }; // CraftBukkit end @@ -5851,8 +5843,8 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 + private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); + + void addPlayerToDistanceMaps(ServerPlayer player) { -+ int chunkX = MCUtil.getChunkCoordinate(player.getX()); -+ int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); ++ int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX()); ++ int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ()); + // Note: players need to be explicitly added to distance maps before they can be updated + } + @@ -5861,8 +5853,8 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 + } + + void updateMaps(ServerPlayer player) { -+ int chunkX = MCUtil.getChunkCoordinate(player.getX()); -+ int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); ++ int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX()); ++ int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ()); + // Note: players need to be explicitly added to distance maps before they can be updated + } + // Paper end @@ -5900,10 +5892,10 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier persistentStateManagerFactory, int viewDistance, boolean dsync) { super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync); this.visibleChunkMap = this.updatingChunkMap.clone(); -@@ -228,6 +279,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -220,6 +270,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.overworldDataStorage = persistentStateManagerFactory; this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, iregistrycustom, world); - this.setViewDistance(viewDistance); + this.setServerViewDistance(viewDistance); + // Paper start + this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new); + this.regionManagers.add(this.dataRegionManager); @@ -5911,7 +5903,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 } protected ChunkGenerator generator() { -@@ -324,6 +379,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -321,6 +375,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -5927,7 +5919,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 private CompletableFuture, ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture(ChunkHolder centerChunk, int margin, IntFunction distanceToStatus) { if (margin == 0) { ChunkStatus chunkstatus = (ChunkStatus) distanceToStatus.apply(0); -@@ -420,9 +484,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -417,9 +480,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }; stringbuilder.append("Updating:").append(System.lineSeparator()); @@ -5939,7 +5931,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 CrashReport crashreport = CrashReport.forThrowable(exception, "Chunk loading"); CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Chunk loading"); -@@ -464,8 +528,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -461,8 +524,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider holder.setTicketLevel(level); } else { holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this); @@ -5954,16 +5946,16 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 this.updatingChunkMap.put(pos, holder); this.modified = true; } -@@ -487,7 +557,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -484,7 +553,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider protected void saveAllChunks(boolean flush) { if (flush) { -- List list = (List) this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); -+ List list = (List) io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(this.level).stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).collect(Collectors.toList()); // Paper +- List list = this.visibleChunkMap.values().stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).toList(); ++ List list = io.papermc.paper.chunk.system.ChunkSystem.getVisibleChunkHolders(this.level).stream().filter(ChunkHolder::wasAccessibleSinceLastSave).peek(ChunkHolder::refreshAccessibility).toList(); // Paper MutableBoolean mutableboolean = new MutableBoolean(); do { -@@ -516,7 +586,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -513,7 +582,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); this.flushWorker(); } else { @@ -5972,7 +5964,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 } } -@@ -535,7 +605,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -532,7 +601,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public boolean hasWork() { @@ -5981,7 +5973,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 } private void processUnloads(BooleanSupplier shouldKeepTicking) { -@@ -546,6 +616,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -543,6 +612,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j); if (playerchunk != null) { @@ -5989,7 +5981,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 this.pendingUnloads.put(j, playerchunk); this.modified = true; ++i; -@@ -563,7 +634,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -560,7 +630,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } int l = 0; @@ -5998,7 +5990,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 while (l < 20 && shouldKeepTicking.getAsBoolean() && objectiterator.hasNext()) { if (this.saveChunkIfNeeded((ChunkHolder) objectiterator.next())) { -@@ -581,7 +652,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -578,7 +648,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (completablefuture1 != completablefuture) { this.scheduleUnload(pos, holder); } else { @@ -6011,7 +6003,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 if (ichunkaccess instanceof LevelChunk) { ((LevelChunk) ichunkaccess).setLoaded(false); } -@@ -597,7 +672,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -594,7 +668,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lightEngine.tryScheduleUpdate(); this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null); this.chunkSaveCooldowns.remove(ichunkaccess.getPos().toLong()); @@ -6022,16 +6014,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 } }; -@@ -991,7 +1068,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - - this.viewDistance = j; - this.distanceManager.updatePlayerTickets(this.viewDistance); -- ObjectIterator objectiterator = this.updatingChunkMap.values().iterator(); -+ Iterator objectiterator = io.papermc.paper.chunk.system.ChunkSystem.getUpdatingChunkHolders(this.level).iterator(); // Paper - - while (objectiterator.hasNext()) { - ChunkHolder playerchunk = (ChunkHolder) objectiterator.next(); -@@ -1034,7 +1111,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1037,7 +1113,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public int size() { @@ -6040,7 +6023,7 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 } public DistanceManager getDistanceManager() { -@@ -1042,19 +1119,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1045,19 +1121,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } protected Iterable getChunks() { @@ -6065,32 +6048,33 @@ index de34a02c44043b6f90806eeef94a232e6b3c845b..c943e64d70bab240f8dc733e78a18517 Optional optional = Optional.ofNullable(playerchunk.getLastAvailable()); Optional optional1 = optional.flatMap((ichunkaccess) -> { return ichunkaccess instanceof LevelChunk ? Optional.of((LevelChunk) ichunkaccess) : Optional.empty(); -@@ -1180,6 +1257,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - if (!flag1) { - this.distanceManager.addPlayer(SectionPos.of((EntityAccess) player), player); - } +@@ -1182,6 +1258,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + + player.setChunkTrackingView(ChunkTrackingView.EMPTY); + this.updateChunkTracking(player); + this.addPlayerToDistanceMaps(player); // Paper - distance maps } else { SectionPos sectionposition = player.getLastSectionPos(); -@@ -1187,6 +1265,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - if (!flag2) { +@@ -1190,6 +1267,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.distanceManager.removePlayer(sectionposition, player); } + + this.removePlayerFromDistanceMaps(player); // Paper - distance maps ++ } ++ + this.applyChunkTrackingView(player, ChunkTrackingView.EMPTY); } - for (int k = i - this.viewDistance - 1; k <= i + this.viewDistance + 1; ++k) { -@@ -1300,6 +1379,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - } +@@ -1241,6 +1321,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + this.updateChunkTracking(player); } + this.updateMaps(player); // Paper - distance maps -+ } - @Override -@@ -1536,7 +1617,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + private void updateChunkTracking(ServerPlayer player) { +@@ -1493,7 +1574,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider private class ChunkDistanceManager extends DistanceManager { protected ChunkDistanceManager(Executor workerExecutor, Executor mainThreadExecutor) { @@ -6145,7 +6129,7 @@ index 1bfa33253a154c66dc8b7e476c777b74cda8999f..d8b83c8c89143d78620f812c491a1950 while (objectiterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 2bc9afcd46f2d42e8bab1cf29defe53d00b2bc8b..5115342b51ccefe4430df47a498bc59b1d96bb0e 100644 +index 6c94ffc01377e3a066771509727e62521b2cea78..f402341b95c7752a2706edd502098696f786f4ef 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -51,6 +51,7 @@ import net.minecraft.world.level.storage.LevelStorageSource; @@ -6452,7 +6436,7 @@ index 2bc9afcd46f2d42e8bab1cf29defe53d00b2bc8b..5115342b51ccefe4430df47a498bc59b ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos); diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ebae711991a3ae35e35c2cffa8d928677c205492..7be97441aed66fa3a21d13ad2211b3e0e08120c0 100644 +index 32565740c6b013d9ad644e7c62d6721bdbd15b10..e2eff46cae9771931b2e0dfee5e73fd4842e3ab5 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -176,6 +176,7 @@ import org.bukkit.event.weather.LightningStrikeEvent; @@ -6563,21 +6547,21 @@ index ebae711991a3ae35e35c2cffa8d928677c205492..7be97441aed66fa3a21d13ad2211b3e0 public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 07220c52935369555f652bdd94692eec910d0fe2..d06430d59259849715e1457a75fd4f52406a34c2 100644 +index fb5043e69ef59623c51b88176914f9f8becfc9ae..084339c7da80ce21ab8405e20b76af87dbbbe8ce 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -255,6 +255,8 @@ public class ServerPlayer extends Player { - public Integer clientViewDistance; +@@ -251,6 +251,8 @@ public class ServerPlayer extends Player { + public boolean sentListPacket = false; public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent // CraftBukkit end + public boolean isRealPlayer; // Paper + public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper - public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) { + public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) { super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); @@ -319,6 +321,8 @@ public class ServerPlayer extends Player { - this.setMaxUpStep(1.0F); this.fudgeSpawnLocation(world); + this.updateOptions(clientOptions); + this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper + @@ -6628,13 +6612,13 @@ index a63d5ba706a5b8e430aedc045bdeb3a410bd0eef..e96a0ca47e4701ba187555bd92c96834 public BlockState getBlockState(BlockPos pos) { return this.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ())).getBlockState(pos); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index d1a94a7de19b0c46454040f7459a492e30265e9c..edf629f2e810eebf014b1565021888f96def92a1 100644 +index 0fcac9b089e030b387d1b4c79c26e69ed9dcf4ed..10b263b2693a6b507c858b6550b5b98a53cea575 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -185,6 +185,7 @@ public abstract class PlayerList { +@@ -178,6 +178,7 @@ public abstract class PlayerList { } - public void placeNewPlayer(Connection connection, ServerPlayer player) { + public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) { + player.isRealPlayer = true; // Paper GameProfile gameprofile = player.getGameProfile(); GameProfileCache usercache = this.server.getProfileCache(); @@ -6658,7 +6642,7 @@ index 337e0a7b3c14e1b1a28744920e0dc0a69e0c5a87..f5829ae484d93b547a5437b85a962134 @Override public void tell(R runnable) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4d344101aa082c297611daa4d1b0006b85fcb7c8..78c7c779209972186b1244fb678d7208b38e30e3 100644 +index 0863d7acce248895d57a4c0496881b542e4b79f1..6c5000ff3dbb7517d095e9fb2cdf555212b2c090 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -323,6 +323,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -6674,7 +6658,7 @@ index 4d344101aa082c297611daa4d1b0006b85fcb7c8..78c7c779209972186b1244fb678d7208 public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d6d16f54ed22f8bc025ab6a5c7bd998ec1a44145..861f366e05af1c2bf5bbc8a4e752e3fb675747ae 100644 +index 96f94f11d5d98cddf98020fdbf5ec658d6d53f38..e24e61a35fe9cffce4a2174d46b88cf934f4b69f 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -258,6 +258,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -6686,10 +6670,10 @@ index d6d16f54ed22f8bc025ab6a5c7bd998ec1a44145..861f366e05af1c2bf5bbc8a4e752e3fb @Override public float getBukkitYaw() { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 0762cdf228b8abc69125485a446d16e9482fdca2..fd7a381d6fc9436f06b5a3e3508b8a4a0f4ece66 100644 +index 6041f79ad8e2b61b438b19b5569ab02936a0be99..ec841a4d9a11f0d9047c202a31f944b340da33c8 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -275,6 +275,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -276,6 +276,7 @@ public abstract class Mob extends LivingEntity implements Targeting { return this.target; } @@ -6698,10 +6682,10 @@ index 0762cdf228b8abc69125485a446d16e9482fdca2..fd7a381d6fc9436f06b5a3e3508b8a4a // CraftBukkit start - fire event this.setTarget(target, EntityTargetEvent.TargetReason.UNKNOWN, true); diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -index 9aa82c1d8743076e7737d5b0d14ea36687e87723..d8ce7ea5fcb2785435ec1f530cb6e7114c01e4b7 100644 +index 21fa43e0c3fabf74919f7e41d074ab1f7c061967..5e9cf929674888b3a143a0691dc6936b304467f1 100644 --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -@@ -18,6 +18,8 @@ public abstract class PathfinderMob extends Mob { +@@ -20,6 +20,8 @@ public abstract class PathfinderMob extends Mob { super(type, world); } @@ -6723,10 +6707,10 @@ index a0b5895abc88d297045e05f25bb09527991d43f0..6e0bd0eab0b06a4ac3042496bbb91292 super(type, world); this.xpReward = 5; diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index 194c67d034daf6c584e903721aaf067a243302d5..3f18fb61a47dda559a6997af9c6c043423dd206a 100644 +index 099daefa53b930a9a94ed91ef3fcd9e1607bfd09..1b2c0fda262ca6d5bd2ce22bc2e934803bd6f602 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -793,6 +793,25 @@ public final class ItemStack { +@@ -798,6 +798,25 @@ public final class ItemStack { return this.tag != null ? this.tag.getList("Enchantments", 10) : new ListTag(); } @@ -6752,7 +6736,7 @@ index 194c67d034daf6c584e903721aaf067a243302d5..3f18fb61a47dda559a6997af9c6c0434 public void setTag(@Nullable CompoundTag nbt) { this.tag = nbt; if (this.getItem().canBeDepleted()) { -@@ -1183,6 +1202,7 @@ public final class ItemStack { +@@ -1187,6 +1206,7 @@ public final class ItemStack { // CraftBukkit start @Deprecated public void setItem(Item item) { @@ -6789,7 +6773,7 @@ index 1c71d2c1b16bdba1e14a8230787e4cb4ad530163..d6d8bbc98fc71997cb52521d59ebb59d FluidState getFluidState(BlockPos pos); diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java -index a3040440ed34a1c2adca2d57d458504a4a48282f..2d41f619577b41d6420159668bbab70fb6c762eb 100644 +index 43bb3f5a617f4a6d719b02023a71edcb12aa9d05..34457c8afb4575d2395148f0a2bde6a96ec5e797 100644 --- a/src/main/java/net/minecraft/world/level/ChunkPos.java +++ b/src/main/java/net/minecraft/world/level/ChunkPos.java @@ -20,6 +20,7 @@ public class ChunkPos { @@ -7010,7 +6994,7 @@ index 249b3ed33672a9a9529bd14de978722b62019314..0f1025495237aebe30132ace0832aa57 public WorldBorder getWorldBorder() { return this.level.getWorldBorder(); 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 ccb3ceddd8f60f59473cd24d6ca5282f6e51f630..88b1aabec2812252c54d0901ccd1eba0216cb7c3 100644 +index fefeccaf347da1be9342df09fafabb6fcc3be4ae..2b8e88a75e9a974e1ecafe0360a9d69b79326d11 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 @@ -754,8 +754,8 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -7089,7 +7073,7 @@ index 532a0cae6db0d830e720a72e9021aa7a8ed0f106..e5e562f75e7d4b6a750f192842940c5e this.levelHeightAccessor = heightLimitView; this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()]; 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 36c3a06a94177ec21cfc5c513d16f7168fe2fe2c..e4deb276f956c5f292ab8bf7836eeeffd6ed59d5 100644 +index 4185b7528ac757a2d6ebca4da4d46e65b7a981d0..b32e1bba27c91e81b7382072c4d8230db695066c 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -114,6 +114,109 @@ public class LevelChunk extends ChunkAccess { @@ -7382,7 +7366,7 @@ index 8adac67a9315186d1ef453eae827ea7f69856f7a..153143b06fc088f3142a8fa17f153d8a + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index b5544bbfcf4449bdf588a14a9afe518f272e8261..5e8ec70a58c047969a144355782da58aee44b288 100644 +index 32adc1cee4dfe49a9a0009ab39382083001e6cbe..74f431e806a4c5abb7ddd193c1b5f7ba7f321cac 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1186,4 +1186,37 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -7667,10 +7651,10 @@ index 0000000000000000000000000000000000000000..909b2c98e7a9117d2f737245e4661792 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index afde61e784dada8df1f34bd15b1d3b71e842bb52..6deffd223ff995d83244e941576f8286e1171c1f 100644 +index d2942ef34c6d68d57caec9f1209c2dcdd277c36d..35d2a206d4a36292c16e29247c950c2a69af2879 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -104,8 +104,17 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -105,8 +105,17 @@ public final class CraftMagicNumbers implements UnsafeValues { private static final BiMap FLUIDTYPE_FLUID = HashBiMap.create(); private static final Map MATERIAL_ITEM = new HashMap<>(); private static final Map MATERIAL_BLOCK = new HashMap<>(); @@ -7688,7 +7672,7 @@ index afde61e784dada8df1f34bd15b1d3b71e842bb52..6deffd223ff995d83244e941576f8286 for (Block block : BuiltInRegistries.BLOCK) { BLOCK_MATERIAL.put(block, Material.getMaterial(BuiltInRegistries.BLOCK.getKey(block).getPath().toUpperCase(Locale.ROOT))); } -@@ -169,6 +178,14 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -170,6 +179,14 @@ public final class CraftMagicNumbers implements UnsafeValues { public static ResourceLocation key(Material mat) { return CraftNamespacedKey.toMinecraft(mat.getKey()); } diff --git a/patches/unapplied/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch similarity index 94% rename from patches/unapplied/server/0010-Adventure.patch rename to patches/server/0010-Adventure.patch index e8f69c4320..3f59a6fb1b 100644 --- a/patches/unapplied/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -1647,7 +1647,7 @@ index 98f2def9125d6faf5859572a004fa8d2fa066417..436f381c727cda72c04859c540dce471 public static ChatFormatting getById(int colorIndex) { if (colorIndex < 0) { diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java -index 5aa9be9b4b89352784835c4bbf25023a3304c0c8..fb381a7f3362b5c7848f9c326e9378b76f6fdad9 100644 +index 099d76e9b508167c1592215ea799187af6ebc594..2ee328f204acf97b23702b4dc3b13b7f33b97a8e 100644 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java @@ -65,6 +65,7 @@ public class CommandSourceStack implements SharedSuggestionProvider { @@ -1659,37 +1659,40 @@ index 5aa9be9b4b89352784835c4bbf25023a3304c0c8..fb381a7f3362b5c7848f9c326e9378b7 public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) { this(output, pos, rot, world, level, name, displayName, server, entity, false, (commandcontext, flag, j) -> { diff --git a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java -index 42242735f8f85b1852381a9f77368527203172b4..4d0694c478d476717fd11f8975955c1741b47abf 100644 +index d02410383650267d9f022df7accae06b43f6d9b6..517a0c0029b0f0e1ec9d112d40c3d1ae48ab43a6 100644 --- a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java +++ b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java -@@ -50,10 +50,10 @@ public class MessageArgument implements SignedArgument +@@ -51,10 +51,10 @@ public class MessageArgument implements SignedArgument private static void resolveSignedMessage(Consumer callback, CommandSourceStack source, PlayerChatMessage message) { MinecraftServer minecraftServer = source.getServer(); CompletableFuture completableFuture = filterPlainText(source, message); -- CompletableFuture completableFuture2 = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent()); -+ CompletableFuture completableFuture2 = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent()); // Paper +- Component component = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent()); ++ CompletableFuture componentFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent()); // Paper source.getChatMessageChainer().append((executor) -> { - return CompletableFuture.allOf(completableFuture, completableFuture2).thenAcceptAsync((void_) -> { -- PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(completableFuture2.join()).filter(completableFuture.join().mask()); -+ PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(completableFuture2.join().component()).filter(completableFuture.join().mask()); // Paper +- return completableFuture.thenAcceptAsync((filtered) -> { +- PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(component).filter(filtered.mask()); ++ return CompletableFuture.allOf(completableFuture, componentFuture).thenAcceptAsync((filtered) -> { ++ PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(componentFuture.join().component()).filter(completableFuture.join().mask()); // Paper callback.accept(playerChatMessage2); }, executor); }); -@@ -61,10 +61,10 @@ public class MessageArgument implements SignedArgument +@@ -62,8 +62,12 @@ public class MessageArgument implements SignedArgument private static void resolveDisguisedMessage(Consumer callback, CommandSourceStack source, PlayerChatMessage message) { - MinecraftServer minecraftServer = source.getServer(); -- CompletableFuture completableFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent()); -+ CompletableFuture completableFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent()); // Paper - source.getChatMessageChainer().append((executor) -> { - return completableFuture.thenAcceptAsync((content) -> { -- callback.accept(message.withUnsignedContent(content)); -+ callback.accept(message.withUnsignedContent(content.component())); // Paper - }, executor); - }); + ChatDecorator chatDecorator = source.getServer().getChatDecorator(); +- Component component = chatDecorator.decorate(source.getPlayer(), message.decoratedContent()); +- callback.accept(message.withUnsignedContent(component)); ++ // Paper start ++ CompletableFuture componentFuture = chatDecorator.decorate(source.getPlayer(), source, message.decoratedContent()); ++ componentFuture.thenAcceptAsync((result) -> { ++ callback.accept(message.withUnsignedContent(result.component())); ++ }, source.getServer().chatExecutor); ++ // Paper end } + + private static CompletableFuture filterPlainText(CommandSourceStack source, PlayerChatMessage message) { diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java -index ca5d08eb4115817f846b312fe35f4ab28a099401..f25b9330e068c7d9e12cb57a7761cfef9ebaf7bc 100644 +index d120fff432d9c4fc7a35ddffdc4186459e45e950..73c15a0c56a103ba4e62f0a51af8d42566b07245 100644 --- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java +++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java @@ -92,7 +92,7 @@ public class EntitySelector { @@ -1702,72 +1705,66 @@ index ca5d08eb4115817f846b312fe35f4ab28a099401..f25b9330e068c7d9e12cb57a7761cfef } } diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -index 5fb11741ca75b06322de00624353687c28df81a2..9020bc6d9ff6bc0c9b3f00470813f3258554cf45 100644 +index db98858806a3b6fd3c16ff2226447d0d5960b6b6..7720470396d3ade926c4c75c5fab5a3f435b0033 100644 --- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java +++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java -@@ -22,6 +22,7 @@ import io.netty.handler.codec.EncoderException; - import io.netty.util.ByteProcessor; - import it.unimi.dsi.fastutil.ints.IntArrayList; - import it.unimi.dsi.fastutil.ints.IntList; -+import io.papermc.paper.adventure.PaperAdventure; // Paper - import java.io.DataOutput; - import java.io.IOException; - import java.io.InputStream; -@@ -89,6 +90,7 @@ public class FriendlyByteBuf extends ByteBuf { - private static final int MAX_VARLONG_SIZE = 10; +@@ -86,6 +86,7 @@ public class FriendlyByteBuf extends ByteBuf { + public static final int DEFAULT_NBT_QUOTA = 2097152; private final ByteBuf source; + public java.util.Locale adventure$locale; // Paper public static final short MAX_STRING_LENGTH = 32767; public static final int MAX_COMPONENT_STRING_LENGTH = 262144; private static final int PUBLIC_KEY_SIZE = 256; -@@ -542,8 +544,15 @@ public class FriendlyByteBuf extends ByteBuf { +@@ -527,8 +528,15 @@ public class FriendlyByteBuf extends ByteBuf { } } + // Paper start + public FriendlyByteBuf writeComponent(final net.kyori.adventure.text.Component component) { -+ return this.writeUtf(PaperAdventure.asJsonString(component, this.adventure$locale), 262144); ++ return this.writeUtf(io.papermc.paper.adventure.PaperAdventure.asJsonString(component, this.adventure$locale), 262144); + } + // Paper end + public FriendlyByteBuf writeComponent(Component text) { - return this.writeUtf(Component.Serializer.toJson(text), 262144); + //return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); // Paper - comment -+ return this.writeUtf(PaperAdventure.asJsonString(text, this.adventure$locale), 262144); // Paper ++ return this.writeUtf(io.papermc.paper.adventure.PaperAdventure.asJsonString(text, this.adventure$locale), 262144); // Paper } public > T readEnum(Class enumClass) { diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index a63e7ee5c42bd51312155feab31c6ec4232e1bc7..42828edf81bd475b673a9d143f79c0d0711f14f5 100644 +index 344c5af75c4a66bb27f3f422937c6c427c15ed25..3d359f80f52bff6f19fcb484f491a874f9dcff27 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java -@@ -4,6 +4,7 @@ import com.mojang.logging.LogUtils; - import io.netty.buffer.ByteBuf; - import io.netty.channel.ChannelHandlerContext; - import io.netty.handler.codec.MessageToByteEncoder; -+import io.papermc.paper.adventure.PaperAdventure; // Paper - import java.io.IOException; - import net.minecraft.network.protocol.Packet; - import net.minecraft.network.protocol.PacketFlow; -@@ -33,6 +34,7 @@ public class PacketEncoder extends MessageToByteEncoder> { +@@ -35,6 +35,7 @@ public class PacketEncoder extends MessageToByteEncoder> { } else { FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf); friendlyByteBuf.writeVarInt(i); -+ friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper ++ friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper try { int j = friendlyByteBuf.writerIndex(); diff --git a/src/main/java/net/minecraft/network/chat/ChatDecorator.java b/src/main/java/net/minecraft/network/chat/ChatDecorator.java -index 825ab7534f1ad9787ae2a6c2bf9a300f52cbfc95..53be8a43d784db5e8450c242adeb06f3fab2717a 100644 +index 887b9fd625aa23c4ec828a175d63695f915232d3..8152420b9c3eb1bf13c012dd43505d9913fb9c4d 100644 --- a/src/main/java/net/minecraft/network/chat/ChatDecorator.java +++ b/src/main/java/net/minecraft/network/chat/ChatDecorator.java -@@ -10,5 +10,64 @@ public interface ChatDecorator { - return CompletableFuture.completedFuture(message); +@@ -2,12 +2,72 @@ package net.minecraft.network.chat; + + import javax.annotation.Nullable; + import net.minecraft.server.level.ServerPlayer; ++import java.util.concurrent.CompletableFuture; // Paper + + @FunctionalInterface + public interface ChatDecorator { + ChatDecorator PLAIN = (sender, message) -> { +- return message; ++ return CompletableFuture.completedFuture(message); // Paper }; +- Component decorate(@Nullable ServerPlayer sender, Component message); + @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper - CompletableFuture decorate(@Nullable ServerPlayer sender, Component message); ++ CompletableFuture decorate(@Nullable ServerPlayer sender, Component message); // Paper - make a completable future again + + // Paper start + default CompletableFuture decorate(@Nullable ServerPlayer sender, @Nullable net.minecraft.commands.CommandSourceStack commandSourceStack, Component message) { @@ -1828,7 +1825,7 @@ index 825ab7534f1ad9787ae2a6c2bf9a300f52cbfc95..53be8a43d784db5e8450c242adeb06f3 + // Paper end } diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java -index 8f5e07047f88138422ae82143a80427be869a760..37fc353c3e59dd5af2fd6c58ac084fb0e6e155d7 100644 +index 1f1c75d8d155989e0f9f7ee63d217a60af20c3d4..b540ce21c65ad52ad7e94d2ca2b3926c0875bee1 100644 --- a/src/main/java/net/minecraft/network/chat/Component.java +++ b/src/main/java/net/minecraft/network/chat/Component.java @@ -1,6 +1,7 @@ @@ -1856,10 +1853,10 @@ index 8f5e07047f88138422ae82143a80427be869a760..37fc353c3e59dd5af2fd6c58ac084fb0 if (!ichatbasecomponent.getStyle().isEmpty()) { diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -index ea30dad0134644a8ad292a892450404203f3535e..584a58659fae6ba3d8b53858890bc6ec509ffb0e 100644 +index b6506e881ef337bfd2a7a0644296b48b7300a0f6..7daca712816a79cc4a30b084afbd3d07b5d3755f 100644 --- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java +++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -@@ -42,6 +42,11 @@ public class ComponentUtils { +@@ -41,6 +41,11 @@ public class ComponentUtils { if (depth > 100) { return text.copy(); } else { @@ -2155,18 +2152,18 @@ index 762a9392ffac3042356709dddd15bb3516048bed..3544e2dc2522e9d6305d727d56e73490 buf.writeComponent(this.footer); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e896917b3546f9d075179198c6dcd714f6cddd50..58457e3493100e9726288ae7b027ab47947bd4d4 100644 +index 2a7c614df7b9c9405a5dd23e6a888ede7fc86683..b50489d7d506e0ae3e61a8d47b04cc54f95c35db 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -194,6 +194,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot - public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements CommandSource, AutoCloseable { +@@ -190,6 +190,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot + public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, CommandSource, AutoCloseable { public static final Logger LOGGER = LogUtils.getLogger(); + public static final net.kyori.adventure.text.logger.slf4j.ComponentLogger COMPONENT_LOGGER = net.kyori.adventure.text.logger.slf4j.ComponentLogger.logger(LOGGER.getName()); // Paper public static final String VANILLA_BRAND = "vanilla"; private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F; private static final int TICK_STATS_SPAN = 100; -@@ -242,8 +243,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -- // SPIGOT-7127: Console /say and similar -- if (entityplayer == null) { -- return CompletableFuture.completedFuture(ichatbasecomponent); -- } +- return ChatDecorator.PLAIN; +- } - -- return CompletableFuture.supplyAsync(() -> { -- AsyncPlayerChatPreviewEvent event = new AsyncPlayerChatPreviewEvent(true, entityplayer.getBukkitEntity(), CraftChatMessage.fromComponent(ichatbasecomponent), new LazyPlayerSet(this)); -- String originalFormat = event.getFormat(), originalMessage = event.getMessage(); -- this.server.getPluginManager().callEvent(event); -- -- if (originalFormat.equals(event.getFormat()) && originalMessage.equals(event.getMessage()) && event.getPlayer().getName().equalsIgnoreCase(event.getPlayer().getDisplayName())) { -- return ichatbasecomponent; -- } -- -- return CraftChatMessage.fromStringOrNull(String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage())); -- }, chatExecutor); -- }; +- public boolean logIPs() { +- return true; + // Paper start - moved to ChatPreviewProcessor + return ChatDecorator.create((sender, commandSourceStack, message) -> { + final io.papermc.paper.adventure.ChatDecorationProcessor processor = new io.papermc.paper.adventure.ChatDecorationProcessor(this, sender, commandSourceStack, message); + return processor.process(); + }); + // Paper end - // CraftBukkit end } + public static record ReloadableResources(CloseableResourceManager resourceManager, ReloadableServerResources managers) implements AutoCloseable { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d06430d59259849715e1457a75fd4f52406a34c2..a0856fc649c50309258f015e623502dd46aeeab4 100644 +index 084339c7da80ce21ab8405e20b76af87dbbbe8ce..b944cda955c5660d3a9b84e9c92c2b19337a027a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -161,6 +161,7 @@ import net.minecraft.world.scores.Score; +@@ -156,6 +156,7 @@ import net.minecraft.world.scores.Score; import net.minecraft.world.scores.Scoreboard; import net.minecraft.world.scores.Team; import net.minecraft.world.scores.criteria.ObjectiveCriteria; @@ -2279,7 +2264,15 @@ index d06430d59259849715e1457a75fd4f52406a34c2..a0856fc649c50309258f015e623502dd import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.WeatherType; -@@ -243,6 +244,7 @@ public class ServerPlayer extends Player { +@@ -214,6 +215,7 @@ public class ServerPlayer extends Player { + private boolean disconnected; + private int requestedViewDistance; + public String language = "en_us"; // CraftBukkit - default ++ public java.util.Locale adventure$locale = java.util.Locale.US; // Paper + @Nullable + private Vec3 startingToFallPosition; + @Nullable +@@ -240,6 +242,7 @@ public class ServerPlayer extends Player { // CraftBukkit start public String displayName; @@ -2287,7 +2280,7 @@ index d06430d59259849715e1457a75fd4f52406a34c2..a0856fc649c50309258f015e623502dd public Component listName; public org.bukkit.Location compassTarget; public int newExp = 0; -@@ -325,6 +327,7 @@ public class ServerPlayer extends Player { +@@ -325,6 +328,7 @@ public class ServerPlayer extends Player { // CraftBukkit start this.displayName = this.getScoreboardName(); @@ -2295,7 +2288,7 @@ index d06430d59259849715e1457a75fd4f52406a34c2..a0856fc649c50309258f015e623502dd this.bukkitPickUpLoot = true; this.maxHealthCache = this.getMaxHealth(); } -@@ -818,22 +821,17 @@ public class ServerPlayer extends Player { +@@ -818,22 +822,17 @@ public class ServerPlayer extends Player { String deathmessage = defaultMessage.getString(); this.keepLevel = keepInventory; // SPIGOT-2222: pre-set keepLevel @@ -2322,7 +2315,7 @@ index d06430d59259849715e1457a75fd4f52406a34c2..a0856fc649c50309258f015e623502dd this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> { boolean flag1 = true; -@@ -1774,13 +1772,13 @@ public class ServerPlayer extends Player { +@@ -1774,13 +1773,13 @@ public class ServerPlayer extends Player { public void sendSystemMessage(Component message, boolean overlay) { if (this.acceptsSystemMessages(overlay)) { @@ -2338,7 +2331,7 @@ index d06430d59259849715e1457a75fd4f52406a34c2..a0856fc649c50309258f015e623502dd } else { return null; } -@@ -1789,8 +1787,13 @@ public class ServerPlayer extends Player { +@@ -1789,8 +1788,13 @@ public class ServerPlayer extends Player { } public void sendChatMessage(OutgoingChatMessage message, boolean filterMaskEnabled, ChatType.Bound params) { @@ -2353,30 +2346,95 @@ index d06430d59259849715e1457a75fd4f52406a34c2..a0856fc649c50309258f015e623502dd } } -@@ -1808,6 +1811,7 @@ public class ServerPlayer extends Player { - } - - public String locale = "en_us"; // CraftBukkit - add, lowercase -+ public java.util.Locale adventure$locale = java.util.Locale.US; // Paper - public void updateOptions(ServerboundClientInformationPacket packet) { - // CraftBukkit start - if (getMainArm() != packet.mainHand()) { @@ -1819,6 +1823,10 @@ public class ServerPlayer extends Player { - this.server.server.getPluginManager().callEvent(event); } - this.locale = packet.language; + // CraftBukkit end + this.language = clientOptions.language(); + // Paper start -+ this.adventure$locale = net.kyori.adventure.translation.Translator.parseLocale(this.locale); ++ this.adventure$locale = net.kyori.adventure.translation.Translator.parseLocale(this.language); + this.connection.connection.channel.attr(PaperAdventure.LOCALE_ATTRIBUTE).set(this.adventure$locale); + // Paper end - this.clientViewDistance = packet.viewDistance; + this.requestedViewDistance = clientOptions.viewDistance(); + this.chatVisibility = clientOptions.chatVisibility(); + this.canChatColor = clientOptions.chatColors(); +diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +index e7a9dd7791a0dd200c4d74922c6e5adaa5013669..b9062fe651de34d5b3f9d5f146ae0b4fe29cbfee 100644 +--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +@@ -47,7 +47,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + public static final int LATENCY_CHECK_INTERVAL = 15000; + private static final Component TIMEOUT_DISCONNECTION_MESSAGE = Component.translatable("disconnect.timeout"); + protected final MinecraftServer server; +- protected final Connection connection; ++ public final Connection connection; // Paper + private long keepAliveTime; + private boolean keepAlivePending; + private long keepAliveChallenge; +@@ -217,12 +217,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + + // CraftBukkit start + @Deprecated +- public void disconnect(Component reason) { +- this.disconnect(CraftChatMessage.fromComponent(reason)); ++ public void disconnect(String s) { // Paper ++ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); // Paper + } + // CraftBukkit end + +- public void disconnect(String s) { ++ // Paper start ++ public void disconnect(final Component reason) { ++ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason)); ++ } ++ ++ public void disconnect(net.kyori.adventure.text.Component reason) { ++ // Paper end + // CraftBukkit start - fire PlayerKickEvent + if (this.processedDisconnect) { + return; +@@ -231,7 +237,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + Waitable waitable = new Waitable() { + @Override + protected Object evaluate() { +- ServerCommonPacketListenerImpl.this.disconnect(s); ++ ServerCommonPacketListenerImpl.this.disconnect(reason); // Paper - adventure + return null; + } + }; +@@ -248,9 +254,9 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + return; + } + +- String leaveMessage = ChatFormatting.YELLOW + this.player.getScoreboardName() + " left the game."; ++ net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure + +- PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), s, leaveMessage); ++ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - adventure + + if (this.cserver.getServer().isRunning()) { + this.cserver.getPluginManager().callEvent(event); +@@ -262,7 +268,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } + this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent + // Send the possibly modified leave message +- final Component ichatbasecomponent = CraftChatMessage.fromString(event.getReason(), true)[0]; ++ final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure // CraftBukkit end - this.chatVisibility = packet.chatVisibility(); + + this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 031babd244247612009752b8d47e7c253c15a97d..2bcea1af243cc34f98ff3226067f8c16a9ca4010 100644 +index bbd256d088879f04762fcf628573f1348e4961a8..92b18f382e91936aad54b083284a393684747d9d 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -187,6 +187,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; +@@ -45,6 +45,7 @@ import net.minecraft.nbt.ListTag; + import net.minecraft.nbt.StringTag; + import net.minecraft.network.Connection; + import net.minecraft.network.TickablePacketListener; ++import net.minecraft.network.chat.ChatDecorator; + import net.minecraft.network.chat.ChatType; + import net.minecraft.network.chat.Component; + import net.minecraft.network.chat.LastSeenMessages; +@@ -180,6 +181,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; import org.slf4j.Logger; // CraftBukkit start @@ -2385,70 +2443,7 @@ index 031babd244247612009752b8d47e7c253c15a97d..2bcea1af243cc34f98ff3226067f8c16 import com.mojang.datafixers.util.Pair; import java.util.Arrays; import java.util.concurrent.ExecutionException; -@@ -254,7 +256,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - private static final int NO_BLOCK_UPDATES_TO_ACK = -1; - private static final int TRACKED_MESSAGE_DISCONNECT_THRESHOLD = 4096; - private static final Component CHAT_VALIDATION_FAILED = Component.translatable("multiplayer.disconnect.chat_validation_failed"); -- private final Connection connection; -+ public final Connection connection; // Paper - private final MinecraftServer server; - public ServerPlayer player; - private int tickCount; -@@ -442,14 +444,17 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - return this.server.isSingleplayerOwner(this.player.getGameProfile()); - } - -- // CraftBukkit start -- @Deprecated -- public void disconnect(Component reason) { -- this.disconnect(CraftChatMessage.fromComponent(reason)); -+ public void disconnect(String s) { -+ // Paper start -+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); - } -- // CraftBukkit end - -- public void disconnect(String s) { -+ public void disconnect(final Component reason) { -+ this.disconnect(PaperAdventure.asAdventure(reason)); -+ } -+ -+ public void disconnect(net.kyori.adventure.text.Component reason) { -+ // Paper end - // CraftBukkit start - fire PlayerKickEvent - if (this.processedDisconnect) { - return; -@@ -458,7 +463,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - Waitable waitable = new Waitable() { - @Override - protected Object evaluate() { -- ServerGamePacketListenerImpl.this.disconnect(s); -+ ServerGamePacketListenerImpl.this.disconnect(reason); // Paper - adventure - return null; - } - }; -@@ -475,9 +480,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - return; - } - -- String leaveMessage = ChatFormatting.YELLOW + this.player.getScoreboardName() + " left the game."; -+ net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure - -- PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), s, leaveMessage); -+ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - Adventure - - if (this.cserver.getServer().isRunning()) { - this.cserver.getPluginManager().callEvent(event); -@@ -489,7 +494,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } - this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent - // Send the possibly modified leave message -- final Component ichatbasecomponent = CraftChatMessage.fromString(event.getReason(), true)[0]; -+ final Component ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure - // CraftBukkit end - - this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> { -@@ -1788,9 +1793,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1686,9 +1689,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl */ this.player.disconnect(); @@ -2463,21 +2458,21 @@ index 031babd244247612009752b8d47e7c253c15a97d..2bcea1af243cc34f98ff3226067f8c16 } // CraftBukkit end this.player.getTextFilter().leave(); -@@ -1887,11 +1894,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } - +@@ -1754,10 +1759,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl CompletableFuture completablefuture = this.filterTextPacket(playerchatmessage.signedContent()); -- CompletableFuture completablefuture1 = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent()); -+ CompletableFuture completablefuture1 = this.server.getChatDecorator().decorate(this.player, null, playerchatmessage.decoratedContent()); // Paper + Component ichatbasecomponent = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent()); ++ CompletableFuture componentFuture = this.server.getChatDecorator().decorate(this.player, null, playerchatmessage.decoratedContent()); // Paper this.chatMessageChain.append((executor) -> { - return CompletableFuture.allOf(completablefuture, completablefuture1).thenAcceptAsync((ovoid) -> { -- PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent((Component) completablefuture1.join()).filter(((FilteredText) completablefuture.join()).mask()); -+ PlayerChatMessage playerchatmessage1 = playerchatmessage.filter(((FilteredText) completablefuture.join()).mask()).withResult(completablefuture1.join()); // Paper - +- return completablefuture.thenAcceptAsync((filteredtext) -> { +- PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(ichatbasecomponent).filter(filteredtext.mask()); +- ++ return CompletableFuture.allOf(completablefuture, componentFuture).thenAcceptAsync((filtered) -> { // Paper ++ PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(componentFuture.join().component()).filter(completablefuture.join().mask()); // Paper this.broadcastChatMessage(playerchatmessage1); }, this.server.chatExecutor); // CraftBukkit - async chat -@@ -1997,7 +2004,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + }); +@@ -1862,7 +1867,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl Optional optional = this.unpackAndApplyLastSeen(acknowledgment); if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales @@ -2486,7 +2481,7 @@ index 031babd244247612009752b8d47e7c253c15a97d..2bcea1af243cc34f98ff3226067f8c16 return Optional.empty(); } else { this.player.resetLastActionTime(); -@@ -2055,7 +2062,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1920,7 +1925,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.handleCommand(s); } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Do nothing, this is coming from a plugin @@ -2498,9 +2493,9 @@ index 031babd244247612009752b8d47e7c253c15a97d..2bcea1af243cc34f98ff3226067f8c16 + // Paper end + } else if (false) { // Paper Player player = this.getCraftPlayer(); - AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(this.server)); + AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(server)); String originalFormat = event.getFormat(), originalMessage = event.getMessage(); -@@ -2179,7 +2191,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2044,7 +2054,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } }); } else if (this.player.getChatVisibility() == ChatVisiblity.SYSTEM) { // Re-add "Command Only" flag check @@ -2510,10 +2505,10 @@ index 031babd244247612009752b8d47e7c253c15a97d..2bcea1af243cc34f98ff3226067f8c16 this.chat(s, message, true); } diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 1aae5c4c85efbaab626fa3776252b046618ae1cc..7983033160b77e28eb8135f8709dacd6b806ebe3 100644 +index 7d3a924a56f8a3f5756400e26e67581ebff27445..ef5d73a296982d8b9ac022c5ea755843c2da1c84 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -323,7 +323,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -290,7 +290,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId); if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) { @@ -2522,7 +2517,7 @@ index 1aae5c4c85efbaab626fa3776252b046618ae1cc..7983033160b77e28eb8135f8709dacd6 } Waitable waitable = new Waitable() { @Override -@@ -334,12 +334,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -301,12 +301,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, ServerLoginPacketListenerImpl.this.server.processQueue.add(waitable); if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { @@ -2551,18 +2546,10 @@ index 1cb95db25a20d38faacd99a5805630c1598e9db3..d99b2235038eb1aba8cda474c4aa51e2 @Override diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index edf629f2e810eebf014b1565021888f96def92a1..d3dc7752aadf36985660d04dcb4377a69dfeddff 100644 +index 10b263b2693a6b507c858b6550b5b98a53cea575..3b646b86f2b01306618fd2a319307cad4dde9588 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -8,6 +8,7 @@ import com.mojang.logging.LogUtils; - import com.mojang.serialization.DataResult; - import com.mojang.serialization.Dynamic; - import io.netty.buffer.Unpooled; -+import io.papermc.paper.adventure.PaperAdventure; - import java.io.File; - import java.net.SocketAddress; - import java.nio.file.Path; -@@ -283,7 +284,7 @@ public abstract class PlayerList { +@@ -270,7 +270,7 @@ public abstract class PlayerList { } // CraftBukkit start ichatmutablecomponent.withStyle(ChatFormatting.YELLOW); @@ -2571,12 +2558,12 @@ index edf629f2e810eebf014b1565021888f96def92a1..d3dc7752aadf36985660d04dcb4377a6 playerconnection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); ServerStatus serverping = this.server.getStatus(); -@@ -304,19 +305,18 @@ public abstract class PlayerList { +@@ -291,19 +291,18 @@ public abstract class PlayerList { // Ensure that player inventory is populated with its viewer player.containerMenu.transferTo(player.containerMenu, bukkitPlayer); - PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, joinMessage); -+ PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure ++ PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure this.cserver.getPluginManager().callEvent(playerJoinEvent); if (!player.connection.isAcceptingMessages()) { @@ -2591,12 +2578,12 @@ index edf629f2e810eebf014b1565021888f96def92a1..d3dc7752aadf36985660d04dcb4377a6 - this.server.getPlayerList().broadcastSystemMessage(line, false); - } + if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure -+ joinMessage = PaperAdventure.asVanilla(jm); // Paper - Adventure ++ joinMessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(jm); // Paper - Adventure + this.server.getPlayerList().broadcastSystemMessage(joinMessage, false); // Paper - Adventure } // CraftBukkit end -@@ -513,7 +513,7 @@ public abstract class PlayerList { +@@ -501,7 +500,7 @@ public abstract class PlayerList { } @@ -2605,16 +2592,16 @@ index edf629f2e810eebf014b1565021888f96def92a1..d3dc7752aadf36985660d04dcb4377a6 ServerLevel worldserver = entityplayer.serverLevel(); entityplayer.awardStat(Stats.LEAVE_GAME); -@@ -524,7 +524,7 @@ public abstract class PlayerList { +@@ -512,7 +511,7 @@ public abstract class PlayerList { entityplayer.closeContainer(); } - PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), entityplayer.kickLeaveMessage != null ? entityplayer.kickLeaveMessage : "\u00A7e" + entityplayer.getScoreboardName() + " left the game"); -+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure ++ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName()))); // Paper - Adventure this.cserver.getPluginManager().callEvent(playerQuitEvent); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); -@@ -577,7 +577,7 @@ public abstract class PlayerList { +@@ -565,7 +564,7 @@ public abstract class PlayerList { this.cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity()); // CraftBukkit end @@ -2623,12 +2610,12 @@ index edf629f2e810eebf014b1565021888f96def92a1..d3dc7752aadf36985660d04dcb4377a6 } // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer -@@ -623,10 +623,10 @@ public abstract class PlayerList { +@@ -611,10 +610,10 @@ public abstract class PlayerList { } // return chatmessage; - event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(ichatmutablecomponent)); -+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure ++ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure } else if (!this.isWhiteListed(gameprofile)) { ichatmutablecomponent = Component.translatable("multiplayer.disconnect.not_whitelisted"); - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot @@ -2636,12 +2623,12 @@ index edf629f2e810eebf014b1565021888f96def92a1..d3dc7752aadf36985660d04dcb4377a6 } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { IpBanListEntry ipbanentry = this.ipBans.get(socketaddress); -@@ -636,17 +636,17 @@ public abstract class PlayerList { +@@ -624,17 +623,17 @@ public abstract class PlayerList { } // return chatmessage; - event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(ichatmutablecomponent)); -+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure ++ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure } else { // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null; if (this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile)) { @@ -2653,11 +2640,11 @@ index edf629f2e810eebf014b1565021888f96def92a1..d3dc7752aadf36985660d04dcb4377a6 this.cserver.getPluginManager().callEvent(event); if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) { - loginlistener.disconnect(event.getKickMessage()); -+ loginlistener.disconnect(PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure ++ loginlistener.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure return null; } return entity; -@@ -1157,7 +1157,7 @@ public abstract class PlayerList { +@@ -1152,7 +1151,7 @@ public abstract class PlayerList { public void removeAll() { // CraftBukkit start - disconnect safely for (ServerPlayer player : this.players) { @@ -2666,7 +2653,7 @@ index edf629f2e810eebf014b1565021888f96def92a1..d3dc7752aadf36985660d04dcb4377a6 } // CraftBukkit end -@@ -1198,24 +1198,43 @@ public abstract class PlayerList { +@@ -1193,24 +1192,43 @@ public abstract class PlayerList { } public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound params) { @@ -2713,7 +2700,7 @@ index edf629f2e810eebf014b1565021888f96def92a1..d3dc7752aadf36985660d04dcb4377a6 } if (flag1 && sender != null) { -@@ -1224,7 +1243,7 @@ public abstract class PlayerList { +@@ -1219,7 +1237,7 @@ public abstract class PlayerList { } @@ -2843,10 +2830,10 @@ index 0a4da811ff200268f40accad7d1f232c80201309..5bd28e1f475aeadaa626a4e9e9e2a1b3 } } diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index 614e567eb1ef10ac7514909a8425e29ac3627d3d..60596c4ac2ebb8caf19d65591624275ba63b0199 100644 +index 23bdb77690ba15bcbbfb0c70af23336d08ac7752..8f144a357174bbe096ac9b38a5e67a61127d7b87 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -33,6 +33,7 @@ import net.minecraft.world.level.saveddata.SavedData; +@@ -34,6 +34,7 @@ import net.minecraft.world.level.saveddata.SavedData; import org.slf4j.Logger; // CraftBukkit start @@ -2854,7 +2841,7 @@ index 614e567eb1ef10ac7514909a8425e29ac3627d3d..60596c4ac2ebb8caf19d65591624275b import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.CraftServer; -@@ -598,7 +599,7 @@ public class MapItemSavedData extends SavedData { +@@ -605,7 +606,7 @@ public class MapItemSavedData extends SavedData { for (org.bukkit.map.MapCursor cursor : render.cursors) { if (cursor.isVisible()) { @@ -2864,10 +2851,10 @@ index 614e567eb1ef10ac7514909a8425e29ac3627d3d..60596c4ac2ebb8caf19d65591624275b } collection = icons; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c9bbe1d3a44cea1860f0ecba9580fe8ee87f6929..7b2fdc799b0fe776606d3890098eba58c0bdea83 100644 +index 35f0be0afad8f88f69c3127d1bd44bb0e12af550..4bdc0ef703b31763f879e7de7da60e0847637f9a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -614,8 +614,10 @@ public final class CraftServer implements Server { +@@ -617,8 +617,10 @@ public final class CraftServer implements Server { } @Override @@ -2878,7 +2865,7 @@ index c9bbe1d3a44cea1860f0ecba9580fe8ee87f6929..7b2fdc799b0fe776606d3890098eba58 } @Override -@@ -1471,7 +1473,15 @@ public final class CraftServer implements Server { +@@ -1474,7 +1476,15 @@ public final class CraftServer implements Server { return this.configuration.getInt("settings.spawn-radius", -1); } @@ -2894,7 +2881,7 @@ index c9bbe1d3a44cea1860f0ecba9580fe8ee87f6929..7b2fdc799b0fe776606d3890098eba58 public String getShutdownMessage() { return this.configuration.getString("settings.shutdown-message"); } -@@ -1639,7 +1649,20 @@ public final class CraftServer implements Server { +@@ -1642,7 +1652,20 @@ public final class CraftServer implements Server { } @Override @@ -2915,7 +2902,7 @@ index c9bbe1d3a44cea1860f0ecba9580fe8ee87f6929..7b2fdc799b0fe776606d3890098eba58 Set recipients = new HashSet<>(); for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) { if (permissible instanceof CommandSender && permissible.hasPermission(permission)) { -@@ -1647,14 +1670,14 @@ public final class CraftServer implements Server { +@@ -1650,14 +1673,14 @@ public final class CraftServer implements Server { } } @@ -2932,7 +2919,7 @@ index c9bbe1d3a44cea1860f0ecba9580fe8ee87f6929..7b2fdc799b0fe776606d3890098eba58 for (CommandSender recipient : recipients) { recipient.sendMessage(message); -@@ -1917,6 +1940,14 @@ public final class CraftServer implements Server { +@@ -1920,6 +1943,14 @@ public final class CraftServer implements Server { return CraftInventoryCreator.INSTANCE.createInventory(owner, type); } @@ -2947,7 +2934,7 @@ index c9bbe1d3a44cea1860f0ecba9580fe8ee87f6929..7b2fdc799b0fe776606d3890098eba58 @Override public Inventory createInventory(InventoryHolder owner, InventoryType type, String title) { Preconditions.checkArgument(type != null, "InventoryType cannot be null"); -@@ -1931,13 +1962,28 @@ public final class CraftServer implements Server { +@@ -1934,13 +1965,28 @@ public final class CraftServer implements Server { return CraftInventoryCreator.INSTANCE.createInventory(owner, size); } @@ -2976,7 +2963,7 @@ index c9bbe1d3a44cea1860f0ecba9580fe8ee87f6929..7b2fdc799b0fe776606d3890098eba58 public Merchant createMerchant(String title) { return new CraftMerchantCustom(title == null ? InventoryType.MERCHANT.getDefaultTitle() : title); } -@@ -2002,6 +2048,17 @@ public final class CraftServer implements Server { +@@ -2005,6 +2051,17 @@ public final class CraftServer implements Server { return Thread.currentThread().equals(console.serverThread) || this.console.hasStopped() || !org.spigotmc.AsyncCatcher.enabled; // All bets are off if we have shut down (e.g. due to watchdog) } @@ -2994,7 +2981,7 @@ index c9bbe1d3a44cea1860f0ecba9580fe8ee87f6929..7b2fdc799b0fe776606d3890098eba58 @Override public String getMotd() { return this.console.getMotd(); -@@ -2436,4 +2493,53 @@ public final class CraftServer implements Server { +@@ -2439,4 +2496,53 @@ public final class CraftServer implements Server { return this.spigot; } // Spigot end @@ -3120,7 +3107,7 @@ index 153143b06fc088f3142a8fa17f153d8a344169d8..d01388bbadf3069357cf52463f4104a1 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 67d408b79422cf0c4aed6636cfd4ebb9e13e19f9..442beb8675d6d53a92fb6a5b7c2abdda2822e6fe 100644 +index 8d5c4fbaab751802fdb47d218c7d28f619d9eb62..83784b0087e15fd5c827884b366fd7cf59213176 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -20,6 +20,12 @@ public class Main { @@ -3137,11 +3124,11 @@ index 67d408b79422cf0c4aed6636cfd4ebb9e13e19f9..442beb8675d6d53a92fb6a5b7c2abdda OptionParser parser = new OptionParser() { { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java -index 9d55f36f146435f0cfb4e62ffa7c94eab404a596..c186a44b927188ed222f8b2f8f76aaef35d9c654 100644 +index 94435aa3c57ed82dcb249b1e1d4ebb3212c443a7..da3437eb0ce3374a44a09c55834f341e1a55c162 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java -@@ -68,6 +68,19 @@ public class CraftBeacon extends CraftBlockEntityState implem - this.getSnapshot().secondaryPower = (effect != null) ? MobEffect.byId(effect.getId()) : null; +@@ -67,6 +67,19 @@ public class CraftBeacon extends CraftBlockEntityState implem + this.getSnapshot().secondaryPower = (effect != null) ? CraftPotionEffectType.bukkitToMinecraft(effect) : null; } + // Paper start @@ -3525,7 +3512,7 @@ index f6c614bb1184f9c79121f64a2a030bf3f094b671..e8334e2264510f5101e80b4f130e7ae1 public net.minecraft.world.item.enchantment.Enchantment getHandle() { return this.target; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 5e8ec70a58c047969a144355782da58aee44b288..672153a664b7b48bfb18d12efc271e296b5aa428 100644 +index 74f431e806a4c5abb7ddd193c1b5f7ba7f321cac..2a20ebeeb6156ff74a52e8e0168de6b60f6e72cf 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -206,6 +206,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { @@ -3588,7 +3575,7 @@ index 5e8ec70a58c047969a144355782da58aee44b288..672153a664b7b48bfb18d12efc271e29 @Override public boolean isPermissionSet(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 3421498e8e5fe2e22d6b31d9cf6b3337553e1c5f..abe978078270a45f7e77eb2b8a99309f12ca51ee 100644 +index 92ce36e3420e778ed39706e86b06389c4b13697f..b9578f7d0f61d15bee1f99181bf932cdbb0e611c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -320,9 +320,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -3640,10 +3627,10 @@ index 10fa80df3ae2406f34af669f89d087b15ad1d71b..66fb6aeb49b7e93d2a4d9b5ce7f1a7d6 public boolean isOp() { return true; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 7b134da717f510a8718a19bd61560a532a074dc8..5afd9ccf2eef614da52ec82d3972a49722e46321 100644 +index 0c4371fba7e770050182b3cff429bdbfe778e8f6..0a945ed432b431ec6c714cccf45f4e09756c7b1a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -294,14 +294,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -296,14 +296,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getDisplayName() { @@ -3683,7 +3670,7 @@ index 7b134da717f510a8718a19bd61560a532a074dc8..5afd9ccf2eef614da52ec82d3972a497 @Override public String getPlayerListName() { return this.getHandle().listName == null ? getName() : CraftChatMessage.fromComponent(this.getHandle().listName); -@@ -320,42 +345,42 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -322,42 +347,42 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } @@ -3735,7 +3722,7 @@ index 7b134da717f510a8718a19bd61560a532a074dc8..5afd9ccf2eef614da52ec82d3972a497 this.getHandle().connection.send(packet); } -@@ -387,6 +412,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -389,6 +414,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.disconnect(message == null ? "" : message); } @@ -3759,7 +3746,7 @@ index 7b134da717f510a8718a19bd61560a532a074dc8..5afd9ccf2eef614da52ec82d3972a497 @Override public void setCompassTarget(Location loc) { Preconditions.checkArgument(loc != null, "Location cannot be null"); -@@ -681,6 +723,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -683,6 +725,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().connection.send(packet); } @@ -3784,7 +3771,7 @@ index 7b134da717f510a8718a19bd61560a532a074dc8..5afd9ccf2eef614da52ec82d3972a497 @Override public void sendSignChange(Location loc, String[] lines) { this.sendSignChange(loc, lines, DyeColor.BLACK); -@@ -704,6 +764,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -706,6 +766,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (this.getHandle().connection == null) return; Component[] components = CraftSign.sanitizeLines(lines); @@ -3796,7 +3783,7 @@ index 7b134da717f510a8718a19bd61560a532a074dc8..5afd9ccf2eef614da52ec82d3972a497 SignBlockEntity sign = new SignBlockEntity(CraftLocation.toBlockPosition(loc), Blocks.OAK_SIGN.defaultBlockState()); SignText text = sign.getFrontText(); text = text.setColor(net.minecraft.world.item.DyeColor.byId(dyeColor.getWoolData())); -@@ -713,7 +778,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -715,7 +780,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } sign.setText(text, true); @@ -3806,7 +3793,7 @@ index 7b134da717f510a8718a19bd61560a532a074dc8..5afd9ccf2eef614da52ec82d3972a497 } @Override -@@ -1668,7 +1734,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1684,7 +1750,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setResourcePack(String url) { @@ -3815,7 +3802,7 @@ index 7b134da717f510a8718a19bd61560a532a074dc8..5afd9ccf2eef614da52ec82d3972a497 } @Override -@@ -1683,7 +1749,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1699,7 +1765,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setResourcePack(String url, byte[] hash, boolean force) { @@ -3824,7 +3811,7 @@ index 7b134da717f510a8718a19bd61560a532a074dc8..5afd9ccf2eef614da52ec82d3972a497 } @Override -@@ -1699,6 +1765,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1715,6 +1781,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } @@ -3846,8 +3833,8 @@ index 7b134da717f510a8718a19bd61560a532a074dc8..5afd9ccf2eef614da52ec82d3972a497 public void addChannel(String channel) { Preconditions.checkState(this.channels.size() < 128, "Cannot register channel '%s'. Too many channels registered!", channel); channel = StandardMessenger.validateAndCorrectChannel(channel); -@@ -2092,6 +2173,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - return (this.getHandle().clientViewDistance == null) ? Bukkit.getViewDistance() : this.getHandle().clientViewDistance; +@@ -2108,6 +2189,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + return (this.getHandle().requestedViewDistance() == 0) ? Bukkit.getViewDistance() : this.getHandle().requestedViewDistance(); } + // Paper start @@ -3858,8 +3845,8 @@ index 7b134da717f510a8718a19bd61560a532a074dc8..5afd9ccf2eef614da52ec82d3972a497 + // Paper end @Override public int getPing() { - return this.getHandle().latency; -@@ -2142,6 +2229,252 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + return this.getHandle().connection.latency(); +@@ -2158,6 +2245,252 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return this.getHandle().allowsListing(); } @@ -4135,10 +4122,10 @@ index 5725b0281ac53a2354b233223259d6784353bc6e..9ef939b76d06874b856e0c850addb364 @Override public int getLineWidth() { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index f0e5a161db33fbef97d8f29cb1ac8ea32e8e837f..db30af9b6b9e737066c8a011e4dfe377f800f523 100644 +index 44f38eab4a6460dd34a1ce33528bfb6e3f42da8b..8e1bb9d86ec12240b00ee118a88ebe4dec4e6329 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -877,9 +877,9 @@ public class CraftEventFactory { +@@ -879,9 +879,9 @@ public class CraftEventFactory { return event; } @@ -4150,13 +4137,13 @@ index f0e5a161db33fbef97d8f29cb1ac8ea32e8e837f..db30af9b6b9e737066c8a011e4dfe377 event.setKeepInventory(keepInventory); event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel org.bukkit.World world = entity.getWorld(); -@@ -904,7 +904,7 @@ public class CraftEventFactory { +@@ -906,7 +906,7 @@ public class CraftEventFactory { * Server methods */ - public static ServerListPingEvent callServerListPingEvent(Server craftServer, InetAddress address, String motd, int numPlayers, int maxPlayers) { -- ServerListPingEvent event = new ServerListPingEvent("", address, motd, numPlayers, maxPlayers); -+ ServerListPingEvent event = new ServerListPingEvent("", address, craftServer.motd(), numPlayers, maxPlayers); // Paper - Adventure - craftServer.getPluginManager().callEvent(event); + public static ServerListPingEvent callServerListPingEvent(SocketAddress address, String motd, int numPlayers, int maxPlayers) { +- ServerListPingEvent event = new ServerListPingEvent("", ((InetSocketAddress) address).getAddress(), motd, numPlayers, maxPlayers); ++ ServerListPingEvent event = new ServerListPingEvent("", ((InetSocketAddress) address).getAddress(), Bukkit.getServer().motd(), numPlayers, maxPlayers); + Bukkit.getServer().getPluginManager().callEvent(event); return event; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java @@ -4732,20 +4719,20 @@ index 1980240d3dc0331ddf2ff56e163e2bfbd3b231ab..7a7f3f53aef601f124d474d9890e23d8 public Inventory createInventory(InventoryHolder holder, InventoryType type, String title) { // BrewingStand does not extend TileEntityLootable diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java -index b47f18b1e448807a17ca9f2ae9609680233da837..9683d7d103af66fffd68c11abc38fb4fd2f99482 100644 +index 2bdbd99abc4f7c3ec6a27e3000b63f908554735c..bab5b25fbf1ac1d56a4725e3e48293ebfbabbfaa 100644 --- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java +++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java @@ -42,7 +42,7 @@ public class CraftMapRenderer extends MapRenderer { } MapDecoration decoration = worldMap.decorations.get(key); -- cursors.addCursor(decoration.getX(), decoration.getY(), (byte) (decoration.getRot() & 15), decoration.getType().getIcon(), true, CraftChatMessage.fromComponent(decoration.getName())); -+ cursors.addCursor(decoration.getX(), decoration.getY(), (byte) (decoration.getRot() & 15), decoration.getType().getIcon(), true, decoration.getName() == null ? null : io.papermc.paper.adventure.PaperAdventure.asAdventure(decoration.getName())); // Paper +- cursors.addCursor(decoration.x(), decoration.y(), (byte) (decoration.rot() & 15), decoration.type().getIcon(), true, CraftChatMessage.fromComponent(decoration.name())); ++ cursors.addCursor(decoration.x(), decoration.y(), (byte) (decoration.rot() & 15), decoration.type().getIcon(), true, decoration.getName() == null ? null : io.papermc.paper.adventure.PaperAdventure.asAdventure(decoration.getName())); // Paper } } diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java -index 6c6d41569e0c7e4d4d17b63b81b955a6dc30afa0..ef1b0b716b11327a8f2856f51545aaba355ce74e 100644 +index 4f498569462a8812bbe77b57f9a2f15e8735a90a..be3e1c4765ba891462e36ce5b6e35f16e3ec189a 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java @@ -31,6 +31,21 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective @@ -4906,10 +4893,10 @@ index 78ea79b66cc9e90402ef5cdc2e5e04e0c74b1c26..4fede2161792ba3e7cdf0cc5a1f53318 boolean hadFormat = false; diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 6deffd223ff995d83244e941576f8286e1171c1f..412dce72064533a260db591a94c8b39eb498331d 100644 +index 35d2a206d4a36292c16e29247c950c2a69af2879..83ccadcc7139054e1ba3e1c1f0bf23c67c3c97c8 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -74,6 +74,43 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -75,6 +75,43 @@ public final class CraftMagicNumbers implements UnsafeValues { private CraftMagicNumbers() {} diff --git a/patches/unapplied/server/0011-Paper-command.patch b/patches/server/0011-Paper-command.patch similarity index 98% rename from patches/unapplied/server/0011-Paper-command.patch rename to patches/server/0011-Paper-command.patch index aba21de20d..4295e59b6e 100644 --- a/patches/unapplied/server/0011-Paper-command.patch +++ b/patches/server/0011-Paper-command.patch @@ -605,7 +605,7 @@ index 0000000000000000000000000000000000000000..ae60bd96b5284d54676d8e7e4dd5d170 + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 546ad678af2705e3956f5f139aa847354a6fdeae..8bce21e0d3e4ca18dcd43f9ab61387a012a5f24f 100644 +index a9ec28c3cf3ed50d929c80ac21959d82603ff0aa..95a4bcd09f3a9d462ff4c92431c07e3d3f55befc 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -186,6 +186,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -617,10 +617,10 @@ index 546ad678af2705e3956f5f139aa847354a6fdeae..8bce21e0d3e4ca18dcd43f9ab61387a0 this.setPvpAllowed(dedicatedserverproperties.pvp); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7b2fdc799b0fe776606d3890098eba58c0bdea83..c373b1929b8bd4ae5ceb899c6c5ea097a6236f8d 100644 +index 4bdc0ef703b31763f879e7de7da60e0847637f9a..5e08b8368d81153cf22ef9ae605fe5250464a283 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -940,6 +940,7 @@ public final class CraftServer implements Server { +@@ -943,6 +943,7 @@ public final class CraftServer implements Server { this.commandMap.clearCommands(); this.reloadData(); org.spigotmc.SpigotConfig.registerCommands(); // Spigot @@ -628,7 +628,7 @@ index 7b2fdc799b0fe776606d3890098eba58c0bdea83..c373b1929b8bd4ae5ceb899c6c5ea097 this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); -@@ -2533,6 +2534,34 @@ public final class CraftServer implements Server { +@@ -2536,6 +2537,34 @@ public final class CraftServer implements Server { // Paper end // Paper start diff --git a/patches/unapplied/server/0012-Paper-Metrics.patch b/patches/server/0012-Paper-Metrics.patch similarity index 99% rename from patches/unapplied/server/0012-Paper-Metrics.patch rename to patches/server/0012-Paper-Metrics.patch index a965df72cc..a128577e17 100644 --- a/patches/unapplied/server/0012-Paper-Metrics.patch +++ b/patches/server/0012-Paper-Metrics.patch @@ -698,7 +698,7 @@ index 0000000000000000000000000000000000000000..6aaed8e8bf8c721fc834da5c76ac72a4 + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index 8bce21e0d3e4ca18dcd43f9ab61387a012a5f24f..cfc4cad33d36e720f32b7ad6d1d4b3983f7aad39 100644 +index 95a4bcd09f3a9d462ff4c92431c07e3d3f55befc..ff3f00cf1d5180f83b16acac5676aa22cd967c8a 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -187,6 +187,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface diff --git a/patches/unapplied/server/0013-Paper-Plugins.patch b/patches/server/0013-Paper-Plugins.patch similarity index 99% rename from patches/unapplied/server/0013-Paper-Plugins.patch rename to patches/server/0013-Paper-Plugins.patch index 7bdafeff94..3faa3b746d 100644 --- a/patches/unapplied/server/0013-Paper-Plugins.patch +++ b/patches/server/0013-Paper-Plugins.patch @@ -6947,10 +6947,10 @@ index f7114d5b8f2f93f62883e24da29afaf9f74ee1a6..8bf0630c0e06950cd99b7ae9898137f7 return foundFrame.orElse(null); diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -index baa88201c4d08fb4f32f1198e187d7ca138b0f0e..7d09adf27da249851cfc87b7916b915240a65a7e 100644 +index bdd3b48e5de2afd6b7655ba6ff742a60ee9540c5..98ef159b7091e53298838ae3723909be6d38b4ba 100644 --- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java +++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -@@ -319,7 +319,13 @@ public class BuiltInRegistries { +@@ -323,7 +323,13 @@ public class BuiltInRegistries { } public static void bootStrap() { @@ -6982,10 +6982,10 @@ index 1eabd8b5a99850298838b11ba97e3d220f444378..8ff786c366332588a2df053438f23cc9 Bootstrap.wrapStreams(); Bootstrap.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis()); diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index ac59339d9ed4b0860de7d338e5b7610175e27165..af8afd53b5d3b34be4a5207316ce35abbcdf202d 100644 +index 9cfdd5d8c1650d9c9bdfbc07980239e507ff942d..ae0b713870976d4b1e469a90cef9b2e282dbcaab 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -133,6 +133,7 @@ public class Main { +@@ -130,6 +130,7 @@ public class Main { JvmProfiler.INSTANCE.start(Environment.SERVER); } @@ -6994,10 +6994,10 @@ index ac59339d9ed4b0860de7d338e5b7610175e27165..af8afd53b5d3b34be4a5207316ce35ab Bootstrap.validate(); Util.startTimerHackThread(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c373b1929b8bd4ae5ceb899c6c5ea097a6236f8d..061b1dbb92b9ec608ed9f0e2b7d09d498730610d 100644 +index 5e08b8368d81153cf22ef9ae605fe5250464a283..8c32ad9cbbe8bc9693493eee97834aaf20633ed7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -272,7 +272,8 @@ public final class CraftServer implements Server { +@@ -275,7 +275,8 @@ public final class CraftServer implements Server { private final CraftCommandMap commandMap = new CraftCommandMap(this); private final SimpleHelpMap helpMap = new SimpleHelpMap(this); private final StandardMessenger messenger = new StandardMessenger(); @@ -7007,7 +7007,7 @@ index c373b1929b8bd4ae5ceb899c6c5ea097a6236f8d..061b1dbb92b9ec608ed9f0e2b7d09d49 private final StructureManager structureManager; protected final DedicatedServer console; protected final DedicatedPlayerList playerList; -@@ -424,24 +425,7 @@ public final class CraftServer implements Server { +@@ -427,24 +428,7 @@ public final class CraftServer implements Server { } public void loadPlugins() { @@ -7033,7 +7033,7 @@ index c373b1929b8bd4ae5ceb899c6c5ea097a6236f8d..061b1dbb92b9ec608ed9f0e2b7d09d49 } public void enablePlugins(PluginLoadOrder type) { -@@ -530,15 +514,17 @@ public final class CraftServer implements Server { +@@ -533,15 +517,17 @@ public final class CraftServer implements Server { private void enablePlugin(Plugin plugin) { try { List perms = plugin.getDescription().getPermissions(); @@ -7057,7 +7057,7 @@ index c373b1929b8bd4ae5ceb899c6c5ea097a6236f8d..061b1dbb92b9ec608ed9f0e2b7d09d49 this.pluginManager.enablePlugin(plugin); } catch (Throwable ex) { -@@ -964,6 +950,7 @@ public final class CraftServer implements Server { +@@ -967,6 +953,7 @@ public final class CraftServer implements Server { "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" )); } @@ -7083,10 +7083,10 @@ index 909b2c98e7a9117d2f737245e4661792ffafb744..d96399e9bf1a58db5a4a22e58abb99e7 @Override public FileConfiguration getConfig() { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 412dce72064533a260db591a94c8b39eb498331d..0d5202f6bc14bc0cec77f86bed2f1f590e0fffeb 100644 +index 83ccadcc7139054e1ba3e1c1f0bf23c67c3c97c8..7546538312dbbd36e014677dce843433cb25d2a9 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -437,6 +437,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -438,6 +438,12 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack); return nmsItemStack.getItem().getDescriptionId(nmsItemStack); } diff --git a/patches/unapplied/server/0014-Timings-v2.patch b/patches/server/0014-Timings-v2.patch similarity index 94% rename from patches/unapplied/server/0014-Timings-v2.patch rename to patches/server/0014-Timings-v2.patch index f7a5ce6724..cfa69f4ba8 100644 --- a/patches/unapplied/server/0014-Timings-v2.patch +++ b/patches/server/0014-Timings-v2.patch @@ -698,10 +698,10 @@ index 0000000000000000000000000000000000000000..2f0d9b953802dee821cfde82d22b0567 + } +} diff --git a/src/main/java/net/minecraft/commands/CommandFunction.java b/src/main/java/net/minecraft/commands/CommandFunction.java -index 3ceeddf4c2898172d24db9ee1bab8d6b17e36128..8273ee1c5e513f02c9743ee38c9b7cf700e2ecad 100644 +index 0e460de37ac2ae8accbd0d3da73faac6cd7df8e0..956cddf5d975b91619316b9b6779cf51575cfc0a 100644 --- a/src/main/java/net/minecraft/commands/CommandFunction.java +++ b/src/main/java/net/minecraft/commands/CommandFunction.java -@@ -16,6 +16,15 @@ import net.minecraft.server.ServerFunctionManager; +@@ -32,6 +32,15 @@ import net.minecraft.server.ServerFunctionManager; public class CommandFunction { private final CommandFunction.Entry[] entries; final ResourceLocation id; @@ -718,33 +718,33 @@ index 3ceeddf4c2898172d24db9ee1bab8d6b17e36128..8273ee1c5e513f02c9743ee38c9b7cf7 public CommandFunction(ResourceLocation id, CommandFunction.Entry[] elements) { this.id = id; diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -index fc4dcd801480fe6d89a985de411baa9a3a66f6ef..4a1148a76020089caf01f888f87afdbb35788dc0 100644 +index 6f1501e13e29ce25919c23213df53248c4b454d7..047fc7206131e0f36ab45d04e98b7a235431e342 100644 --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java +++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java -@@ -26,7 +26,8 @@ public class PacketUtils { +@@ -28,7 +28,8 @@ public class PacketUtils { engine.executeIfPossible(() -> { - if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerGamePacketListenerImpl && ((ServerGamePacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 - if (listener.isAcceptingMessages()) { + if (MinecraftServer.getServer().hasStopped() || (listener instanceof ServerCommonPacketListenerImpl && ((ServerCommonPacketListenerImpl) listener).processedDisconnect)) return; // CraftBukkit, MC-142590 + if (listener.shouldHandleMessage(packet)) { - try { + co.aikar.timings.Timing timing = co.aikar.timings.MinecraftTimings.getPacketTiming(packet); // Paper - timings + try (co.aikar.timings.Timing ignored = timing.startTiming()) { // Paper - timings packet.handle(listener); } catch (Exception exception) { - if (listener.shouldPropagateHandlingExceptions()) { + if (exception instanceof ReportedException) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023cef7970f8 100644 +index b50489d7d506e0ae3e61a8d47b04cc54f95c35db..bacb6e1f1e4faa95490bf5d6d977e9d73bdacef5 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -189,7 +189,7 @@ import org.bukkit.event.player.AsyncPlayerChatPreviewEvent; +@@ -185,7 +185,7 @@ import org.bukkit.craftbukkit.Main; import org.bukkit.event.server.ServerLoadEvent; // CraftBukkit end -import org.bukkit.craftbukkit.SpigotTimings; // Spigot +import co.aikar.timings.MinecraftTimings; // Paper - public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements CommandSource, AutoCloseable { + public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ServerInfo, CommandSource, AutoCloseable { -@@ -860,6 +860,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop= 5000000000L) { -@@ -1206,15 +1227,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % this.autosavePeriod == 0) { // CraftBukkit @@ -826,8 +826,8 @@ index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023c this.profiler.push("tallying"); long j = this.tickTimes[this.tickCount % 100] = Util.getNanos() - i; -@@ -1224,8 +1248,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { + entityplayer.connection.suspendFlushing(); + }); - SpigotTimings.schedulerTimer.startTiming(); // Spigot + MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit @@ -870,7 +870,7 @@ index 58457e3493100e9726288ae7b027ab47947bd4d4..73c3070b2e300e0ab29ac1db1631023c // Send time updates to everyone, it will get the right time from the world the player is in. if (this.tickCount % 20 == 0) { for (int i = 0; i < this.getPlayerList().players.size(); ++i) { -@@ -1284,7 +1307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { CommandSourceStack wrapper = rconConsoleSource.createCommandSourceStack(); RemoteServerCommandEvent event = new RemoteServerCommandEvent(rconConsoleSource.getBukkitSender(wrapper), s); -@@ -679,9 +682,40 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -684,9 +687,40 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface if (event.isCancelled()) { return; } @@ -1010,7 +1010,7 @@ index cfc4cad33d36e720f32b7ad6d1d4b3983f7aad39..14101c77fd9814a5d1e8e1bf0d8584f4 // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e7f596fe8 100644 +index a7c18ca224c536b7b97d5889af321f23e637b420..092e443aa04757fea6d5f5c7b1d11899663c2eb0 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1,8 +1,10 @@ @@ -1024,7 +1024,7 @@ index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e import com.google.common.collect.Lists; import com.google.common.collect.Queues; import com.google.common.collect.Sets; -@@ -886,6 +888,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -882,6 +884,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider ChunkStatus chunkstatus = ChunkLevel.generationStatus(chunkHolder.getTicketLevel()); return !chunkstatus.isOrAfter(ChunkStatus.FULL) ? ChunkHolder.UNLOADED_CHUNK : either.mapLeft((ichunkaccess) -> { @@ -1032,7 +1032,7 @@ index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e ChunkPos chunkcoordintpair = chunkHolder.getPos(); ProtoChunk protochunk = (ProtoChunk) ichunkaccess; LevelChunk chunk; -@@ -910,6 +913,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -906,6 +909,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } return chunk; @@ -1040,7 +1040,7 @@ index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e }); }, (runnable) -> { ProcessorHandle mailbox = this.mainThreadMailbox; -@@ -1465,6 +1469,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1459,6 +1463,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider List list = Lists.newArrayList(); List list1 = this.level.players(); ObjectIterator objectiterator = this.entityMap.values().iterator(); @@ -1048,7 +1048,7 @@ index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e ChunkMap.TrackedEntity playerchunkmap_entitytracker; -@@ -1489,14 +1494,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1483,14 +1488,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider playerchunkmap_entitytracker.serverEntity.sendChanges(); } } @@ -1067,7 +1067,7 @@ index c943e64d70bab240f8dc733e78a185172664c5e4..a645263f148a25e5b4baeed51775eb8e } diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 5115342b51ccefe4430df47a498bc59b1d96bb0e..6d5a160a9fdaa04bb930afae8a0765910f631d23 100644 +index f402341b95c7752a2706edd502098696f786f4ef..b1fd6118132ba38f60d2a2b15c09231fa29be8fa 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -415,13 +415,15 @@ public class ServerChunkCache extends ChunkSource { @@ -1159,7 +1159,7 @@ index 5115342b51ccefe4430df47a498bc59b1d96bb0e..6d5a160a9fdaa04bb930afae8a076591 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b49460c5968f 100644 +index e2eff46cae9771931b2e0dfee5e73fd4842e3ab5..988a17cd0b960a07795d999dd125eae3a63d4227 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1,6 +1,8 @@ @@ -1179,7 +1179,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494 import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.generator.CustomWorldChunkManager; import org.bukkit.craftbukkit.util.CraftNamespacedKey; -@@ -469,7 +470,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -461,7 +462,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.updateSkyBrightness(); this.tickTime(); gameprofilerfiller.popPush("tickPending"); @@ -1188,7 +1188,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494 if (!this.isDebug()) { j = this.getGameTime(); gameprofilerfiller.push("blockTicks"); -@@ -478,12 +479,16 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -470,12 +471,16 @@ public class ServerLevel extends Level implements WorldGenLevel { this.fluidTicks.tick(j, 65536, this::tickFluid); gameprofilerfiller.pop(); } @@ -1206,7 +1206,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494 gameprofilerfiller.popPush("blockEvents"); timings.doSounds.startTiming(); // Spigot this.runBlockEvents(); -@@ -667,6 +672,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -625,6 +630,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } gameprofilerfiller.popPush("tickBlocks"); @@ -1214,7 +1214,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494 if (randomTickSpeed > 0) { LevelChunkSection[] achunksection = chunk.getSections(); -@@ -699,6 +705,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -657,6 +663,7 @@ public class ServerLevel extends Level implements WorldGenLevel { } } @@ -1222,7 +1222,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494 gameprofilerfiller.pop(); } -@@ -933,14 +940,22 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -931,14 +938,22 @@ public class ServerLevel extends Level implements WorldGenLevel { } public void tickNonPassenger(Entity entity) { @@ -1246,7 +1246,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494 entity.setOldPosAndRot(); ProfilerFiller gameprofilerfiller = this.getProfiler(); -@@ -959,7 +974,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -957,7 +972,7 @@ public class ServerLevel extends Level implements WorldGenLevel { this.tickPassenger(entity, entity1); } @@ -1255,7 +1255,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494 } -@@ -1001,6 +1016,7 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -999,6 +1014,7 @@ public class ServerLevel extends Level implements WorldGenLevel { if (!savingDisabled) { org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit @@ -1263,7 +1263,7 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494 if (progressListener != null) { progressListener.progressStartNoAbort(Component.translatable("menu.savingLevel")); } -@@ -1010,7 +1026,10 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1008,7 +1024,10 @@ public class ServerLevel extends Level implements WorldGenLevel { progressListener.progressStage(Component.translatable("menu.savingChunks")); } @@ -1275,10 +1275,10 @@ index 7be97441aed66fa3a21d13ad2211b3e0e08120c0..7cb5abfa89f842194325d26c6e95b494 this.entityManager.saveAll(); } else { diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018083c8b6a 100644 +index 92b18f382e91936aad54b083284a393684747d9d..d755ce65ffd22a7f39bb19c547f655f8539b3dbf 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -341,7 +341,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -320,7 +320,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void tick() { @@ -1286,7 +1286,7 @@ index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018 if (this.ackBlockChangesUpTo > -1) { this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo)); this.ackBlockChangesUpTo = -1; -@@ -422,7 +421,6 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -387,7 +386,6 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 this.disconnect(Component.translatable("multiplayer.disconnect.idling")); } @@ -1294,7 +1294,7 @@ index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018 } -@@ -2143,7 +2141,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2006,7 +2004,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } private void handleCommand(String s) { @@ -1303,7 +1303,7 @@ index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018 if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s); -@@ -2153,7 +2151,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2016,7 +2014,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.cserver.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -1312,7 +1312,7 @@ index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018 return; } -@@ -2166,7 +2164,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2029,7 +2027,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl java.util.logging.Logger.getLogger(ServerGamePacketListenerImpl.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); return; } finally { @@ -1322,7 +1322,7 @@ index 2bcea1af243cc34f98ff3226067f8c16a9ca4010..1fa9b13831638ea2bfd5d3073dc31018 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index d3dc7752aadf36985660d04dcb4377a69dfeddff..b922654c0b0b1b0d03beb20bb1944b817907f929 100644 +index 3b646b86f2b01306618fd2a319307cad4dde9588..b30128b77d2fe8a8c1db9b5746aab537a9a25430 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -1,5 +1,6 @@ @@ -1332,7 +1332,7 @@ index d3dc7752aadf36985660d04dcb4377a69dfeddff..b922654c0b0b1b0d03beb20bb1944b81 import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -@@ -1046,10 +1047,11 @@ public abstract class PlayerList { +@@ -1040,10 +1041,11 @@ public abstract class PlayerList { } public void saveAll() { @@ -1346,7 +1346,7 @@ index d3dc7752aadf36985660d04dcb4377a69dfeddff..b922654c0b0b1b0d03beb20bb1944b81 public UserWhiteList getWhiteList() { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 78c7c779209972186b1244fb678d7208b38e30e3..8fdac0e7bb0b9374ebdb82673d0579fff22af5e3 100644 +index 6c5000ff3dbb7517d095e9fb2cdf555212b2c090..8b3763ba7f5648c41c5bf8a72e5c801d5483e6e0 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -134,7 +134,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; @@ -1382,10 +1382,10 @@ index 78c7c779209972186b1244fb678d7208b38e30e3..8fdac0e7bb0b9374ebdb82673d0579ff private boolean isStateClimbable(BlockState state) { diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 1d40d2f70ad72aa392b3699d71f20f69d3820696..93a43ef867d0961b46f9ecadc2c7be6a4b17c72b 100644 +index fe7180dfc7ddaac8d60422c072d2e172d669cf57..cea1a8eaae8dfc36efd09e3ac57a7062bf536aac 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -322,6 +322,15 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -323,6 +323,15 @@ public class EntityType implements FeatureElement, EntityTypeT } public EntityType(EntityType.EntityFactory factory, MobCategory spawnGroup, boolean saveable, boolean summonable, boolean fireImmune, boolean spawnableFarFromPlayer, ImmutableSet canSpawnInside, EntityDimensions dimensions, int maxTrackDistance, int trackTickInterval, FeatureFlagSet requiredFeatures) { @@ -1401,7 +1401,7 @@ index 1d40d2f70ad72aa392b3699d71f20f69d3820696..93a43ef867d0961b46f9ecadc2c7be6a this.builtInRegistryHolder = BuiltInRegistries.ENTITY_TYPE.createIntrusiveHolder(this); this.factory = factory; this.category = spawnGroup; -@@ -643,6 +652,12 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -644,6 +653,12 @@ public class EntityType implements FeatureElement, EntityTypeT return this.updateInterval; } @@ -1414,7 +1414,7 @@ index 1d40d2f70ad72aa392b3699d71f20f69d3820696..93a43ef867d0961b46f9ecadc2c7be6a public boolean trackDeltas() { return this != EntityType.PLAYER && this != EntityType.LLAMA_SPIT && this != EntityType.WITHER && this != EntityType.BAT && this != EntityType.ITEM_FRAME && this != EntityType.GLOW_ITEM_FRAME && this != EntityType.LEASH_KNOT && this != EntityType.PAINTING && this != EntityType.END_CRYSTAL && this != EntityType.EVOKER_FANGS; } -@@ -748,7 +763,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -753,7 +768,7 @@ public class EntityType implements FeatureElement, EntityTypeT Util.fetchChoiceType(References.ENTITY_TREE, id); } @@ -1424,7 +1424,7 @@ index 1d40d2f70ad72aa392b3699d71f20f69d3820696..93a43ef867d0961b46f9ecadc2c7be6a } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe720021e74 100644 +index e24e61a35fe9cffce4a2174d46b88cf934f4b69f..cef17e8165009169f8de21915d2efc8e97aae21f 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -140,7 +140,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; @@ -1436,7 +1436,7 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7 public abstract class LivingEntity extends Entity implements Attackable { -@@ -2834,7 +2834,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2869,7 +2869,6 @@ public abstract class LivingEntity extends Entity implements Attackable { @Override public void tick() { @@ -1444,7 +1444,7 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7 super.tick(); this.updatingUsingItem(); this.updateSwimAmount(); -@@ -2876,9 +2875,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -2911,9 +2910,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } if (!this.isRemoved()) { @@ -1454,24 +1454,23 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7 } double d0 = this.getX() - this.xo; -@@ -2960,8 +2957,6 @@ public abstract class LivingEntity extends Entity implements Attackable { - if (this.isSleeping()) { - this.setXRot(0.0F); +@@ -2997,7 +2994,6 @@ public abstract class LivingEntity extends Entity implements Attackable { } -- + + this.refreshDirtyAttributes(); - SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot } public void detectEquipmentUpdates() { -@@ -3139,7 +3134,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3167,7 +3163,6 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.setDeltaMovement(d4, d5, d6); + this.setDeltaMovement(d0, d1, d2); this.level().getProfiler().push("ai"); - SpigotTimings.timerEntityAI.startTiming(); // Spigot if (this.isImmobile()) { this.jumping = false; this.xxa = 0.0F; -@@ -3149,7 +3143,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3177,7 +3172,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.serverAiStep(); this.level().getProfiler().pop(); } @@ -1479,7 +1478,7 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7 this.level().getProfiler().pop(); this.level().getProfiler().push("jump"); -@@ -3189,7 +3182,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3217,7 +3211,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.resetFallDistance(); } @@ -1487,7 +1486,7 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7 label104: { LivingEntity entityliving = this.getControllingPassenger(); -@@ -3205,7 +3197,6 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3233,7 +3226,6 @@ public abstract class LivingEntity extends Entity implements Attackable { this.travel(vec3d1); } @@ -1495,7 +1494,7 @@ index 861f366e05af1c2bf5bbc8a4e752e3fb675747ae..5bdebdd16939480afac536ce7aaa4fe7 this.level().getProfiler().pop(); this.level().getProfiler().push("freezing"); -@@ -3232,9 +3223,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3260,9 +3252,7 @@ public abstract class LivingEntity extends Entity implements Attackable { this.checkAutoSpinAttack(axisalignedbb, this.getBoundingBox()); } @@ -1591,7 +1590,7 @@ index c02fa35cefc9194d1838abbe4f2dc2b226a41e41..b300d12e9e00519028b53aca9c3fb01f private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); public CraftPersistentDataContainer persistentDataContainer; 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 e4deb276f956c5f292ab8bf7836eeeffd6ed59d5..4185d524f61e87a469d563c938f742f63dad3c2f 100644 +index b32e1bba27c91e81b7382072c4d8230db695066c..1e434faaf56f7d1501367c4371131a8da30c0421 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -682,6 +682,7 @@ public class LevelChunk extends ChunkAccess { @@ -1637,10 +1636,10 @@ index 0eb09ce5c850d85ffd7229d27cf06b3e0edda11b..cc1d7626a82881c4410d65c6a33dadae }; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 061b1dbb92b9ec608ed9f0e2b7d09d498730610d..ccf71eba89afd2f86c6f46b6aebfe25c98f735ed 100644 +index 8c32ad9cbbe8bc9693493eee97834aaf20633ed7..71a0bad7402ec1ba48dcecb875fcad294af0f70e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -374,7 +374,7 @@ public final class CraftServer implements Server { +@@ -377,7 +377,7 @@ public final class CraftServer implements Server { this.saveCommandsConfig(); this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); @@ -1649,7 +1648,7 @@ index 061b1dbb92b9ec608ed9f0e2b7d09d498730610d..ccf71eba89afd2f86c6f46b6aebfe25c this.overrideSpawnLimits(); console.autosavePeriod = this.configuration.getInt("ticks-per.autosave"); this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose")); -@@ -2450,12 +2450,31 @@ public final class CraftServer implements Server { +@@ -2453,12 +2453,31 @@ public final class CraftServer implements Server { private final org.bukkit.Server.Spigot spigot = new org.bukkit.Server.Spigot() { @@ -1851,10 +1850,10 @@ index b0ffa23faf62629043dfd613315eaf9c5fcc2cfe..00000000000000000000000000000000 - } -} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 5afd9ccf2eef614da52ec82d3972a49722e46321..f76db40188007b6ab475d259b4cbe0c7ef804677 100644 +index 0a945ed432b431ec6c714cccf45f4e09756c7b1a..30e77f21bfc017a6a715ea1ff0ffddea0b260ac5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2550,6 +2550,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2566,6 +2566,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { CraftPlayer.this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(components, position == net.md_5.bungee.api.ChatMessageType.ACTION_BAR)); } @@ -2051,10 +2050,10 @@ index f97eccb6a17c7876e1e002d798eb67bbe80571a0..76effc345d362047e64d064eb64a5222 + } // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 0d5202f6bc14bc0cec77f86bed2f1f590e0fffeb..3a7a498003d70cf9e31acffee70b23dec0be6845 100644 +index 7546538312dbbd36e014677dce843433cb25d2a9..a638d67f9ab67c6564b3c44c6971d98995bdb203 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -224,6 +224,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -225,6 +225,12 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end // ======================================================================== @@ -2067,7 +2066,7 @@ index 0d5202f6bc14bc0cec77f86bed2f1f590e0fffeb..3a7a498003d70cf9e31acffee70b23de public static byte toLegacyData(BlockState data) { return CraftLegacy.toLegacyData(data); -@@ -450,6 +456,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -451,6 +457,13 @@ public final class CraftMagicNumbers implements UnsafeValues { return CraftFeatureFlag.getFromNMS(namespacedKey); }