From d851baa15602f420baaf30e36962280536e10de5 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 21 Sep 2023 22:41:27 -0700 Subject: [PATCH] and some more --- ...essage-to-PlayerAdvancementDoneEvent.patch | 31 ++ .../server/Add-Block-isValidTool.patch | 0 ...Add-Channel-initialization-listeners.patch | 6 +- ...Add-EntityBlockStorage-clearEntities.patch | 0 .../server/Add-EntityInsideBlockEvent.patch | 0 .../server/Add-Mob-lookAt-API.patch | 0 .../server/Add-PlayerKickEvent-causes.patch | 274 +++++++++--------- .../Add-PufferFishStateChangeEvent.patch | 0 .../server/Add-StructuresLocateEvent.patch | 0 .../Add-Unix-domain-socket-support.patch | 20 +- ...n-in-sunlight-API-for-Phantoms-and-S.patch | 0 .../server/Add-basic-Datapack-API.patch | 0 .../server/Add-bypass-host-check.patch | 4 +- ...cause-to-Weather-ThunderChangeEvents.patch | 0 ...Leash-variable-to-EntityUnleashEvent.patch | 0 ...nment-variable-to-disable-server-gui.patch | 0 ...lternative-constructor-for-Rotations.patch | 0 ...ainThreadExecutor-to-BukkitScheduler.patch | 0 .../server/Add-more-WanderingTrader-API.patch | 0 ...-address-to-AsyncPlayerPreLoginEvent.patch | 10 +- .../server/Add-recipe-to-cook-events.patch | 12 +- .../server/Add-sendOpLevel-API.patch | 0 ...le-for-always-placing-the-dragon-egg.patch | 0 .../server/Add-worldborder-events.patch | 0 .../Added-PlayerBedFailEnterEvent.patch | 0 .../server/Added-PlayerDeepSleepEvent.patch | 0 .../Added-PlayerLecternPageChangeEvent.patch | 0 .../Added-PlayerLoomPatternSelectEvent.patch | 0 ...d-PlayerStonecutterRecipeSelectEvent.patch | 0 ...ing-of-PlayerChangeBeaconEffectEvent.patch | 14 +- ...ld-settings-for-mobs-picking-up-loot.patch | 0 ...w-adding-items-to-BlockDropItemEvent.patch | 0 ...-using-signs-inside-spawn-protection.patch | 2 +- .../Attributes-API-for-item-defaults.patch | 0 ...n-for-requiring-a-player-participant.patch | 0 ...onfigurable-door-breaking-difficulty.patch | 0 .../Configurable-max-leash-distance.patch | 0 ...ignore-result-of-PlayerEditBookEvent.patch | 2 +- ...ed-item-when-player-has-disconnected.patch | 0 ...pty-commands-shall-not-be-dispatched.patch | 0 ...tab-completions-for-brigadier-comman.patch | 0 .../server/EntityMoveEvent.patch | 0 .../server/Expand-world-key-API.patch | 0 .../server/Expose-Tracked-Players.patch | 0 .../server/Expose-protocol-version.patch | 0 .../server/Fix-CraftPotionBrewer-cache.patch | 0 ...yerBucketEmptyEvent-result-itemstack.patch | 2 +- ...ItemConsumeEvent-cancelling-properly.patch | 0 ...wn-acting-as-a-bed-respawn-from-the-.patch | 0 ...x-and-optimise-world-force-upgrading.patch | 12 +- .../server/Fix-villager-boat-exploit.patch | 0 .../Implement-BlockPreDispenseEvent.patch | 10 +- ...s-to-convert-between-Component-and-B.patch | 0 ...Implemented-BlockFailedDispenseEvent.patch | 30 +- .../server/Improve-ServerGUI.patch | 0 .../Inline-shift-direction-fields.patch | 0 ...eacon-activation-deactivation-events.patch | 0 .../server/Inventory-close.patch | 0 .../server/Item-Rarity-API.patch | 0 .../server/ItemStack-repair-check-API.patch | 0 .../Limit-item-frame-cursors-on-maps.patch | 0 .../Make-schedule-command-per-world.patch | 0 ...ipes-should-return-an-immutable-list.patch | 0 .../server/More-Enchantment-API.patch | 0 .../server/More-Lidded-Block-API.patch | 0 .../server/More-World-API.patch | 0 ...ove-range-check-for-block-placing-up.patch | 2 +- ...-grindstones-from-overstacking-items.patch | 0 ...ileHitEvent-call-when-fireballs-dead.patch | 0 .../server/Remove-stale-POIs.patch | 0 .../Remove-streams-from-SensorNearest.patch | 0 ...-shield-blocking-on-dimension-change.patch | 0 ...onent-with-empty-text-instead-of-thr.patch | 0 ...mmands-if-tab-completion-is-disabled.patch | 0 .../Set-area-affect-cloud-rotation.patch | 0 .../TODO-Registry-Modification-API.patch | 0 .../server/add-DragonEggFormEvent.patch | 0 ...d-RespawnFlags-to-PlayerRespawnEvent.patch | 2 +- .../add-consumeFuel-to-FurnaceBurnEvent.patch | 0 ...t-set-drop-chance-to-EntityEquipment.patch | 0 .../add-isDeeplySleeping-to-HumanEntity.patch | 0 .../server/added-PlayerNameEntityEvent.patch | 0 ...disable-pathfinding-updates-on-block.patch | 0 ...ditions-to-PlayerGameModeChangeEvent.patch | 2 +- ...fix-PigZombieAngerEvent-cancellation.patch | 0 ...fix-PlayerItemHeldEvent-firing-twice.patch | 2 +- .../fix-converting-txt-to-json-file.patch | 2 +- ...fix-dead-slime-setSize-invincibility.patch | 0 ...telist-use-configurable-kick-message.patch | 0 ...-entity-allow-attribute-registration.patch | 0 ...essage-to-PlayerAdvancementDoneEvent.patch | 32 -- ...per-exception-on-empty-JsonList-file.patch | 18 -- .../Entity-load-save-limit-per-chunk.patch | 0 93 files changed, 231 insertions(+), 258 deletions(-) create mode 100644 patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch rename patches/{unapplied => }/server/Add-Block-isValidTool.patch (100%) rename patches/{unapplied => }/server/Add-Channel-initialization-listeners.patch (93%) rename patches/{unapplied => }/server/Add-EntityBlockStorage-clearEntities.patch (100%) rename patches/{unapplied => }/server/Add-EntityInsideBlockEvent.patch (100%) rename patches/{unapplied => }/server/Add-Mob-lookAt-API.patch (100%) rename patches/{unapplied => }/server/Add-PlayerKickEvent-causes.patch (82%) rename patches/{unapplied => }/server/Add-PufferFishStateChangeEvent.patch (100%) rename patches/{unapplied => }/server/Add-StructuresLocateEvent.patch (100%) rename patches/{unapplied => }/server/Add-Unix-domain-socket-support.patch (89%) rename patches/{unapplied => }/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch (100%) rename patches/{unapplied => }/server/Add-basic-Datapack-API.patch (100%) rename patches/{unapplied => }/server/Add-bypass-host-check.patch (95%) rename patches/{unapplied => }/server/Add-cause-to-Weather-ThunderChangeEvents.patch (100%) rename patches/{unapplied => }/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch (100%) rename patches/{unapplied => }/server/Add-environment-variable-to-disable-server-gui.patch (100%) rename patches/{unapplied => }/server/Add-fast-alternative-constructor-for-Rotations.patch (100%) rename patches/{unapplied => }/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch (100%) rename patches/{unapplied => }/server/Add-more-WanderingTrader-API.patch (100%) rename patches/{unapplied => }/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch (81%) rename patches/{unapplied => }/server/Add-recipe-to-cook-events.patch (77%) rename patches/{unapplied => }/server/Add-sendOpLevel-API.patch (100%) rename patches/{unapplied => }/server/Add-toggle-for-always-placing-the-dragon-egg.patch (100%) rename patches/{unapplied => }/server/Add-worldborder-events.patch (100%) rename patches/{unapplied => }/server/Added-PlayerBedFailEnterEvent.patch (100%) rename patches/{unapplied => }/server/Added-PlayerDeepSleepEvent.patch (100%) rename patches/{unapplied => }/server/Added-PlayerLecternPageChangeEvent.patch (100%) rename patches/{unapplied => }/server/Added-PlayerLoomPatternSelectEvent.patch (100%) rename patches/{unapplied => }/server/Added-PlayerStonecutterRecipeSelectEvent.patch (100%) rename patches/{unapplied => }/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch (69%) rename patches/{unapplied => }/server/Added-world-settings-for-mobs-picking-up-loot.patch (100%) rename patches/{unapplied => }/server/Allow-adding-items-to-BlockDropItemEvent.patch (100%) rename patches/{unapplied => }/server/Allow-using-signs-inside-spawn-protection.patch (94%) rename patches/{unapplied => }/server/Attributes-API-for-item-defaults.patch (100%) rename patches/{unapplied => }/server/Collision-option-for-requiring-a-player-participant.patch (100%) rename patches/{unapplied => }/server/Configurable-door-breaking-difficulty.patch (100%) rename patches/{unapplied => }/server/Configurable-max-leash-distance.patch (100%) rename patches/{unapplied => }/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch (91%) rename patches/{unapplied => }/server/Drop-carried-item-when-player-has-disconnected.patch (100%) rename patches/{unapplied => }/server/Empty-commands-shall-not-be-dispatched.patch (100%) rename patches/{unapplied => }/server/Enhance-console-tab-completions-for-brigadier-comman.patch (100%) rename patches/{unapplied => }/server/EntityMoveEvent.patch (100%) rename patches/{unapplied => }/server/Expand-world-key-API.patch (100%) rename patches/{unapplied => }/server/Expose-Tracked-Players.patch (100%) rename patches/{unapplied => }/server/Expose-protocol-version.patch (100%) rename patches/{unapplied => }/server/Fix-CraftPotionBrewer-cache.patch (100%) rename patches/{unapplied => }/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch (98%) rename patches/{unapplied => }/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch (100%) rename patches/{unapplied => }/server/Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch (100%) rename patches/{unapplied => }/server/Fix-and-optimise-world-force-upgrading.patch (97%) rename patches/{unapplied => }/server/Fix-villager-boat-exploit.patch (100%) rename patches/{unapplied => }/server/Implement-BlockPreDispenseEvent.patch (83%) rename patches/{unapplied => }/server/Implement-methods-to-convert-between-Component-and-B.patch (100%) rename patches/{unapplied => }/server/Implemented-BlockFailedDispenseEvent.patch (67%) rename patches/{unapplied => }/server/Improve-ServerGUI.patch (100%) rename patches/{unapplied => }/server/Inline-shift-direction-fields.patch (100%) rename patches/{unapplied => }/server/Introduce-beacon-activation-deactivation-events.patch (100%) rename patches/{unapplied => }/server/Inventory-close.patch (100%) rename patches/{unapplied => }/server/Item-Rarity-API.patch (100%) rename patches/{unapplied => }/server/ItemStack-repair-check-API.patch (100%) rename patches/{unapplied => }/server/Limit-item-frame-cursors-on-maps.patch (100%) rename patches/{unapplied => }/server/Make-schedule-command-per-world.patch (100%) rename patches/{unapplied => }/server/Merchant-getRecipes-should-return-an-immutable-list.patch (100%) rename patches/{unapplied => }/server/More-Enchantment-API.patch (100%) rename patches/{unapplied => }/server/More-Lidded-Block-API.patch (100%) rename patches/{unapplied => }/server/More-World-API.patch (100%) rename patches/{unapplied => }/server/Move-range-check-for-block-placing-up.patch (92%) rename patches/{unapplied => }/server/Prevent-grindstones-from-overstacking-items.patch (100%) rename patches/{unapplied => }/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch (100%) rename patches/{unapplied => }/server/Remove-stale-POIs.patch (100%) rename patches/{unapplied => }/server/Remove-streams-from-SensorNearest.patch (100%) rename patches/{unapplied => }/server/Reset-shield-blocking-on-dimension-change.patch (100%) rename patches/{unapplied => }/server/Return-chat-component-with-empty-text-instead-of-thr.patch (100%) rename patches/{unapplied => }/server/Send-empty-commands-if-tab-completion-is-disabled.patch (100%) rename patches/{unapplied => }/server/Set-area-affect-cloud-rotation.patch (100%) rename patches/{unapplied => }/server/TODO-Registry-Modification-API.patch (100%) rename patches/{unapplied => }/server/add-DragonEggFormEvent.patch (100%) rename patches/{unapplied => }/server/add-RespawnFlags-to-PlayerRespawnEvent.patch (97%) rename patches/{unapplied => }/server/add-consumeFuel-to-FurnaceBurnEvent.patch (100%) rename patches/{unapplied => }/server/add-get-set-drop-chance-to-EntityEquipment.patch (100%) rename patches/{unapplied => }/server/add-isDeeplySleeping-to-HumanEntity.patch (100%) rename patches/{unapplied => }/server/added-PlayerNameEntityEvent.patch (100%) rename patches/{unapplied => }/server/added-option-to-disable-pathfinding-updates-on-block.patch (100%) rename patches/{unapplied => }/server/additions-to-PlayerGameModeChangeEvent.patch (99%) rename patches/{unapplied => }/server/fix-PigZombieAngerEvent-cancellation.patch (100%) rename patches/{unapplied => }/server/fix-PlayerItemHeldEvent-firing-twice.patch (92%) rename patches/{unapplied => }/server/fix-converting-txt-to-json-file.patch (98%) rename patches/{unapplied => }/server/fix-dead-slime-setSize-invincibility.patch (100%) rename patches/{unapplied => }/server/forced-whitelist-use-configurable-kick-message.patch (100%) rename patches/{unapplied => }/server/living-entity-allow-attribute-registration.patch (100%) delete mode 100644 patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch delete mode 100644 patches/unapplied/server/Throw-proper-exception-on-empty-JsonList-file.patch rename patches/unapplied/{server => skipped}/Entity-load-save-limit-per-chunk.patch (100%) diff --git a/patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch new file mode 100644 index 0000000000..d25b1fc741 --- /dev/null +++ b/patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alvinn8 <42838560+Alvinn8@users.noreply.github.com> +Date: Fri, 8 Jan 2021 20:31:13 +0100 +Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent + + +diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java ++++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java +@@ -0,0 +0,0 @@ public class PlayerAdvancements { + this.progressChanged.add(advancement); + flag = true; + if (!flag1 && advancementprogress.isDone()) { +- this.player.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.toBukkit())); // CraftBukkit ++ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent ++ final net.kyori.adventure.text.Component message = advancement.value().display().flatMap(info -> java.util.Optional.ofNullable(info.shouldAnnounceChat() ? io.papermc.paper.adventure.PaperAdventure.asAdventure(Component.translatable("chat.type.advancement." + info.getFrame().getName(), this.player.getDisplayName(), Advancement.name(advancement))) : null)).orElse(null); ++ final org.bukkit.event.player.PlayerAdvancementDoneEvent event = new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.toBukkit(), message); ++ this.player.level().getCraftServer().getPluginManager().callEvent(event); // CraftBukkit ++ // Paper end + advancement.value().rewards().grant(this.player); + advancement.value().display().ifPresent((advancementdisplay) -> { +- if (advancementdisplay.shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { +- this.playerList.broadcastSystemMessage(Component.translatable("chat.type.advancement." + advancementdisplay.getFrame().getName(), this.player.getDisplayName(), Advancement.name(advancement)), false); ++ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent ++ if (event.message() != null && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { ++ this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false); ++ // Paper end + } + + }); diff --git a/patches/unapplied/server/Add-Block-isValidTool.patch b/patches/server/Add-Block-isValidTool.patch similarity index 100% rename from patches/unapplied/server/Add-Block-isValidTool.patch rename to patches/server/Add-Block-isValidTool.patch diff --git a/patches/unapplied/server/Add-Channel-initialization-listeners.patch b/patches/server/Add-Channel-initialization-listeners.patch similarity index 93% rename from patches/unapplied/server/Add-Channel-initialization-listeners.patch rename to patches/server/Add-Channel-initialization-listeners.patch index f50a3bd4ef..674184bb90 100644 --- a/patches/unapplied/server/Add-Channel-initialization-listeners.patch +++ b/patches/server/Add-Channel-initialization-listeners.patch @@ -147,9 +147,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java @@ -0,0 +0,0 @@ public class ServerConnectionListener { pending.add(object); // Paper - channelpipeline.addLast("packet_handler", (ChannelHandler) object); - ((Connection) object).setListener(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); + ((Connection) object).configurePacketHandler(channelpipeline); + ((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); + io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper } - }).group((EventLoopGroup) lazyinitvar.get()).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit + }).group(eventloopgroup).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit } diff --git a/patches/unapplied/server/Add-EntityBlockStorage-clearEntities.patch b/patches/server/Add-EntityBlockStorage-clearEntities.patch similarity index 100% rename from patches/unapplied/server/Add-EntityBlockStorage-clearEntities.patch rename to patches/server/Add-EntityBlockStorage-clearEntities.patch diff --git a/patches/unapplied/server/Add-EntityInsideBlockEvent.patch b/patches/server/Add-EntityInsideBlockEvent.patch similarity index 100% rename from patches/unapplied/server/Add-EntityInsideBlockEvent.patch rename to patches/server/Add-EntityInsideBlockEvent.patch diff --git a/patches/unapplied/server/Add-Mob-lookAt-API.patch b/patches/server/Add-Mob-lookAt-API.patch similarity index 100% rename from patches/unapplied/server/Add-Mob-lookAt-API.patch rename to patches/server/Add-Mob-lookAt-API.patch diff --git a/patches/unapplied/server/Add-PlayerKickEvent-causes.patch b/patches/server/Add-PlayerKickEvent-causes.patch similarity index 82% rename from patches/unapplied/server/Add-PlayerKickEvent-causes.patch rename to patches/server/Add-PlayerKickEvent-causes.patch index c40118aaca..e1244f5c83 100644 --- a/patches/unapplied/server/Add-PlayerKickEvent-causes.patch +++ b/patches/server/Add-PlayerKickEvent-causes.patch @@ -87,11 +87,111 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 source.sendSuccess(() -> { return Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason); }, true); +diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } else if (!this.isSingleplayerOwner()) { + // Paper start - This needs to be handled on the main thread for plugins + server.submit(() -> { +- this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); ++ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause + }); + // Paper endg + } +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } + } catch (Exception ex) { + ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); +- this.disconnect("Invalid payload REGISTER!"); ++ this.disconnect("Invalid payload REGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause + } + } else if (identifier.equals(CUSTOM_UNREGISTER)) { + try { +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } + } catch (Exception ex) { + ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); +- this.disconnect("Invalid payload UNREGISTER!"); ++ this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause + } + } else { + try { +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data); + } catch (Exception ex) { + ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); +- this.disconnect("Invalid custom payload!"); ++ this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause + } + } + +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + PacketUtils.ensureRunningOnSameThread(packet, this, (BlockableEventLoop) this.server); + if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { + ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.playerProfile().getName()); +- this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect")); ++ this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - kick event cause + } + // Paper start + PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.getAction().ordinal()]; +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + } + + // CraftBukkit start +- @Deprecated ++ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper + public void disconnect(String s) { // Paper +- this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); // Paper ++ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); // Paper + } + // CraftBukkit end + ++ // Paper start - kick event cause ++ public void disconnect(String s, PlayerKickEvent.Cause cause) { ++ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), cause); ++ } ++ + // Paper start ++ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper + public void disconnect(final Component reason) { +- this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason)); ++ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); ++ } ++ ++ public void disconnect(final Component reason, PlayerKickEvent.Cause cause) { ++ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason), cause); + } + +- public void disconnect(net.kyori.adventure.text.Component reason) { ++ public void disconnect(net.kyori.adventure.text.Component reason, org.bukkit.event.player.PlayerKickEvent.Cause cause) { // Paper - kick event cause + // Paper end + // CraftBukkit start - fire PlayerKickEvent + if (this.processedDisconnect) { +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + Waitable waitable = new Waitable() { + @Override + protected Object evaluate() { +- ServerCommonPacketListenerImpl.this.disconnect(reason); // Paper - adventure ++ ServerCommonPacketListenerImpl.this.disconnect(reason, cause); // Paper - adventure + return null; + } + }; +@@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack + + 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(), reason, leaveMessage); // Paper - adventure ++ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage, cause); // Paper - adventure + + if (this.cserver.getServer().isRunning()) { + this.cserver.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (this.clientIsFloating && !this.player.isSleeping() && !this.player.isPassenger() && !this.player.isDeadOrDying()) { if (++this.aboveGroundTickCount > 80) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); @@ -100,7 +200,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } } else { -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) { if (++this.aboveGroundVehicleTickCount > 80) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString()); @@ -109,16 +209,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } } else { -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - if (this.keepAlivePending) { - if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected - ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info -- this.disconnect(Component.translatable("disconnect.timeout", new Object[0])); -+ this.disconnect(Component.translatable("disconnect.timeout", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause - } - } else { - if (elapsedTime >= 15000L) { // 15 seconds -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L) { this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 @@ -127,55 +218,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - return this.server.isSingleplayerOwner(this.player.getGameProfile()); - } - -+ @io.papermc.paper.annotation.DoNotUse // Paper - public void disconnect(String s) { - // Paper start -- this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); -+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); - } - -+ public void disconnect(String s, PlayerKickEvent.Cause cause) { -+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), cause); -+ } -+ -+ @io.papermc.paper.annotation.DoNotUse // Paper - public void disconnect(final Component reason) { -- this.disconnect(PaperAdventure.asAdventure(reason)); -+ this.disconnect(PaperAdventure.asAdventure(reason), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); -+ } -+ -+ public void disconnect(final Component reason, PlayerKickEvent.Cause cause) { -+ this.disconnect(PaperAdventure.asAdventure(reason), cause); - } - -- public void disconnect(net.kyori.adventure.text.Component reason) { -+ public void disconnect(net.kyori.adventure.text.Component reason, org.bukkit.event.player.PlayerKickEvent.Cause cause) { - // Paper end - // CraftBukkit start - fire PlayerKickEvent - if (this.processedDisconnect) { -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - Waitable waitable = new Waitable() { - @Override - protected Object evaluate() { -- ServerGamePacketListenerImpl.this.disconnect(reason); // Paper - adventure -+ ServerGamePacketListenerImpl.this.disconnect(reason, cause); // Paper - adventure, kick event cause - return null; - } - }; -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - - 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(), reason, leaveMessage); // Paper - Adventure -+ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage, cause); // Paper - Adventure & kick event reason - - if (this.cserver.getServer().isRunning()) { - this.cserver.getPluginManager().callEvent(event); -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) { @@ -184,7 +227,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { Entity entity = this.player.getRootVehicle(); -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (packet.getId() == this.awaitingTeleport) { if (this.awaitingPositionFromClient == null) { @@ -193,7 +236,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper - run this async // CraftBukkit start if (this.chatSpamTickCount.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable @@ -201,15 +244,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause return; } - // Paper start - String str = packet.getCommand(); int index = -1; - if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) { -- server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]))); // Paper -+ server.scheduleOnMain(() -> this.disconnect(Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - return; - } - // Paper end -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + // CraftBukkit end +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Paper start - validate pick item position if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -218,7 +254,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; if (byteLength > 256 * 4) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with with a page too large!"); @@ -227,7 +263,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } byteTotal += byteLength; -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (byteTotal > byteAllowed) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send too large of a book. Book Size: " + byteTotal + " - Allowed: "+ byteAllowed + " - Pages: " + pageList.size()); @@ -244,7 +280,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } this.lastBookTick = MinecraftServer.currentTick; -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl public void handleMovePlayer(ServerboundMovePlayerPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) { @@ -253,7 +289,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { ServerLevel worldserver = this.player.serverLevel(); -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.dropCount++; if (this.dropCount >= 20) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); @@ -262,16 +298,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); - if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { - ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName()); -- this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect")); -+ this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - add cause - } - // Paper start - PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action.ordinal()]; -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.resetLastActionTime(); } else { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -280,7 +307,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // CraftBukkit end if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.message())) { @@ -289,7 +316,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { Optional optional = this.tryHandleChat(packet.message(), packet.timeStamp(), packet.lastSeenMessages()); -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleChatCommand(ServerboundChatCommandPacket packet) { if (ServerGamePacketListenerImpl.isChatMessageIllegal(packet.command())) { @@ -298,7 +325,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { Optional optional = this.tryHandleChat(packet.command(), packet.timeStamp(), packet.lastSeenMessages()); -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) { if (exception.shouldDisconnect()) { @@ -307,7 +334,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED)); } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private Optional tryHandleChat(String message, Instant timestamp, LastSeenMessages.Update acknowledgment) { if (!this.updateChatOrder(timestamp)) { ServerGamePacketListenerImpl.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), message); @@ -316,7 +343,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return Optional.empty(); } else { Optional optional = this.unpackAndApplyLastSeen(acknowledgment); -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (optional.isEmpty()) { ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); @@ -325,7 +352,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } return optional; -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // this.chatSpamTickCount += 20; if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // CraftBukkit end @@ -334,7 +361,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl synchronized (this.lastSeenMessages) { if (!this.lastSeenMessages.applyOffset(packet.offset())) { ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); @@ -343,7 +370,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } if (i > 4096) { @@ -352,16 +379,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Spigot Start if ( entity == this.player && !this.player.isSpectator() ) { -- this.disconnect( "Cannot interact with self!" ); -+ this.disconnect( "Cannot interact with self!", org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - add cause +- disconnect( "Cannot interact with self!" ); ++ disconnect( "Cannot interact with self!" , org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - kick event cause return; } // Spigot End -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // CraftBukkit end } } else { @@ -370,7 +397,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Paper start if (!org.bukkit.Bukkit.isPrimaryThread()) { if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { @@ -379,43 +406,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } else if (!this.isSingleplayerOwner()) { - // Paper start - This needs to be handled on the main thread for plugins - server.submit(() -> { -- this.disconnect(Component.translatable("disconnect.timeout")); -+ this.disconnect(Component.translatable("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause - }); - // Paper end - } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } - } catch (Exception ex) { - ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); -- this.disconnect("Invalid payload REGISTER!"); -+ this.disconnect("Invalid payload REGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause - } - } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { - try { -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - } - } catch (Exception ex) { - ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); -- this.disconnect("Invalid payload UNREGISTER!"); -+ this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause - } - } else { - try { -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); - } catch (Exception ex) { - ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); -- this.disconnect("Invalid custom payload!"); -+ this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause - } - } - -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) { if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) { @@ -424,8 +415,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { try { SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator(); -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator, Duration.ZERO)); +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator)); } catch (ProfilePublicKey.ValidationException profilepublickey_b) { ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); - this.disconnect(profilepublickey_b.getComponent()); @@ -463,11 +454,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java @@ -0,0 +0,0 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) { - public static ProfilePublicKey createValidated(SignatureValidator servicesSignatureVerifier, UUID playerUuid, ProfilePublicKey.Data publicKeyData, Duration gracePeriod) throws ProfilePublicKey.ValidationException { - if (publicKeyData.hasExpired(gracePeriod)) { -- throw new ProfilePublicKey.ValidationException(EXPIRED_PROFILE_PUBLIC_KEY); -+ throw new ProfilePublicKey.ValidationException(EXPIRED_PROFILE_PUBLIC_KEY, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes - } else if (!publicKeyData.validateSignature(servicesSignatureVerifier, playerUuid)) { + public static ProfilePublicKey createValidated(SignatureValidator servicesSignatureVerifier, UUID playerUuid, ProfilePublicKey.Data publicKeyData) throws ProfilePublicKey.ValidationException { + if (!publicKeyData.validateSignature(servicesSignatureVerifier, playerUuid)) { - throw new ProfilePublicKey.ValidationException(INVALID_SIGNATURE); + throw new ProfilePublicKey.ValidationException(INVALID_SIGNATURE, org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PUBLIC_KEY_SIGNATURE); // Paper - kick event causes } else { diff --git a/patches/unapplied/server/Add-PufferFishStateChangeEvent.patch b/patches/server/Add-PufferFishStateChangeEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PufferFishStateChangeEvent.patch rename to patches/server/Add-PufferFishStateChangeEvent.patch diff --git a/patches/unapplied/server/Add-StructuresLocateEvent.patch b/patches/server/Add-StructuresLocateEvent.patch similarity index 100% rename from patches/unapplied/server/Add-StructuresLocateEvent.patch rename to patches/server/Add-StructuresLocateEvent.patch diff --git a/patches/unapplied/server/Add-Unix-domain-socket-support.patch b/patches/server/Add-Unix-domain-socket-support.patch similarity index 89% rename from patches/unapplied/server/Add-Unix-domain-socket-support.patch rename to patches/server/Add-Unix-domain-socket-support.patch index 526fbc08c9..8425142266 100644 --- a/patches/unapplied/server/Add-Unix-domain-socket-support.patch +++ b/patches/server/Add-Unix-domain-socket-support.patch @@ -70,23 +70,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 synchronized (this.channels) { @@ -0,0 +0,0 @@ public class ServerConnectionListener { - LazyLoadedValue lazyinitvar; + EventLoopGroup eventloopgroup; if (Epoll.isAvailable() && this.server.isEpollEnabled()) { ++ // Paper start + if (address instanceof io.netty.channel.unix.DomainSocketAddress) { + oclass = io.netty.channel.epoll.EpollServerDomainSocketChannel.class; + } else { oclass = EpollServerSocketChannel.class; + } - lazyinitvar = ServerConnectionListener.SERVER_EPOLL_EVENT_GROUP; ++ // Paper end + eventloopgroup = (EventLoopGroup) ServerConnectionListener.SERVER_EPOLL_EVENT_GROUP.get(); ServerConnectionListener.LOGGER.info("Using epoll channel type"); } else { @@ -0,0 +0,0 @@ public class ServerConnectionListener { - ((Connection) object).setListener(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); + ((Connection) object).setListenerForServerboundHandshake(new ServerHandshakePacketListenerImpl(ServerConnectionListener.this.server, (Connection) object)); io.papermc.paper.network.ChannelInitializeListenerHolder.callListeners(channel); // Paper } -- }).group((EventLoopGroup) lazyinitvar.get()).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit -+ }).group((EventLoopGroup) lazyinitvar.get()).localAddress(address)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit // Paper +- }).group(eventloopgroup).localAddress(address, port)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit ++ }).group(eventloopgroup).localAddress(address)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit // Paper } } @@ -94,7 +96,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Spigot Start public SocketAddress getRawAddress() { @@ -111,7 +113,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL - this.connection.setProtocol(ConnectionProtocol.LOGIN); + this.connection.setClientboundProtocolAfterHandshake(ClientIntent.LOGIN); // CraftBukkit start - Connection throttle try { + if (!(this.connection.channel.localAddress() instanceof io.netty.channel.unix.DomainSocketAddress)) { // Paper - the connection throttle is useless when you have a Unix domain socket @@ -132,10 +134,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper + // Paper start - Unix domain socket support + java.net.SocketAddress socketAddress = connection.getRemoteAddress(); - packet.hostName = split[0]; + connection.hostname = split[0]; - connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); + connection.address = new java.net.InetSocketAddress(split[1], socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0); + // Paper end - connection.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] ); + connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] ); } else { diff --git a/patches/unapplied/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch similarity index 100% rename from patches/unapplied/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch rename to patches/server/Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch diff --git a/patches/unapplied/server/Add-basic-Datapack-API.patch b/patches/server/Add-basic-Datapack-API.patch similarity index 100% rename from patches/unapplied/server/Add-basic-Datapack-API.patch rename to patches/server/Add-basic-Datapack-API.patch diff --git a/patches/unapplied/server/Add-bypass-host-check.patch b/patches/server/Add-bypass-host-check.patch similarity index 95% rename from patches/unapplied/server/Add-bypass-host-check.patch rename to patches/server/Add-bypass-host-check.patch index c7413dd2ce..d081cabe32 100644 --- a/patches/unapplied/server/Add-bypass-host-check.patch +++ b/patches/server/Add-bypass-host-check.patch @@ -25,6 +25,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above! - if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { + if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.BYPASS_HOSTCHECK || ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) { // Paper - packet.hostName = split[0]; + connection.hostname = split[0]; connection.address = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getPort()); - connection.spoofedUUID = com.mojang.util.UUIDTypeAdapter.fromString( split[2] ); + connection.spoofedUUID = com.mojang.util.UndashedUuid.fromStringLenient( split[2] ); diff --git a/patches/unapplied/server/Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/server/Add-cause-to-Weather-ThunderChangeEvents.patch similarity index 100% rename from patches/unapplied/server/Add-cause-to-Weather-ThunderChangeEvents.patch rename to patches/server/Add-cause-to-Weather-ThunderChangeEvents.patch diff --git a/patches/unapplied/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch similarity index 100% rename from patches/unapplied/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch rename to patches/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch diff --git a/patches/unapplied/server/Add-environment-variable-to-disable-server-gui.patch b/patches/server/Add-environment-variable-to-disable-server-gui.patch similarity index 100% rename from patches/unapplied/server/Add-environment-variable-to-disable-server-gui.patch rename to patches/server/Add-environment-variable-to-disable-server-gui.patch diff --git a/patches/unapplied/server/Add-fast-alternative-constructor-for-Rotations.patch b/patches/server/Add-fast-alternative-constructor-for-Rotations.patch similarity index 100% rename from patches/unapplied/server/Add-fast-alternative-constructor-for-Rotations.patch rename to patches/server/Add-fast-alternative-constructor-for-Rotations.patch diff --git a/patches/unapplied/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch similarity index 100% rename from patches/unapplied/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch rename to patches/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch diff --git a/patches/unapplied/server/Add-more-WanderingTrader-API.patch b/patches/server/Add-more-WanderingTrader-API.patch similarity index 100% rename from patches/unapplied/server/Add-more-WanderingTrader-API.patch rename to patches/server/Add-more-WanderingTrader-API.patch diff --git a/patches/unapplied/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch similarity index 81% rename from patches/unapplied/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch rename to patches/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch index 97bc03473a..5343f54e96 100644 --- a/patches/unapplied/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch +++ b/patches/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch @@ -9,15 +9,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - public void fireEvents() throws Exception { - String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName(); + public void fireEvents(GameProfile gameprofile) throws Exception { + String playerName = gameprofile.getName(); java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress(); -+ java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) connection.channel.remoteAddress()).getAddress(); // Paper - java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId(); ++ java.net.InetAddress rawAddress = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.channel.remoteAddress()).getAddress(); // Paper + java.util.UUID uniqueId = gameprofile.getId(); final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; // Paper start - com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile); + com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(gameprofile); - AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, profile); + AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile); // Paper - add rawAddress server.getPluginManager().callEvent(asyncEvent); diff --git a/patches/unapplied/server/Add-recipe-to-cook-events.patch b/patches/server/Add-recipe-to-cook-events.patch similarity index 77% rename from patches/unapplied/server/Add-recipe-to-cook-events.patch rename to patches/server/Add-recipe-to-cook-events.patch index fbd9fbbd3e..83c285ec8d 100644 --- a/patches/unapplied/server/Add-recipe-to-cook-events.patch +++ b/patches/server/Add-recipe-to-cook-events.patch @@ -25,19 +25,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (campfire.cookingProgress[i] >= campfire.cookingTime[i]) { SimpleContainer inventorysubcontainer = new SimpleContainer(new ItemStack[]{itemstack}); -- ItemStack itemstack1 = (ItemStack) campfire.quickCheck.getRecipeFor(inventorysubcontainer, world).map((recipecampfire) -> { -+ Optional recipe = campfire.quickCheck.getRecipeFor( inventorysubcontainer, world); -+ ItemStack itemstack1 = (ItemStack) recipe.map((recipecampfire) -> { +- ItemStack itemstack1 = (ItemStack) campfire.quickCheck.getRecipeFor(inventorysubcontainer, world).map((recipeholder) -> { +- return ((CampfireCookingRecipe) recipeholder.value()).assemble(inventorysubcontainer, world.registryAccess()); ++ Optional> recipeHolderOptional = campfire.quickCheck.getRecipeFor( inventorysubcontainer, world); ++ ItemStack itemstack1 = (ItemStack) recipeHolderOptional.map((recipeholder) -> { + // Paper end - return recipecampfire.assemble(inventorysubcontainer, world.registryAccess()); ++ return recipeholder.value().assemble(inventorysubcontainer, world.registryAccess()); }).orElse(itemstack); + if (itemstack1.isItemEnabled(world.enabledFeatures())) { @@ -0,0 +0,0 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable { CraftItemStack source = CraftItemStack.asCraftMirror(itemstack); org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); - BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result); -+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result, (org.bukkit.inventory.CookingRecipe) recipe.map(CampfireCookingRecipe::toBukkitRecipe).orElse(null)); // Paper ++ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, pos), source, result, (org.bukkit.inventory.CookingRecipe) recipeHolderOptional.map(RecipeHolder::toBukkitRecipe).orElse(null)); // Paper world.getCraftServer().getPluginManager().callEvent(blockCookEvent); if (blockCookEvent.isCancelled()) { diff --git a/patches/unapplied/server/Add-sendOpLevel-API.patch b/patches/server/Add-sendOpLevel-API.patch similarity index 100% rename from patches/unapplied/server/Add-sendOpLevel-API.patch rename to patches/server/Add-sendOpLevel-API.patch diff --git a/patches/unapplied/server/Add-toggle-for-always-placing-the-dragon-egg.patch b/patches/server/Add-toggle-for-always-placing-the-dragon-egg.patch similarity index 100% rename from patches/unapplied/server/Add-toggle-for-always-placing-the-dragon-egg.patch rename to patches/server/Add-toggle-for-always-placing-the-dragon-egg.patch diff --git a/patches/unapplied/server/Add-worldborder-events.patch b/patches/server/Add-worldborder-events.patch similarity index 100% rename from patches/unapplied/server/Add-worldborder-events.patch rename to patches/server/Add-worldborder-events.patch diff --git a/patches/unapplied/server/Added-PlayerBedFailEnterEvent.patch b/patches/server/Added-PlayerBedFailEnterEvent.patch similarity index 100% rename from patches/unapplied/server/Added-PlayerBedFailEnterEvent.patch rename to patches/server/Added-PlayerBedFailEnterEvent.patch diff --git a/patches/unapplied/server/Added-PlayerDeepSleepEvent.patch b/patches/server/Added-PlayerDeepSleepEvent.patch similarity index 100% rename from patches/unapplied/server/Added-PlayerDeepSleepEvent.patch rename to patches/server/Added-PlayerDeepSleepEvent.patch diff --git a/patches/unapplied/server/Added-PlayerLecternPageChangeEvent.patch b/patches/server/Added-PlayerLecternPageChangeEvent.patch similarity index 100% rename from patches/unapplied/server/Added-PlayerLecternPageChangeEvent.patch rename to patches/server/Added-PlayerLecternPageChangeEvent.patch diff --git a/patches/unapplied/server/Added-PlayerLoomPatternSelectEvent.patch b/patches/server/Added-PlayerLoomPatternSelectEvent.patch similarity index 100% rename from patches/unapplied/server/Added-PlayerLoomPatternSelectEvent.patch rename to patches/server/Added-PlayerLoomPatternSelectEvent.patch diff --git a/patches/unapplied/server/Added-PlayerStonecutterRecipeSelectEvent.patch b/patches/server/Added-PlayerStonecutterRecipeSelectEvent.patch similarity index 100% rename from patches/unapplied/server/Added-PlayerStonecutterRecipeSelectEvent.patch rename to patches/server/Added-PlayerStonecutterRecipeSelectEvent.patch diff --git a/patches/unapplied/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch b/patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch similarity index 69% rename from patches/unapplied/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch rename to patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch index b27ed51bf1..9265885c69 100644 --- a/patches/unapplied/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch +++ b/patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/inventory/BeaconMenu.java @@ -0,0 +0,0 @@ public class BeaconMenu extends AbstractContainerMenu { public MobEffect getSecondaryEffect() { - return MobEffect.byId(this.beaconData.get(2)); + return BeaconMenu.decodeEffect(this.beaconData.get(2)); } + // Paper start + private static @Nullable org.bukkit.potion.PotionEffectType convert(Optional effect) { @@ -22,17 +22,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void updateEffects(Optional primary, Optional secondary) { if (this.paymentSlot.hasItem()) { -- this.beaconData.set(1, (Integer) primary.map(MobEffect::getId).orElse(-1)); -- this.beaconData.set(2, (Integer) secondary.map(MobEffect::getId).orElse(-1)); +- this.beaconData.set(1, BeaconMenu.encodeEffect((MobEffect) primary.orElse(null))); // CraftBukkit - decompile error +- this.beaconData.set(2, BeaconMenu.encodeEffect((MobEffect) secondary.orElse(null))); // CraftBukkit - decompile error + // Paper start + io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock()); + if (event.callEvent()) { -+ this.beaconData.set(1, event.getPrimary() == null ? -1 : event.getPrimary().getId()); -+ this.beaconData.set(2, event.getSecondary() == null ? -1 : event.getSecondary().getId()); -+ if (event.willConsumeItem()) { ++ this.beaconData.set(1, BeaconMenu.encodeEffect(event.getPrimary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getPrimary()))); ++ this.beaconData.set(2, BeaconMenu.encodeEffect(event.getSecondary() == null ? null : org.bukkit.craftbukkit.potion.CraftPotionEffectType.bukkitToMinecraft(event.getSecondary()))); ++ if (event.willConsumeItem()) { + // Paper end this.paymentSlot.remove(1); -+ } ++ } this.access.execute(Level::blockEntityChanged); + } // Paper end } diff --git a/patches/unapplied/server/Added-world-settings-for-mobs-picking-up-loot.patch b/patches/server/Added-world-settings-for-mobs-picking-up-loot.patch similarity index 100% rename from patches/unapplied/server/Added-world-settings-for-mobs-picking-up-loot.patch rename to patches/server/Added-world-settings-for-mobs-picking-up-loot.patch diff --git a/patches/unapplied/server/Allow-adding-items-to-BlockDropItemEvent.patch b/patches/server/Allow-adding-items-to-BlockDropItemEvent.patch similarity index 100% rename from patches/unapplied/server/Allow-adding-items-to-BlockDropItemEvent.patch rename to patches/server/Allow-adding-items-to-BlockDropItemEvent.patch diff --git a/patches/unapplied/server/Allow-using-signs-inside-spawn-protection.patch b/patches/server/Allow-using-signs-inside-spawn-protection.patch similarity index 94% rename from patches/unapplied/server/Allow-using-signs-inside-spawn-protection.patch rename to patches/server/Allow-using-signs-inside-spawn-protection.patch index 113ff8db69..592c874435 100644 --- a/patches/unapplied/server/Allow-using-signs-inside-spawn-protection.patch +++ b/patches/server/Allow-using-signs-inside-spawn-protection.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl int i = this.player.level().getMaxBuildHeight(); if (blockposition.getY() < i) { diff --git a/patches/unapplied/server/Attributes-API-for-item-defaults.patch b/patches/server/Attributes-API-for-item-defaults.patch similarity index 100% rename from patches/unapplied/server/Attributes-API-for-item-defaults.patch rename to patches/server/Attributes-API-for-item-defaults.patch diff --git a/patches/unapplied/server/Collision-option-for-requiring-a-player-participant.patch b/patches/server/Collision-option-for-requiring-a-player-participant.patch similarity index 100% rename from patches/unapplied/server/Collision-option-for-requiring-a-player-participant.patch rename to patches/server/Collision-option-for-requiring-a-player-participant.patch diff --git a/patches/unapplied/server/Configurable-door-breaking-difficulty.patch b/patches/server/Configurable-door-breaking-difficulty.patch similarity index 100% rename from patches/unapplied/server/Configurable-door-breaking-difficulty.patch rename to patches/server/Configurable-door-breaking-difficulty.patch diff --git a/patches/unapplied/server/Configurable-max-leash-distance.patch b/patches/server/Configurable-max-leash-distance.patch similarity index 100% rename from patches/unapplied/server/Configurable-max-leash-distance.patch rename to patches/server/Configurable-max-leash-distance.patch diff --git a/patches/unapplied/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch b/patches/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch similarity index 91% rename from patches/unapplied/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch rename to patches/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch index 05690d2308..38f3f983bf 100644 --- a/patches/unapplied/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch +++ b/patches/server/Don-t-ignore-result-of-PlayerEditBookEvent.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } itemstack.addTagElement("pages", nbttaglist); diff --git a/patches/unapplied/server/Drop-carried-item-when-player-has-disconnected.patch b/patches/server/Drop-carried-item-when-player-has-disconnected.patch similarity index 100% rename from patches/unapplied/server/Drop-carried-item-when-player-has-disconnected.patch rename to patches/server/Drop-carried-item-when-player-has-disconnected.patch diff --git a/patches/unapplied/server/Empty-commands-shall-not-be-dispatched.patch b/patches/server/Empty-commands-shall-not-be-dispatched.patch similarity index 100% rename from patches/unapplied/server/Empty-commands-shall-not-be-dispatched.patch rename to patches/server/Empty-commands-shall-not-be-dispatched.patch diff --git a/patches/unapplied/server/Enhance-console-tab-completions-for-brigadier-comman.patch b/patches/server/Enhance-console-tab-completions-for-brigadier-comman.patch similarity index 100% rename from patches/unapplied/server/Enhance-console-tab-completions-for-brigadier-comman.patch rename to patches/server/Enhance-console-tab-completions-for-brigadier-comman.patch diff --git a/patches/unapplied/server/EntityMoveEvent.patch b/patches/server/EntityMoveEvent.patch similarity index 100% rename from patches/unapplied/server/EntityMoveEvent.patch rename to patches/server/EntityMoveEvent.patch diff --git a/patches/unapplied/server/Expand-world-key-API.patch b/patches/server/Expand-world-key-API.patch similarity index 100% rename from patches/unapplied/server/Expand-world-key-API.patch rename to patches/server/Expand-world-key-API.patch diff --git a/patches/unapplied/server/Expose-Tracked-Players.patch b/patches/server/Expose-Tracked-Players.patch similarity index 100% rename from patches/unapplied/server/Expose-Tracked-Players.patch rename to patches/server/Expose-Tracked-Players.patch diff --git a/patches/unapplied/server/Expose-protocol-version.patch b/patches/server/Expose-protocol-version.patch similarity index 100% rename from patches/unapplied/server/Expose-protocol-version.patch rename to patches/server/Expose-protocol-version.patch diff --git a/patches/unapplied/server/Fix-CraftPotionBrewer-cache.patch b/patches/server/Fix-CraftPotionBrewer-cache.patch similarity index 100% rename from patches/unapplied/server/Fix-CraftPotionBrewer-cache.patch rename to patches/server/Fix-CraftPotionBrewer-cache.patch diff --git a/patches/unapplied/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch b/patches/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch similarity index 98% rename from patches/unapplied/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch rename to patches/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch index 538949bdf8..b7efae81b5 100644 --- a/patches/unapplied/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch +++ b/patches/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch @@ -39,4 +39,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + itemLeftInHandAfterPlayerBucketEmptyEvent = event.getItemStack() != null ? event.getItemStack().equals(CraftItemStack.asNewCraftStack(net.minecraft.world.item.Items.BUCKET)) ? null : CraftItemStack.asNMSCopy(event.getItemStack()) : ItemStack.EMPTY; // Paper - fix empty event result itemstack } // CraftBukkit end - if (!flag1) { + if (!flag2) { diff --git a/patches/unapplied/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch b/patches/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch similarity index 100% rename from patches/unapplied/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch rename to patches/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch diff --git a/patches/unapplied/server/Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch b/patches/server/Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch similarity index 100% rename from patches/unapplied/server/Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch rename to patches/server/Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch diff --git a/patches/unapplied/server/Fix-and-optimise-world-force-upgrading.patch b/patches/server/Fix-and-optimise-world-force-upgrading.patch similarity index 97% rename from patches/unapplied/server/Fix-and-optimise-world-force-upgrading.patch rename to patches/server/Fix-and-optimise-world-force-upgrading.patch index c4067d52d3..64fcd4f99b 100644 --- a/patches/unapplied/server/Fix-and-optimise-world-force-upgrading.patch +++ b/patches/server/Fix-and-optimise-world-force-upgrading.patch @@ -250,9 +250,9 @@ diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/mi index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -0,0 +0,0 @@ import java.nio.file.Paths; +@@ -0,0 +0,0 @@ import java.nio.file.Path; + import java.nio.file.Paths; import java.util.Optional; - import java.util.UUID; import java.util.function.BooleanSupplier; +import io.papermc.paper.world.ThreadedWorldUpgrader; import joptsimple.NonOptionArgumentSpec; @@ -329,7 +329,7 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSto index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -0,0 +0,0 @@ public class RegionFileStorage implements AutoCloseable { +@@ -0,0 +0,0 @@ public final class RegionFileStorage implements AutoCloseable { this.sync = dsync; } @@ -358,9 +358,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end + - // Paper start - public synchronized RegionFile getRegionFileIfLoaded(ChunkPos chunkcoordintpair) { - return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ())); + private RegionFile getRegionFile(ChunkPos chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit + long i = ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()); + RegionFile regionfile = (RegionFile) this.regionCache.getAndMoveToFirst(i); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/patches/unapplied/server/Fix-villager-boat-exploit.patch b/patches/server/Fix-villager-boat-exploit.patch similarity index 100% rename from patches/unapplied/server/Fix-villager-boat-exploit.patch rename to patches/server/Fix-villager-boat-exploit.patch diff --git a/patches/unapplied/server/Implement-BlockPreDispenseEvent.patch b/patches/server/Implement-BlockPreDispenseEvent.patch similarity index 83% rename from patches/unapplied/server/Implement-BlockPreDispenseEvent.patch rename to patches/server/Implement-BlockPreDispenseEvent.patch index 4cc07496cc..52a7607482 100644 --- a/patches/unapplied/server/Implement-BlockPreDispenseEvent.patch +++ b/patches/server/Implement-BlockPreDispenseEvent.patch @@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java @@ -0,0 +0,0 @@ public class DispenserBlock extends BaseEntityBlock { - DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack); + DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack); - if (idispensebehavior != DispenseItemBehavior.NOOP) { + if (idispensebehavior != DispenseItemBehavior.NOOP) { + if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockPreDispenseEvent(world, pos, itemstack, i)) return; // Paper - BlockPreDispenseEvent is called here - DispenserBlock.eventFired = false; // CraftBukkit - reset event status - tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack)); - } + DispenserBlock.eventFired = false; // CraftBukkit - reset event status + tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack)); + } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/patches/unapplied/server/Implement-methods-to-convert-between-Component-and-B.patch b/patches/server/Implement-methods-to-convert-between-Component-and-B.patch similarity index 100% rename from patches/unapplied/server/Implement-methods-to-convert-between-Component-and-B.patch rename to patches/server/Implement-methods-to-convert-between-Component-and-B.patch diff --git a/patches/unapplied/server/Implemented-BlockFailedDispenseEvent.patch b/patches/server/Implemented-BlockFailedDispenseEvent.patch similarity index 67% rename from patches/unapplied/server/Implemented-BlockFailedDispenseEvent.patch rename to patches/server/Implemented-BlockFailedDispenseEvent.patch index ac9062f8c0..ee6f6a550d 100644 --- a/patches/unapplied/server/Implemented-BlockFailedDispenseEvent.patch +++ b/patches/server/Implemented-BlockFailedDispenseEvent.patch @@ -9,28 +9,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/block/DispenserBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DispenserBlock.java @@ -0,0 +0,0 @@ public class DispenserBlock extends BaseEntityBlock { - int i = tileentitydispenser.getRandomSlot(world.random); + int i = tileentitydispenser.getRandomSlot(world.random); - if (i < 0) { -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) {// Paper - BlockFailedDispenseEvent is called here - world.levelEvent(1001, pos, 0); - world.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState())); -+ } // Paper - } else { - ItemStack itemstack = tileentitydispenser.getItem(i); - DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack); + if (i < 0) { ++ if (orgg.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) {// Paper - BlockFailedDispenseEvent is called here + world.levelEvent(1001, pos, 0); + world.gameEvent(GameEvent.BLOCK_ACTIVATE, pos, GameEvent.Context.of(tileentitydispenser.getBlockState())); ++ } // Paper + } else { + ItemStack itemstack = tileentitydispenser.getItem(i); + DispenseItemBehavior idispensebehavior = this.getDispenseMethod(itemstack); diff --git a/src/main/java/net/minecraft/world/level/block/DropperBlock.java b/src/main/java/net/minecraft/world/level/block/DropperBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DropperBlock.java @@ -0,0 +0,0 @@ public class DropperBlock extends DispenserBlock { - int i = tileentitydispenser.getRandomSlot(world.random); + int i = tileentitydispenser.getRandomSlot(world.random); - if (i < 0) { -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - BlockFailedDispenseEvent is called here - world.levelEvent(1001, pos, 0); - } else { - ItemStack itemstack = tileentitydispenser.getItem(i); + if (i < 0) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFailedDispenseEvent(world, pos)) // Paper - BlockFailedDispenseEvent is called here + world.levelEvent(1001, pos, 0); + } else { + ItemStack itemstack = tileentitydispenser.getItem(i); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/patches/unapplied/server/Improve-ServerGUI.patch b/patches/server/Improve-ServerGUI.patch similarity index 100% rename from patches/unapplied/server/Improve-ServerGUI.patch rename to patches/server/Improve-ServerGUI.patch diff --git a/patches/unapplied/server/Inline-shift-direction-fields.patch b/patches/server/Inline-shift-direction-fields.patch similarity index 100% rename from patches/unapplied/server/Inline-shift-direction-fields.patch rename to patches/server/Inline-shift-direction-fields.patch diff --git a/patches/unapplied/server/Introduce-beacon-activation-deactivation-events.patch b/patches/server/Introduce-beacon-activation-deactivation-events.patch similarity index 100% rename from patches/unapplied/server/Introduce-beacon-activation-deactivation-events.patch rename to patches/server/Introduce-beacon-activation-deactivation-events.patch diff --git a/patches/unapplied/server/Inventory-close.patch b/patches/server/Inventory-close.patch similarity index 100% rename from patches/unapplied/server/Inventory-close.patch rename to patches/server/Inventory-close.patch diff --git a/patches/unapplied/server/Item-Rarity-API.patch b/patches/server/Item-Rarity-API.patch similarity index 100% rename from patches/unapplied/server/Item-Rarity-API.patch rename to patches/server/Item-Rarity-API.patch diff --git a/patches/unapplied/server/ItemStack-repair-check-API.patch b/patches/server/ItemStack-repair-check-API.patch similarity index 100% rename from patches/unapplied/server/ItemStack-repair-check-API.patch rename to patches/server/ItemStack-repair-check-API.patch diff --git a/patches/unapplied/server/Limit-item-frame-cursors-on-maps.patch b/patches/server/Limit-item-frame-cursors-on-maps.patch similarity index 100% rename from patches/unapplied/server/Limit-item-frame-cursors-on-maps.patch rename to patches/server/Limit-item-frame-cursors-on-maps.patch diff --git a/patches/unapplied/server/Make-schedule-command-per-world.patch b/patches/server/Make-schedule-command-per-world.patch similarity index 100% rename from patches/unapplied/server/Make-schedule-command-per-world.patch rename to patches/server/Make-schedule-command-per-world.patch diff --git a/patches/unapplied/server/Merchant-getRecipes-should-return-an-immutable-list.patch b/patches/server/Merchant-getRecipes-should-return-an-immutable-list.patch similarity index 100% rename from patches/unapplied/server/Merchant-getRecipes-should-return-an-immutable-list.patch rename to patches/server/Merchant-getRecipes-should-return-an-immutable-list.patch diff --git a/patches/unapplied/server/More-Enchantment-API.patch b/patches/server/More-Enchantment-API.patch similarity index 100% rename from patches/unapplied/server/More-Enchantment-API.patch rename to patches/server/More-Enchantment-API.patch diff --git a/patches/unapplied/server/More-Lidded-Block-API.patch b/patches/server/More-Lidded-Block-API.patch similarity index 100% rename from patches/unapplied/server/More-Lidded-Block-API.patch rename to patches/server/More-Lidded-Block-API.patch diff --git a/patches/unapplied/server/More-World-API.patch b/patches/server/More-World-API.patch similarity index 100% rename from patches/unapplied/server/More-World-API.patch rename to patches/server/More-World-API.patch diff --git a/patches/unapplied/server/Move-range-check-for-block-placing-up.patch b/patches/server/Move-range-check-for-block-placing-up.patch similarity index 92% rename from patches/unapplied/server/Move-range-check-for-block-placing-up.patch rename to patches/server/Move-range-check-for-block-placing-up.patch index bc89977054..d622eb2e30 100644 --- a/patches/unapplied/server/Move-range-check-for-block-placing-up.patch +++ b/patches/server/Move-range-check-for-block-placing-up.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (itemstack.isItemEnabled(worldserver.enabledFeatures())) { BlockHitResult movingobjectpositionblock = packet.getHitResult(); Vec3 vec3d = movingobjectpositionblock.getLocation(); diff --git a/patches/unapplied/server/Prevent-grindstones-from-overstacking-items.patch b/patches/server/Prevent-grindstones-from-overstacking-items.patch similarity index 100% rename from patches/unapplied/server/Prevent-grindstones-from-overstacking-items.patch rename to patches/server/Prevent-grindstones-from-overstacking-items.patch diff --git a/patches/unapplied/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch b/patches/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch similarity index 100% rename from patches/unapplied/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch rename to patches/server/Remove-ProjectileHitEvent-call-when-fireballs-dead.patch diff --git a/patches/unapplied/server/Remove-stale-POIs.patch b/patches/server/Remove-stale-POIs.patch similarity index 100% rename from patches/unapplied/server/Remove-stale-POIs.patch rename to patches/server/Remove-stale-POIs.patch diff --git a/patches/unapplied/server/Remove-streams-from-SensorNearest.patch b/patches/server/Remove-streams-from-SensorNearest.patch similarity index 100% rename from patches/unapplied/server/Remove-streams-from-SensorNearest.patch rename to patches/server/Remove-streams-from-SensorNearest.patch diff --git a/patches/unapplied/server/Reset-shield-blocking-on-dimension-change.patch b/patches/server/Reset-shield-blocking-on-dimension-change.patch similarity index 100% rename from patches/unapplied/server/Reset-shield-blocking-on-dimension-change.patch rename to patches/server/Reset-shield-blocking-on-dimension-change.patch diff --git a/patches/unapplied/server/Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch similarity index 100% rename from patches/unapplied/server/Return-chat-component-with-empty-text-instead-of-thr.patch rename to patches/server/Return-chat-component-with-empty-text-instead-of-thr.patch diff --git a/patches/unapplied/server/Send-empty-commands-if-tab-completion-is-disabled.patch b/patches/server/Send-empty-commands-if-tab-completion-is-disabled.patch similarity index 100% rename from patches/unapplied/server/Send-empty-commands-if-tab-completion-is-disabled.patch rename to patches/server/Send-empty-commands-if-tab-completion-is-disabled.patch diff --git a/patches/unapplied/server/Set-area-affect-cloud-rotation.patch b/patches/server/Set-area-affect-cloud-rotation.patch similarity index 100% rename from patches/unapplied/server/Set-area-affect-cloud-rotation.patch rename to patches/server/Set-area-affect-cloud-rotation.patch diff --git a/patches/unapplied/server/TODO-Registry-Modification-API.patch b/patches/server/TODO-Registry-Modification-API.patch similarity index 100% rename from patches/unapplied/server/TODO-Registry-Modification-API.patch rename to patches/server/TODO-Registry-Modification-API.patch diff --git a/patches/unapplied/server/add-DragonEggFormEvent.patch b/patches/server/add-DragonEggFormEvent.patch similarity index 100% rename from patches/unapplied/server/add-DragonEggFormEvent.patch rename to patches/server/add-DragonEggFormEvent.patch diff --git a/patches/unapplied/server/add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/add-RespawnFlags-to-PlayerRespawnEvent.patch similarity index 97% rename from patches/unapplied/server/add-RespawnFlags-to-PlayerRespawnEvent.patch rename to patches/server/add-RespawnFlags-to-PlayerRespawnEvent.patch index 9a053abeb3..38ecf9cf4b 100644 --- a/patches/unapplied/server/add-RespawnFlags-to-PlayerRespawnEvent.patch +++ b/patches/server/add-RespawnFlags-to-PlayerRespawnEvent.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl case PERFORM_RESPAWN: if (this.player.wonGame) { this.player.wonGame = false; diff --git a/patches/unapplied/server/add-consumeFuel-to-FurnaceBurnEvent.patch b/patches/server/add-consumeFuel-to-FurnaceBurnEvent.patch similarity index 100% rename from patches/unapplied/server/add-consumeFuel-to-FurnaceBurnEvent.patch rename to patches/server/add-consumeFuel-to-FurnaceBurnEvent.patch diff --git a/patches/unapplied/server/add-get-set-drop-chance-to-EntityEquipment.patch b/patches/server/add-get-set-drop-chance-to-EntityEquipment.patch similarity index 100% rename from patches/unapplied/server/add-get-set-drop-chance-to-EntityEquipment.patch rename to patches/server/add-get-set-drop-chance-to-EntityEquipment.patch diff --git a/patches/unapplied/server/add-isDeeplySleeping-to-HumanEntity.patch b/patches/server/add-isDeeplySleeping-to-HumanEntity.patch similarity index 100% rename from patches/unapplied/server/add-isDeeplySleeping-to-HumanEntity.patch rename to patches/server/add-isDeeplySleeping-to-HumanEntity.patch diff --git a/patches/unapplied/server/added-PlayerNameEntityEvent.patch b/patches/server/added-PlayerNameEntityEvent.patch similarity index 100% rename from patches/unapplied/server/added-PlayerNameEntityEvent.patch rename to patches/server/added-PlayerNameEntityEvent.patch diff --git a/patches/unapplied/server/added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch similarity index 100% rename from patches/unapplied/server/added-option-to-disable-pathfinding-updates-on-block.patch rename to patches/server/added-option-to-disable-pathfinding-updates-on-block.patch diff --git a/patches/unapplied/server/additions-to-PlayerGameModeChangeEvent.patch b/patches/server/additions-to-PlayerGameModeChangeEvent.patch similarity index 99% rename from patches/unapplied/server/additions-to-PlayerGameModeChangeEvent.patch rename to patches/server/additions-to-PlayerGameModeChangeEvent.patch index b634a5d6b8..decce69efd 100644 --- a/patches/unapplied/server/additions-to-PlayerGameModeChangeEvent.patch +++ b/patches/server/additions-to-PlayerGameModeChangeEvent.patch @@ -134,7 +134,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH); if (this.server.isHardcore()) { diff --git a/patches/unapplied/server/fix-PigZombieAngerEvent-cancellation.patch b/patches/server/fix-PigZombieAngerEvent-cancellation.patch similarity index 100% rename from patches/unapplied/server/fix-PigZombieAngerEvent-cancellation.patch rename to patches/server/fix-PigZombieAngerEvent-cancellation.patch diff --git a/patches/unapplied/server/fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/fix-PlayerItemHeldEvent-firing-twice.patch similarity index 92% rename from patches/unapplied/server/fix-PlayerItemHeldEvent-firing-twice.patch rename to patches/server/fix-PlayerItemHeldEvent-firing-twice.patch index 1987aa120a..b9881adb60 100644 --- a/patches/unapplied/server/fix-PlayerItemHeldEvent-firing-twice.patch +++ b/patches/server/fix-PlayerItemHeldEvent-firing-twice.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (this.player.isImmobile()) return; // CraftBukkit if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) { diff --git a/patches/unapplied/server/fix-converting-txt-to-json-file.patch b/patches/server/fix-converting-txt-to-json-file.patch similarity index 98% rename from patches/unapplied/server/fix-converting-txt-to-json-file.patch rename to patches/server/fix-converting-txt-to-json-file.patch index 122d140896..9f76db6a32 100644 --- a/patches/unapplied/server/fix-converting-txt-to-json-file.patch +++ b/patches/server/fix-converting-txt-to-json-file.patch @@ -57,5 +57,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + abstract public void loadAndSaveFiles(); // Paper - moved from DedicatedPlayerList constructor - public void placeNewPlayer(Connection connection, ServerPlayer player) { + public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) { player.isRealPlayer = true; // Paper diff --git a/patches/unapplied/server/fix-dead-slime-setSize-invincibility.patch b/patches/server/fix-dead-slime-setSize-invincibility.patch similarity index 100% rename from patches/unapplied/server/fix-dead-slime-setSize-invincibility.patch rename to patches/server/fix-dead-slime-setSize-invincibility.patch diff --git a/patches/unapplied/server/forced-whitelist-use-configurable-kick-message.patch b/patches/server/forced-whitelist-use-configurable-kick-message.patch similarity index 100% rename from patches/unapplied/server/forced-whitelist-use-configurable-kick-message.patch rename to patches/server/forced-whitelist-use-configurable-kick-message.patch diff --git a/patches/unapplied/server/living-entity-allow-attribute-registration.patch b/patches/server/living-entity-allow-attribute-registration.patch similarity index 100% rename from patches/unapplied/server/living-entity-allow-attribute-registration.patch rename to patches/server/living-entity-allow-attribute-registration.patch diff --git a/patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch deleted file mode 100644 index 02bbf942ae..0000000000 --- a/patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Alvinn8 <42838560+Alvinn8@users.noreply.github.com> -Date: Fri, 8 Jan 2021 20:31:13 +0100 -Subject: [PATCH] Add Adventure message to PlayerAdvancementDoneEvent - - -diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerAdvancements.java -+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java -@@ -0,0 +0,0 @@ public class PlayerAdvancements { - this.progressChanged.add(advancement); - flag = true; - if (!flag1 && advancementprogress.isDone()) { -- this.player.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit -+ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent -+ boolean announceToChat = advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat(); -+ net.kyori.adventure.text.Component message = announceToChat ? io.papermc.paper.adventure.PaperAdventure.asAdventure(Component.translatable("chat.type.advancement." + advancement.getDisplay().getFrame().getName(), this.player.getDisplayName(), advancement.getChatComponent())) : null; -+ org.bukkit.event.player.PlayerAdvancementDoneEvent event = new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit, message); -+ this.player.level().getCraftServer().getPluginManager().callEvent(event); -+ message = event.message(); -+ // Paper end - advancement.getRewards().grant(this.player); -- if (advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { -- this.playerList.broadcastSystemMessage(Component.translatable("chat.type.advancement." + advancement.getDisplay().getFrame().getName(), this.player.getDisplayName(), advancement.getChatComponent()), false); -+ // Paper start - Add Adventure message to PlayerAdvancementDoneEvent -+ if (message != null && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) { -+ this.playerList.broadcastSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message), false); -+ // Paper end - } - } - } diff --git a/patches/unapplied/server/Throw-proper-exception-on-empty-JsonList-file.patch b/patches/unapplied/server/Throw-proper-exception-on-empty-JsonList-file.patch deleted file mode 100644 index 9f9ac5fbf7..0000000000 --- a/patches/unapplied/server/Throw-proper-exception-on-empty-JsonList-file.patch +++ /dev/null @@ -1,18 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Sun, 1 Nov 2020 16:43:11 +0100 -Subject: [PATCH] Throw proper exception on empty JsonList file - - -diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/players/StoredUserList.java -+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java -@@ -0,0 +0,0 @@ public abstract class StoredUserList> { - - try { - JsonArray jsonarray = (JsonArray) StoredUserList.GSON.fromJson(bufferedreader, JsonArray.class); -+ com.google.common.base.Preconditions.checkState(jsonarray != null, "The file \"" + this.file.getName() + "\" is either empty or corrupt"); // Paper - - this.map.clear(); - Iterator iterator = jsonarray.iterator(); diff --git a/patches/unapplied/server/Entity-load-save-limit-per-chunk.patch b/patches/unapplied/skipped/Entity-load-save-limit-per-chunk.patch similarity index 100% rename from patches/unapplied/server/Entity-load-save-limit-per-chunk.patch rename to patches/unapplied/skipped/Entity-load-save-limit-per-chunk.patch