From c6b7222da8779ac42beb1ffd8e3cda16c3e3836d Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 7 Jun 2023 18:13:54 -0700 Subject: [PATCH] finished some more patches --- ...essage-to-PlayerAdvancementDoneEvent.patch | 8 ++-- .../server/Add-BellRevealRaiderEvent.patch | 0 ...Add-Channel-initialization-listeners.patch | 0 ...Add-EntityBlockStorage-clearEntities.patch | 0 .../server/Add-EntityInsideBlockEvent.patch | 0 .../server/Add-Mob-lookAt-API.patch | 0 .../server/Add-PlayerKickEvent-causes.patch | 48 ++++++++++--------- .../Add-PufferFishStateChangeEvent.patch | 2 +- .../Add-Unix-domain-socket-support.patch | 0 ...n-in-sunlight-API-for-Phantoms-and-S.patch | 0 .../server/Add-basic-Datapack-API.patch | 0 .../server/Add-bypass-host-check.patch | 2 +- ...cause-to-Weather-ThunderChangeEvents.patch | 0 ...nment-variable-to-disable-server-gui.patch | 0 .../server/Add-more-WanderingTrader-API.patch | 8 ++-- ...n-to-fix-items-merging-through-walls.patch | 0 ...-address-to-AsyncPlayerPreLoginEvent.patch | 0 .../Added-PlayerBedFailEnterEvent.patch | 0 .../server/Added-PlayerDeepSleepEvent.patch | 0 .../Attributes-API-for-item-defaults.patch | 0 .../server/Fix-CraftPotionBrewer-cache.patch | 0 ...yerBucketEmptyEvent-result-itemstack.patch | 0 ...ItemConsumeEvent-cancelling-properly.patch | 4 +- ...wn-acting-as-a-bed-respawn-from-the-.patch | 0 ...x-and-optimise-world-force-upgrading.patch | 13 +++-- .../Fix-invulnerable-end-crystals.patch | 0 ...s-to-convert-between-Component-and-B.patch | 0 ...eacon-activation-deactivation-events.patch | 0 .../server/Inventory-close.patch | 0 .../server/ItemStack-repair-check-API.patch | 0 .../Limit-item-frame-cursors-on-maps.patch | 8 ++-- .../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 | 0 ...mmands-if-tab-completion-is-disabled.patch | 0 .../Set-area-affect-cloud-rotation.patch | 0 ...ttedContainer-instead-of-ThreadingDe.patch | 16 +++---- ...d-RespawnFlags-to-PlayerRespawnEvent.patch | 0 .../add-consumeFuel-to-FurnaceBurnEvent.patch | 0 ...t-set-drop-chance-to-EntityEquipment.patch | 0 .../add-isDeeplySleeping-to-HumanEntity.patch | 0 ...ditions-to-PlayerGameModeChangeEvent.patch | 10 ++-- ...fix-PigZombieAngerEvent-cancellation.patch | 2 +- ...fix-PlayerItemHeldEvent-firing-twice.patch | 2 +- 45 files changed, 64 insertions(+), 59 deletions(-) rename patches/{unapplied => }/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch (82%) rename patches/{unapplied => }/server/Add-BellRevealRaiderEvent.patch (100%) rename patches/{unapplied => }/server/Add-Channel-initialization-listeners.patch (100%) 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 (95%) rename patches/{unapplied => }/server/Add-PufferFishStateChangeEvent.patch (97%) rename patches/{unapplied => }/server/Add-Unix-domain-socket-support.patch (100%) 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 (97%) rename patches/{unapplied => }/server/Add-cause-to-Weather-ThunderChangeEvents.patch (100%) rename patches/{unapplied => }/server/Add-environment-variable-to-disable-server-gui.patch (100%) rename patches/{unapplied => }/server/Add-more-WanderingTrader-API.patch (86%) rename patches/{unapplied => }/server/Add-option-to-fix-items-merging-through-walls.patch (100%) rename patches/{unapplied => }/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch (100%) rename patches/{unapplied => }/server/Added-PlayerBedFailEnterEvent.patch (100%) rename patches/{unapplied => }/server/Added-PlayerDeepSleepEvent.patch (100%) rename patches/{unapplied => }/server/Attributes-API-for-item-defaults.patch (100%) rename patches/{unapplied => }/server/Fix-CraftPotionBrewer-cache.patch (100%) rename patches/{unapplied => }/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch (100%) rename patches/{unapplied => }/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch (84%) 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-invulnerable-end-crystals.patch (100%) rename patches/{unapplied => }/server/Implement-methods-to-convert-between-Component-and-B.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/ItemStack-repair-check-API.patch (100%) rename patches/{unapplied => }/server/Limit-item-frame-cursors-on-maps.patch (74%) 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 (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/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch (84%) rename patches/{unapplied => }/server/add-RespawnFlags-to-PlayerRespawnEvent.patch (100%) 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/additions-to-PlayerGameModeChangeEvent.patch (95%) rename patches/{unapplied => }/server/fix-PigZombieAngerEvent-cancellation.patch (96%) rename patches/{unapplied => }/server/fix-PlayerItemHeldEvent-firing-twice.patch (98%) diff --git a/patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch similarity index 82% rename from patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch rename to patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch index 4aba10c906..02bbf942ae 100644 --- a/patches/unapplied/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch +++ b/patches/server/Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch @@ -12,19 +12,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 +- 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); ++ 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)) { +- 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)) { ++ 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/Add-BellRevealRaiderEvent.patch b/patches/server/Add-BellRevealRaiderEvent.patch similarity index 100% rename from patches/unapplied/server/Add-BellRevealRaiderEvent.patch rename to patches/server/Add-BellRevealRaiderEvent.patch diff --git a/patches/unapplied/server/Add-Channel-initialization-listeners.patch b/patches/server/Add-Channel-initialization-listeners.patch similarity index 100% rename from patches/unapplied/server/Add-Channel-initialization-listeners.patch rename to patches/server/Add-Channel-initialization-listeners.patch 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 95% rename from patches/unapplied/server/Add-PlayerKickEvent-causes.patch rename to patches/server/Add-PlayerKickEvent-causes.patch index 5f617fe18c..9a74f509d3 100644 --- a/patches/unapplied/server/Add-PlayerKickEvent-causes.patch +++ b/patches/server/Add-PlayerKickEvent-causes.patch @@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java +++ b/src/main/java/net/minecraft/server/commands/BanPlayerCommands.java @@ -0,0 +0,0 @@ public class BanPlayerCommands { - source.sendSuccess(Component.translatable("commands.ban.success", ComponentUtils.getDisplayName(gameProfile), userBanListEntry.getReason()), true); + }, true); ServerPlayer serverPlayer = source.getServer().getPlayerList().getPlayer(gameProfile.getId()); if (serverPlayer != null) { - serverPlayer.connection.disconnect(Component.translatable("multiplayer.disconnect.banned")); @@ -84,9 +84,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for(ServerPlayer serverPlayer : targets) { - serverPlayer.connection.disconnect(reason); + serverPlayer.connection.disconnect(reason, org.bukkit.event.player.PlayerKickEvent.Cause.KICK_COMMAND); // Paper - kick event cause - source.sendSuccess(Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason), true); - } - + source.sendSuccess(() -> { + return Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason); + }, true); 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 @@ -120,7 +120,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (elapsedTime >= 15000L) { // 15 seconds @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60)) { + 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 - this.disconnect(Component.translatable("multiplayer.disconnect.idling")); + this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause @@ -177,7 +177,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.cserver.getPluginManager().callEvent(event); @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) { - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) { - this.disconnect(Component.translatable("multiplayer.disconnect.invalid_vehicle_movement")); + this.disconnect(Component.translatable("multiplayer.disconnect.invalid_vehicle_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_VEHICLE_MOVEMENT); // Paper - kick event cause @@ -185,7 +185,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Entity entity = this.player.getRootVehicle(); @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (packet.getId() == this.awaitingTeleport) { if (this.awaitingPositionFromClient == null) { - this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement")); @@ -194,21 +194,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); // Paper - run this async + // 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 - 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 - 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 - kick event cause - return; - } - // Paper end + // CraftBukkit end @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Paper start - validate pick item position if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.getInventory().items.size())) { @@ -246,12 +239,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.lastBookTick = MinecraftServer.currentTick; @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic public void handleMovePlayer(ServerboundMovePlayerPacket packet) { - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + 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))) { - this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement")); + this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause } else { - ServerLevel worldserver = this.player.getLevel(); + ServerLevel worldserver = this.player.serverLevel(); @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic this.dropCount++; @@ -263,7 +256,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + 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")); @@ -373,9 +366,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic // Paper start if (!org.bukkit.Bukkit.isPrimaryThread()) { - if (recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { -- server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper -+ server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause + if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { +- this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper ++ this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause return; } } @@ -423,7 +416,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.disconnect(ProfilePublicKey.EXPIRED_PROFILE_PUBLIC_KEY, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes } else { try { - SignatureValidator signaturevalidator = this.server.getServiceSignatureValidator(); + 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)); } catch (ProfilePublicKey.ValidationException profilepublickey_b) { @@ -520,6 +513,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } +@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + + // Paper start - improve chat handling + if (ServerGamePacketListenerImpl.isChatMessageIllegal(msg)) { +- this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters")); ++ this.getHandle().connection.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - kick event causes + } else { + if (msg.startsWith("/")) { + this.getHandle().connection.handleCommand(msg); diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/RestartCommand.java diff --git a/patches/unapplied/server/Add-PufferFishStateChangeEvent.patch b/patches/server/Add-PufferFishStateChangeEvent.patch similarity index 97% rename from patches/unapplied/server/Add-PufferFishStateChangeEvent.patch rename to patches/server/Add-PufferFishStateChangeEvent.patch index b93f250351..131e6ec10d 100644 --- a/patches/unapplied/server/Add-PufferFishStateChangeEvent.patch +++ b/patches/server/Add-PufferFishStateChangeEvent.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/entity/animal/Pufferfish.java @@ -0,0 +0,0 @@ public class Pufferfish extends AbstractFish { public void tick() { - if (!this.level.isClientSide && this.isAlive() && this.isEffectiveAi()) { + if (!this.level().isClientSide && this.isAlive() && this.isEffectiveAi()) { if (this.inflateCounter > 0) { + boolean increase = true; // Paper - Add PufferFishStateChangeEvent if (this.getPuffState() == 0) { diff --git a/patches/unapplied/server/Add-Unix-domain-socket-support.patch b/patches/server/Add-Unix-domain-socket-support.patch similarity index 100% rename from patches/unapplied/server/Add-Unix-domain-socket-support.patch rename to patches/server/Add-Unix-domain-socket-support.patch 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 97% rename from patches/unapplied/server/Add-bypass-host-check.patch rename to patches/server/Add-bypass-host-check.patch index 0f5fab930a..c7413dd2ce 100644 --- a/patches/unapplied/server/Add-bypass-host-check.patch +++ b/patches/server/Add-bypass-host-check.patch @@ -12,7 +12,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 - private static final Component IGNORE_STATUS_REASON = Component.literal("Ignoring status request"); + private static final Component IGNORE_STATUS_REASON = Component.translatable("disconnect.ignoring_status_request"); private final MinecraftServer server; private final Connection connection; + private static final boolean BYPASS_HOSTCHECK = Boolean.getBoolean("Paper.bypassHostCheck"); // Paper 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-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-more-WanderingTrader-API.patch b/patches/server/Add-more-WanderingTrader-API.patch similarity index 86% rename from patches/unapplied/server/Add-more-WanderingTrader-API.patch rename to patches/server/Add-more-WanderingTrader-API.patch index 3f9ee2352e..de5c1c3f43 100644 --- a/patches/unapplied/server/Add-more-WanderingTrader-API.patch +++ b/patches/server/Add-more-WanderingTrader-API.patch @@ -23,12 +23,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected void registerGoals() { this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(0, new UseItemGoal<>(this, PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.INVISIBILITY), SoundEvents.WANDERING_TRADER_DISAPPEARED, (entityvillagertrader) -> { -- return this.level.isNight() && !entityvillagertrader.isInvisible(); -+ return this.canDrinkPotion && this.level.isNight() && !entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API +- return this.level().isNight() && !entityvillagertrader.isInvisible(); ++ return this.canDrinkPotion && this.level().isNight() && !entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API })); this.goalSelector.addGoal(0, new UseItemGoal<>(this, new ItemStack(Items.MILK_BUCKET), SoundEvents.WANDERING_TRADER_REAPPEARED, (entityvillagertrader) -> { -- return this.level.isDay() && entityvillagertrader.isInvisible(); -+ return canDrinkMilk && this.level.isDay() && entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API +- return this.level().isDay() && entityvillagertrader.isInvisible(); ++ return this.canDrinkMilk && this.level().isDay() && entityvillagertrader.isInvisible(); // Paper - Add more WanderingTrader API })); this.goalSelector.addGoal(1, new TradeWithPlayerGoal(this)); this.goalSelector.addGoal(1, new AvoidEntityGoal<>(this, Zombie.class, 8.0F, 0.5D, 0.5D)); diff --git a/patches/unapplied/server/Add-option-to-fix-items-merging-through-walls.patch b/patches/server/Add-option-to-fix-items-merging-through-walls.patch similarity index 100% rename from patches/unapplied/server/Add-option-to-fix-items-merging-through-walls.patch rename to patches/server/Add-option-to-fix-items-merging-through-walls.patch diff --git a/patches/unapplied/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch similarity index 100% rename from patches/unapplied/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.patch rename to patches/server/Add-raw-address-to-AsyncPlayerPreLoginEvent.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/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/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 100% rename from patches/unapplied/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch rename to patches/server/Fix-PlayerBucketEmptyEvent-result-itemstack.patch diff --git a/patches/unapplied/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch b/patches/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch similarity index 84% rename from patches/unapplied/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch rename to patches/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch index 9b06f63c34..17c518cd10 100644 --- a/patches/unapplied/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch +++ b/patches/server/Fix-PlayerItemConsumeEvent-cancelling-properly.patch @@ -13,10 +13,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { - level.getCraftServer().getPluginManager().callEvent(event); + this.level().getCraftServer().getPluginManager().callEvent(event); if (event.isCancelled()) { -+ this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use ++ this.stopUsingItem(); // Paper - event is using an item, clear active item to reset its use // Update client ((ServerPlayer) this).getBukkitEntity().updateInventory(); ((ServerPlayer) this).getBukkitEntity().updateScaledHealth(); 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 fc41b3c569..8cf619b3f1 100644 --- a/patches/unapplied/server/Fix-and-optimise-world-force-upgrading.patch +++ b/patches/server/Fix-and-optimise-world-force-upgrading.patch @@ -330,10 +330,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 { + this.sync = dsync; } - // Paper start -+ public static @Nullable ChunkPos getRegionFileCoordinates(Path file) { ++ // Paper start ++ @Nullable ++ public static ChunkPos getRegionFileCoordinates(Path file) { + String fileName = file.getFileName().toString(); + if (!fileName.startsWith("r.") || !fileName.endsWith(".mca")) { + return null; @@ -354,10 +356,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + } ++ // Paper end + - 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-invulnerable-end-crystals.patch b/patches/server/Fix-invulnerable-end-crystals.patch similarity index 100% rename from patches/unapplied/server/Fix-invulnerable-end-crystals.patch rename to patches/server/Fix-invulnerable-end-crystals.patch 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/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/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 74% rename from patches/unapplied/server/Limit-item-frame-cursors-on-maps.patch rename to patches/server/Limit-item-frame-cursors-on-maps.patch index 7e0e567790..f3f70bcdf2 100644 --- a/patches/unapplied/server/Limit-item-frame-cursors-on-maps.patch +++ b/patches/server/Limit-item-frame-cursors-on-maps.patch @@ -12,12 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId()); -+ // Paper start -+ if (this.decorations.size() < player.level.paperConfig().maps.itemFrameCursorLimit) { - this.addDecoration(MapDecoration.Type.FRAME, player.level, "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null); ++ if (this.decorations.size() < player.level().paperConfig().maps.itemFrameCursorLimit) { // Paper + this.addDecoration(MapDecoration.Type.FRAME, player.level(), "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null); this.frameMarkers.put(worldmapframe1.getId(), worldmapframe1); -+ } -+ // Paper end ++ } // Paper } CompoundTag nbttagcompound = stack.getTag(); 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 100% 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 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/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch b/patches/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch similarity index 84% rename from patches/unapplied/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch rename to patches/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch index f28c5821a8..1685367dfe 100644 --- a/patches/unapplied/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch +++ b/patches/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java @@ -0,0 +0,0 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - private final T @org.jetbrains.annotations.Nullable [] presetValues; // Paper - Anti-Xray - Add preset values + public final IdMap registry; private volatile PalettedContainer.Data data; private final PalettedContainer.Strategy strategy; - private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer"); @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // this.threadingDetector.checkAndUnlock(); // Paper - disable this } - // Paper start - Anti-Xray - Add preset values + public static Codec> codecRW(IdMap idList, Codec entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) { @@ -0,0 +0,0 @@ public class PalettedContainer implements PaletteResize, PalettedContainer } @@ -42,8 +42,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - public int onResize(int newBits, T object) { + public synchronized int onResize(int newBits, T object) { // Paper - synchronize PalettedContainer.Data data = this.data; - - // Paper start - Anti-Xray - Add preset values + PalettedContainer.Data data2 = this.createOrReuseData(data, newBits); + data2.copyFrom(data.palette, data.storage); @@ -0,0 +0,0 @@ public class PalettedContainer implements PaletteResize, PalettedContainer return this.getAndSet(this.strategy.getIndex(x, y, z), value); } @@ -72,11 +72,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 try { @@ -0,0 +0,0 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + } + @Override - @Deprecated @io.papermc.paper.annotation.DoNotUse public void write(FriendlyByteBuf buf) { this.write(buf, null, 0); } - @Override -- public void write(FriendlyByteBuf buf, @Nullable com.destroystokyo.paper.antixray.ChunkPacketInfo chunkPacketInfo, int bottomBlockY) { -+ public synchronized void write(FriendlyByteBuf buf, @Nullable com.destroystokyo.paper.antixray.ChunkPacketInfo chunkPacketInfo, int bottomBlockY) { // Paper - synchronize +- public void write(FriendlyByteBuf buf) { ++ public synchronized void write(FriendlyByteBuf buf) { // Paper - synchronize this.acquire(); try { diff --git a/patches/unapplied/server/add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/server/add-RespawnFlags-to-PlayerRespawnEvent.patch similarity index 100% rename from patches/unapplied/server/add-RespawnFlags-to-PlayerRespawnEvent.patch rename to patches/server/add-RespawnFlags-to-PlayerRespawnEvent.patch 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/additions-to-PlayerGameModeChangeEvent.patch b/patches/server/additions-to-PlayerGameModeChangeEvent.patch similarity index 95% rename from patches/unapplied/server/additions-to-PlayerGameModeChangeEvent.patch rename to patches/server/additions-to-PlayerGameModeChangeEvent.patch index 364c8ba1f1..f8664214b7 100644 --- a/patches/unapplied/server/additions-to-PlayerGameModeChangeEvent.patch +++ b/patches/server/additions-to-PlayerGameModeChangeEvent.patch @@ -58,7 +58,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.bukkit.event.player.PlayerGameModeChangeEvent event = this.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null); + return event == null ? false : event.isCancelled(); + } -+ public org.bukkit.event.player.PlayerGameModeChangeEvent setGameMode(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, net.kyori.adventure.text.Component message) { ++ @Nullable ++ public org.bukkit.event.player.PlayerGameModeChangeEvent setGameMode(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, @Nullable net.kyori.adventure.text.Component message) { + org.bukkit.event.player.PlayerGameModeChangeEvent event = this.gameMode.changeGameModeForPlayer(gameMode, cause, message); + if (event == null || event.isCancelled()) { + // Paper end @@ -102,9 +103,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean changeGameModeForPlayer(GameType gameMode) { + // Paper end + PlayerGameModeChangeEvent event = this.changeGameModeForPlayer(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.UNKNOWN, null); -+ return event == null ? false : event.isCancelled(); ++ return event != null && event.isCancelled(); + } -+ public PlayerGameModeChangeEvent changeGameModeForPlayer(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, net.kyori.adventure.text.Component cancelMessage) { ++ @Nullable ++ public PlayerGameModeChangeEvent changeGameModeForPlayer(GameType gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause cause, @Nullable net.kyori.adventure.text.Component cancelMessage) { + // Paper end if (gameMode == this.gameModeForPlayer) { - return false; @@ -138,7 +140,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.server.isHardcore()) { - this.player.setGameMode(GameType.SPECTATOR); + this.player.setGameMode(GameType.SPECTATOR, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.HARDCORE_DEATH, null); // Paper - ((GameRules.BooleanValue) this.player.getLevel().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server); + ((GameRules.BooleanValue) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server); } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/patches/unapplied/server/fix-PigZombieAngerEvent-cancellation.patch b/patches/server/fix-PigZombieAngerEvent-cancellation.patch similarity index 96% rename from patches/unapplied/server/fix-PigZombieAngerEvent-cancellation.patch rename to patches/server/fix-PigZombieAngerEvent-cancellation.patch index ed64faef27..51855004c9 100644 --- a/patches/unapplied/server/fix-PigZombieAngerEvent-cancellation.patch +++ b/patches/server/fix-PigZombieAngerEvent-cancellation.patch @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true)); } @@ -0,0 +0,0 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { - this.level.getCraftServer().getPluginManager().callEvent(event); + this.level().getCraftServer().getPluginManager().callEvent(event); if (event.isCancelled()) { this.setPersistentAngerTarget(null); + pathfinderGoalHurtByTarget.stop(); // Paper - clear goalTargets to fix cancellation diff --git a/patches/unapplied/server/fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/fix-PlayerItemHeldEvent-firing-twice.patch similarity index 98% rename from patches/unapplied/server/fix-PlayerItemHeldEvent-firing-twice.patch rename to patches/server/fix-PlayerItemHeldEvent-firing-twice.patch index ad96ea3866..1987aa120a 100644 --- a/patches/unapplied/server/fix-PlayerItemHeldEvent-firing-twice.patch +++ b/patches/server/fix-PlayerItemHeldEvent-firing-twice.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (this.player.isImmobile()) return; // CraftBukkit if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) { + if (packet.getSlot() == this.player.getInventory().selected) { return; } // Paper - don't fire itemheldevent when there wasn't a slot change