From 7271649af27ff745628637025113424b4f8120d6 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Mon, 14 Jun 2021 20:50:26 -0700 Subject: [PATCH] patches --- .../0312-Add-PlayerKickEvent-causes.patch | 10 +- ...0313-Add-PufferFishStateChangeEvent.patch} | 0 .../0314-Add-BellRevealRaiderEvent.patch | 0 ...315-Add-ElderGuardianAppearanceEvent.patch | 0 .../0541-Import-fastutil-classes.patch | 1 + ...crease-structure-block-data-length-t.patch | 2 +- .../0753-Add-BellRevealRaiderEvent.patch | 26 --- .../0682-Add-PlayerKickEvent-causes.patch} | 204 +++++++++--------- ...erBucketEmptyEvent-result-itemstack.patch} | 31 +-- ...-to-fix-items-merging-through-walls.patch} | 11 +- .../0685-Add-BellRevealRaiderEvent.patch | 32 +++ .../0686-Fix-invulnerable-end-crystals.patch} | 62 ++---- ...87-Add-ElderGuardianAppearanceEvent.patch} | 6 +- ...inventory-on-cancelled-pickup-event.patch} | 18 +- ...0689-Fix-dangerous-end-portal-logic.patch} | 34 +-- 15 files changed, 195 insertions(+), 242 deletions(-) rename patches/{api-unmapped => api}/0312-Add-PlayerKickEvent-causes.patch (91%) rename patches/api/{0312-Add-PufferFishStateChangeEvent.patch => 0313-Add-PufferFishStateChangeEvent.patch} (100%) rename patches/{api-unmapped => api}/0314-Add-BellRevealRaiderEvent.patch (100%) rename patches/{api-unmapped => api}/0315-Add-ElderGuardianAppearanceEvent.patch (100%) rename patches/removed/1.17/{ => No longer needed}/0541-Import-fastutil-classes.patch (95%) rename patches/removed/1.17/{ => No longer needed}/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch (96%) delete mode 100644 patches/server-remapped/0753-Add-BellRevealRaiderEvent.patch rename patches/{server-remapped/0748-Add-PlayerKickEvent-causes.patch => server/0682-Add-PlayerKickEvent-causes.patch} (68%) rename patches/{server-remapped/0751-Fix-PlayerBucketEmptyEvent-result-itemstack.patch => server/0683-Fix-PlayerBucketEmptyEvent-result-itemstack.patch} (58%) rename patches/{server-remapped/0752-Add-option-to-fix-items-merging-through-walls.patch => server/0684-Add-option-to-fix-items-merging-through-walls.patch} (85%) create mode 100644 patches/server/0685-Add-BellRevealRaiderEvent.patch rename patches/{server-remapped/0754-Fix-invulnerable-end-crystals.patch => server/0686-Fix-invulnerable-end-crystals.patch} (56%) rename patches/{server-remapped/0755-Add-ElderGuardianAppearanceEvent.patch => server/0687-Add-ElderGuardianAppearanceEvent.patch} (83%) rename patches/{server-remapped/0756-Reset-villager-inventory-on-cancelled-pickup-event.patch => server/0688-Reset-villager-inventory-on-cancelled-pickup-event.patch} (77%) rename patches/{server-remapped/0757-Fix-dangerous-end-portal-logic.patch => server/0689-Fix-dangerous-end-portal-logic.patch} (66%) diff --git a/patches/api-unmapped/0312-Add-PlayerKickEvent-causes.patch b/patches/api/0312-Add-PlayerKickEvent-causes.patch similarity index 91% rename from patches/api-unmapped/0312-Add-PlayerKickEvent-causes.patch rename to patches/api/0312-Add-PlayerKickEvent-causes.patch index b3cfb136d3..d74f554747 100644 --- a/patches/api-unmapped/0312-Add-PlayerKickEvent-causes.patch +++ b/patches/api/0312-Add-PlayerKickEvent-causes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerKickEvent causes diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 34b51466ffb281b05f531b3f7deda245ae7fd96a..a4b236d75e77176a163094edd31f81725bbf4eca 100644 +index 38003de85a8098fc78fc947dd975990d478ee908..da83b4cbed0be6f693c7cbb1cc032356f12d7883 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -237,6 +237,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -240,6 +240,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param message kick message */ void kick(final @Nullable net.kyori.adventure.text.Component message); @@ -24,7 +24,7 @@ index 34b51466ffb281b05f531b3f7deda245ae7fd96a..a4b236d75e77176a163094edd31f8172 /** diff --git a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java -index 5c0efe74237dbe6803ce023fde99682ff70d1a92..02914c0743852e9e4fd2c085fd4b735e74d8875b 100644 +index 5c0efe74237dbe6803ce023fde99682ff70d1a92..05ecfd8c133e72d198faeeded8c757c231c871cc 100644 --- a/src/main/java/org/bukkit/event/player/PlayerKickEvent.java +++ b/src/main/java/org/bukkit/event/player/PlayerKickEvent.java @@ -12,6 +12,7 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { @@ -61,7 +61,7 @@ index 5c0efe74237dbe6803ce023fde99682ff70d1a92..02914c0743852e9e4fd2c085fd4b735e } /** -@@ -132,4 +144,63 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { +@@ -132,4 +144,65 @@ public class PlayerKickEvent extends PlayerEvent implements Cancellable { public static HandlerList getHandlerList() { return handlers; } @@ -114,6 +114,8 @@ index 5c0efe74237dbe6803ce023fde99682ff70d1a92..02914c0743852e9e4fd2c085fd4b735e + + DUPLICATE_LOGIN, + ++ RESOURCE_PACK_REJECTION, ++ + /** + * Spigot's restart command + */ diff --git a/patches/api/0312-Add-PufferFishStateChangeEvent.patch b/patches/api/0313-Add-PufferFishStateChangeEvent.patch similarity index 100% rename from patches/api/0312-Add-PufferFishStateChangeEvent.patch rename to patches/api/0313-Add-PufferFishStateChangeEvent.patch diff --git a/patches/api-unmapped/0314-Add-BellRevealRaiderEvent.patch b/patches/api/0314-Add-BellRevealRaiderEvent.patch similarity index 100% rename from patches/api-unmapped/0314-Add-BellRevealRaiderEvent.patch rename to patches/api/0314-Add-BellRevealRaiderEvent.patch diff --git a/patches/api-unmapped/0315-Add-ElderGuardianAppearanceEvent.patch b/patches/api/0315-Add-ElderGuardianAppearanceEvent.patch similarity index 100% rename from patches/api-unmapped/0315-Add-ElderGuardianAppearanceEvent.patch rename to patches/api/0315-Add-ElderGuardianAppearanceEvent.patch diff --git a/patches/removed/1.17/0541-Import-fastutil-classes.patch b/patches/removed/1.17/No longer needed/0541-Import-fastutil-classes.patch similarity index 95% rename from patches/removed/1.17/0541-Import-fastutil-classes.patch rename to patches/removed/1.17/No longer needed/0541-Import-fastutil-classes.patch index 0fd44a3e61..13fa459a56 100644 --- a/patches/removed/1.17/0541-Import-fastutil-classes.patch +++ b/patches/removed/1.17/No longer needed/0541-Import-fastutil-classes.patch @@ -3,6 +3,7 @@ From: Mariell Hoversholm Date: Wed, 12 Aug 2020 11:33:04 +0200 Subject: [PATCH] Import fastutil classes 1.17: YEET +we use real mappings now so a class called 'it' in nms is no longer a concern diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java index 95e166aa63f42c675df645a56e313bdffc2e8663..05f7d4a3835536f26f741d54a0884bd43fc82967 100644 diff --git a/patches/removed/1.17/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch b/patches/removed/1.17/No longer needed/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch similarity index 96% rename from patches/removed/1.17/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch rename to patches/removed/1.17/No longer needed/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch index ba83517560..58711e1c47 100644 --- a/patches/removed/1.17/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch +++ b/patches/removed/1.17/No longer needed/0739-Fix-MC-148809-Increase-structure-block-data-length-t.patch @@ -3,7 +3,7 @@ From: SamB440 Date: Fri, 21 May 2021 00:22:09 +0100 Subject: [PATCH] Fix MC-148809: Increase structure block data length to 128 -Fixed in 1.17 +Fixed in 1.17 - mojira issue marked as resolved diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundSetStructureBlockPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundSetStructureBlockPacket.java index 4c797dd82bb1989861e350a7e628eb847b58bbd8..4792aafd8d992cd64d05f8bbef5cbf30988949ed 100644 diff --git a/patches/server-remapped/0753-Add-BellRevealRaiderEvent.patch b/patches/server-remapped/0753-Add-BellRevealRaiderEvent.patch deleted file mode 100644 index 78020871e6..0000000000 --- a/patches/server-remapped/0753-Add-BellRevealRaiderEvent.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> -Date: Wed, 26 May 2021 17:09:07 -0400 -Subject: [PATCH] Add BellRevealRaiderEvent - - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java -index 3f9179a7678091875161a34d13b6ec0e78025c4c..03c2831a7c4f310936dad1ee72f402ed38f3c9e7 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java -@@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; - import net.minecraft.core.Position; - import net.minecraft.core.particles.ParticleTypes; -+import net.minecraft.server.MCUtil; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.EntityTypeTags; -@@ -181,6 +182,7 @@ public class BellBlockEntity extends BlockEntity implements TickableBlockEntity - } - - private void glow(LivingEntity entity) { -+ if (!new io.papermc.paper.event.block.BellRevealRaiderEvent(level.getWorld().getBlockAt(MCUtil.toLocation(level, worldPosition)), entity.getBukkitEntity()).callEvent()) return; // Paper - BellRevealRaiderEvent - entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60)); - } - } diff --git a/patches/server-remapped/0748-Add-PlayerKickEvent-causes.patch b/patches/server/0682-Add-PlayerKickEvent-causes.patch similarity index 68% rename from patches/server-remapped/0748-Add-PlayerKickEvent-causes.patch rename to patches/server/0682-Add-PlayerKickEvent-causes.patch index 82c7b23bb7..7959f099e4 100644 --- a/patches/server-remapped/0748-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0682-Add-PlayerKickEvent-causes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerKickEvent causes diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9d7cebd703bd0171ca3e95d2985c1a52fdb59712..9e3b8c7478d97bf65a875807a268d1c98389c1f8 100644 +index db2d6e7b2dc82c60d524dd2a018d28c2068552fa..c6747f49ae8ddc9fc1bad82ab480f85d0883da5d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2041,7 +2041,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop targets, Component reason) { + 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(new TranslatableComponent("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 c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560a9566399 100644 +index b369d400e34fc8b6d161d79c57bcd26d57147ff8..8e7a8e7b6d44255044a34ed374f106435cf1ba07 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -327,7 +327,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -321,7 +321,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (this.clientIsFloating && !this.player.isSleeping()) { if (++this.aboveGroundTickCount > 80) { ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString()); @@ -69,7 +69,7 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 return; } } else { -@@ -346,7 +346,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -340,7 +340,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser 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()); @@ -78,8 +78,8 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 return; } } else { -@@ -368,7 +368,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { - if (this.isPendingPing()) { +@@ -362,7 +362,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + 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(new TranslatableComponent("disconnect.timeout", new Object[0])); @@ -87,7 +87,7 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 } } else { if (elapsedTime >= 15000L) { // 15 seconds -@@ -398,7 +398,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -392,7 +392,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60)) { this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 @@ -96,7 +96,7 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 } } -@@ -423,14 +423,22 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -417,14 +417,22 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser public void disconnect(String s) { // Paper start @@ -122,28 +122,28 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 // Paper end // CraftBukkit start - fire PlayerKickEvent if (this.processedDisconnect) { -@@ -438,7 +446,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -432,7 +440,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, this.player.getBukkitEntity().displayName()); // Paper - Adventure -- PlayerKickEvent event = new PlayerKickEvent(this.craftServer.getPlayer(this.player), reason, leaveMessage); // Paper - Adventure -+ PlayerKickEvent event = new PlayerKickEvent(this.craftServer.getPlayer(this.player), reason, leaveMessage, cause); // Paper - Adventure & kick event reason +- 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.craftServer.getServer().isRunning()) { - this.craftServer.getPluginManager().callEvent(event); -@@ -516,7 +524,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { + if (this.cserver.getServer().isRunning()) { + this.cserver.getPluginManager().callEvent(event); +@@ -504,7 +512,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); - if (containsInvalidValues(packet)) { + if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) { - this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_vehicle_movement")); + this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_vehicle_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_VEHICLE_MOVEMENT); // Paper - kick event cause } else { Entity entity = this.player.getRootVehicle(); -@@ -750,13 +758,13 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -739,13 +747,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async // CraftBukkit start - if (tabSpamLimiter.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable + if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable - server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper + server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause return; @@ -156,16 +156,16 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 return; } // Paper end -@@ -904,7 +912,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -897,7 +905,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start - validate pick item position - if (!(packet.getSlot() >= 0 && packet.getSlot() < this.player.inventory.items.size())) { + 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()); - this.disconnect("Invalid hotbar selection (Hacking?)"); + this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause return; } - this.player.inventory.pickSlot(packet.getSlot()); // Paper - Diff above if changed -@@ -1058,7 +1066,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { + this.player.getInventory().pickSlot(packet.getSlot()); // Paper - Diff above if changed +@@ -1051,7 +1059,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser ListTag pageList = testStack.getTag().getList("pages", 8); if (pageList.size() > 100) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " tried to send a book with too many pages"); @@ -174,7 +174,7 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 return; } long byteTotal = 0; -@@ -1070,7 +1078,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -1063,7 +1071,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser 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!"); @@ -183,7 +183,7 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 return; } byteTotal += byteLength; -@@ -1093,14 +1101,14 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -1086,14 +1094,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser 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()); @@ -200,25 +200,34 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 return; } this.lastBookTick = MinecraftServer.currentTick; -@@ -1212,7 +1220,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -1229,7 +1237,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser public void handleMovePlayer(ServerboundMovePlayerPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); - if (containsInvalidValues(packet)) { + 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(new TranslatableComponent("multiplayer.disconnect.invalid_player_movement")); + this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause } else { ServerLevel worldserver = this.player.getLevel(); -@@ -1611,7 +1619,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -1641,7 +1649,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.dropCount++; if (this.dropCount >= 20) { - LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); + ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); - this.disconnect("You dropped your items too quickly (Hacking?)"); + this.disconnect("You dropped your items too quickly (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause return; } } -@@ -1924,7 +1932,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -1839,7 +1847,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + if (packet.getAction() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { + ServerGamePacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName()); +- this.disconnect(new TranslatableComponent("multiplayer.requiredTexturePrompt.disconnect")); ++ this.disconnect(new TranslatableComponent("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()]; +@@ -1944,7 +1952,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser this.player.resetLastActionTime(); } else { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -227,25 +236,16 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 } } -@@ -1961,7 +1969,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { - Waitable waitable = new Waitable() { - @Override - protected Object evaluate() { -- ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters")); -+ ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - kick event cause - return null; - } - }; -@@ -1976,7 +1984,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { - throw new RuntimeException(e); - } - } else { -- this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters")); -+ this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - kick event cause - } - // CraftBukkit end - return; -@@ -2030,7 +2038,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -1960,7 +1968,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + + for (int i = 0; i < s.length(); ++i) { + if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { +- this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters")); ++ this.disconnect(new TranslatableComponent("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper - add cause + return; + } + } +@@ -2033,7 +2041,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser Waitable waitable = new Waitable() { @Override protected Object evaluate() { @@ -254,7 +254,7 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 return null; } }; -@@ -2045,7 +2053,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -2048,7 +2056,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser throw new RuntimeException(e); } } else { @@ -263,43 +263,43 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 } // CraftBukkit end } -@@ -2318,7 +2326,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -2321,7 +2329,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Spigot Start - if ( entity == player && !player.isSpectator() ) + if ( entity == this.player && !this.player.isSpectator() ) { -- disconnect( "Cannot interact with self!" ); -+ disconnect( "Cannot interact with self!", org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - kick event cause +- this.disconnect( "Cannot interact with self!" ); ++ this.disconnect( "Cannot interact with self!", org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - add cause return; } // Spigot End -@@ -2395,7 +2403,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { - // CraftBukkit end - } else if (packet.getAction() == ServerboundInteractPacket.Action.ATTACK) { - if (entity instanceof ItemEntity || entity instanceof ExperienceOrb || entity instanceof AbstractArrow || (entity == this.player && !player.isSpectator())) { // CraftBukkit -- this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_entity_attacked")); -+ this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_entity_attacked"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_ENTITY_ATTACKED); // Paper - kick event cause - ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", this.player.getName().getString()); - return; +@@ -2412,7 +2420,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + } + // CraftBukkit end + } else { +- ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_entity_attacked")); ++ ServerGamePacketListenerImpl.this.disconnect(new TranslatableComponent("multiplayer.disconnect.invalid_entity_attacked"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_ENTITY_ATTACKED); // Paper - add cause + ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); + } } -@@ -2800,7 +2808,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -2806,7 +2814,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser // Paper start - if (!Bukkit.isPrimaryThread()) { - if (recipeSpamPackets.addAndGet(PaperConfig.autoRecipeIncrement) > PaperConfig.autoRecipeLimit) { + if (!org.bukkit.Bukkit.isPrimaryThread()) { + if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) { - server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper + server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause return; } } -@@ -2999,7 +3007,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -2999,7 +3007,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } else if (!this.isSingleplayerOwner()) { // Paper start - This needs to be handled on the main thread for plugins - server.scheduleOnMain(() -> { + server.submit(() -> { - this.disconnect(new TranslatableComponent("disconnect.timeout")); + this.disconnect(new TranslatableComponent("disconnect.timeout"), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause }); // Paper end } -@@ -3045,7 +3053,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -3045,7 +3053,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); @@ -308,7 +308,7 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 } } else if (packet.identifier.equals(CUSTOM_UNREGISTER)) { try { -@@ -3055,7 +3063,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { +@@ -3055,7 +3063,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); @@ -317,8 +317,8 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 } } else { try { -@@ -3074,7 +3082,7 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener { - craftServer.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet.identifier.toString(), data); +@@ -3073,7 +3081,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser + this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), packet.identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); - this.disconnect("Invalid custom payload!"); @@ -327,20 +327,20 @@ index c454908f23a436f66f8e64fc346186f113b6eefb..3e257d2cf6bf5609247bd022ccc2f560 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 6011b43ae8a858f88b8fcf6dc0bf147024a4742c..9e138bf9f9ee4efee462271d1a69a2126aa94946 100644 +index 34de9e2b0e52eb7a7e993678fd54ac1b883be4aa..bc3fe18dd32da2d381b9546aae675a475c073696 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -716,7 +716,7 @@ public abstract class PlayerList { +@@ -708,7 +708,7 @@ public abstract class PlayerList { while (iterator.hasNext()) { entityplayer = (ServerPlayer) iterator.next(); - save(entityplayer); // CraftBukkit - Force the player's inventory to be saved + this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved - entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0])); + entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause } // Instead of kicking then returning, we need to store the kick reason -@@ -1385,8 +1385,8 @@ public abstract class PlayerList { - public void shutdown(boolean isRestarting) { +@@ -1360,8 +1360,8 @@ public abstract class PlayerList { + // Paper end // CraftBukkit start - disconnect safely for (ServerPlayer player : this.players) { - if (isRestarting) player.connection.disconnect(org.spigotmc.SpigotConfig.restartMessage); else // Paper @@ -351,15 +351,15 @@ index 6011b43ae8a858f88b8fcf6dc0bf147024a4742c..9e138bf9f9ee4efee462271d1a69a212 // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 3dbe94d9b9647f5cc1e27335b36042e50c652cea..97aec6370a8a24a13ae04443d03f250f8938b2e0 100644 +index d46c2e85c845c769391af98619b9c771f13f90f7..a210ce9438455e3bf15e189fb5aea8f23dc9aae0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -495,16 +495,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -494,16 +494,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot - if (getHandle().connection == null) return; + if (this.getHandle().connection == null) return; -- getHandle().connection.disconnect(message == null ? "" : message); -+ getHandle().connection.disconnect(message == null ? "" : message, org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN); // Paper - kick event cause +- this.getHandle().connection.disconnect(message == null ? "" : message); ++ this.getHandle().connection.disconnect(message == null ? "" : message, org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN); // Paper - kick event cause } // Paper start @@ -377,9 +377,9 @@ index 3dbe94d9b9647f5cc1e27335b36042e50c652cea..97aec6370a8a24a13ae04443d03f250f + connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message, cause); } } - // Paper end + diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java -index 6498dc4c6630bfef1a52edf74d8574e5e4876720..ea1f088ac94616978af5e01a59c558cd2db4b619 100644 +index 92d97a5810a379b427a99b4c63fb9844d823a84f..160115bf8a153ff981ba308599d22c4c08026fb6 100644 --- a/src/main/java/org/spigotmc/RestartCommand.java +++ b/src/main/java/org/spigotmc/RestartCommand.java @@ -74,7 +74,7 @@ public class RestartCommand extends Command diff --git a/patches/server-remapped/0751-Fix-PlayerBucketEmptyEvent-result-itemstack.patch b/patches/server/0683-Fix-PlayerBucketEmptyEvent-result-itemstack.patch similarity index 58% rename from patches/server-remapped/0751-Fix-PlayerBucketEmptyEvent-result-itemstack.patch rename to patches/server/0683-Fix-PlayerBucketEmptyEvent-result-itemstack.patch index 85fe9b3b12..164f05c32a 100644 --- a/patches/server-remapped/0751-Fix-PlayerBucketEmptyEvent-result-itemstack.patch +++ b/patches/server/0683-Fix-PlayerBucketEmptyEvent-result-itemstack.patch @@ -6,32 +6,33 @@ Subject: [PATCH] Fix PlayerBucketEmptyEvent result itemstack Fixes SPIGOT-2560: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-2560 diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java -index d0e847e58483695d2af1c1410826bb25231cd6f6..08c00a084b2972420eae020e13480489b29aec64 100644 +index 7c3e94c6bf8337ef660473d8ed451606d56082a5..4fdb99240e6ebda946fd2e0a847654d92b7c56a1 100644 --- a/src/main/java/net/minecraft/world/item/BucketItem.java +++ b/src/main/java/net/minecraft/world/item/BucketItem.java -@@ -116,6 +116,13 @@ public class BucketItem extends Item { +@@ -41,6 +41,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent; + + public class BucketItem extends Item implements DispensibleContainerItem { + ++ private static ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper ++ + public final Fluid content; + + public BucketItem(Fluid fluid, Item.Properties settings) { +@@ -121,6 +123,13 @@ public class BucketItem extends Item implements DispensibleContainerItem { } - protected ItemStack getEmptySuccessItem(ItemStack stack, Player player) { -+ // Paper + public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) { ++ // Paper start + if (itemLeftInHandAfterPlayerBucketEmptyEvent != null) { + ItemStack itemInHand = itemLeftInHandAfterPlayerBucketEmptyEvent; + itemLeftInHandAfterPlayerBucketEmptyEvent = null; + return itemInHand; + } -+ // Paper - return !player.abilities.instabuild ? new ItemStack(Items.BUCKET) : stack; ++ // Paper end + return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack; } -@@ -126,6 +133,7 @@ public class BucketItem extends Item { - return a(player, world, pos, movingobjectpositionblock, null, null, null, null); - } - -+ private ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper - public boolean a(Player entityhuman, Level world, BlockPos blockposition, @Nullable BlockHitResult movingobjectpositionblock, Direction enumdirection, BlockPos clicked, ItemStack itemstack, InteractionHand enumhand) { - // Paper end - // CraftBukkit end -@@ -146,6 +154,9 @@ public class BucketItem extends Item { +@@ -153,6 +162,9 @@ public class BucketItem extends Item implements DispensibleContainerItem { ((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 return false; } diff --git a/patches/server-remapped/0752-Add-option-to-fix-items-merging-through-walls.patch b/patches/server/0684-Add-option-to-fix-items-merging-through-walls.patch similarity index 85% rename from patches/server-remapped/0752-Add-option-to-fix-items-merging-through-walls.patch rename to patches/server/0684-Add-option-to-fix-items-merging-through-walls.patch index 3cd329efc6..3e34d24f12 100644 --- a/patches/server-remapped/0752-Add-option-to-fix-items-merging-through-walls.patch +++ b/patches/server/0684-Add-option-to-fix-items-merging-through-walls.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option to fix items merging through walls diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 9287dfcf29ce6f89a937f4e10b70be8faab9ab9e..74f2413773fbe30597314e02a5284172e0fc40b2 100644 +index b7b160ef6feded6b84faf9958599c761828fcf59..75a02252f398b3d16f8588693e71f779d7fa062a 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -821,4 +821,9 @@ public class PaperWorldConfig { +@@ -709,5 +709,10 @@ public class PaperWorldConfig { private void mapItemFrameCursorLimit() { mapItemFrameCursorLimit = getInt("map-item-frame-cursor-limit", mapItemFrameCursorLimit); } @@ -18,11 +18,12 @@ index 9287dfcf29ce6f89a937f4e10b70be8faab9ab9e..74f2413773fbe30597314e02a5284172 + fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls); + } } + diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index 7476ae301fb4ee503944d39022cb25ccb19f1232..d937a74d2e822c8542286fb5bcdfcec7895d845c 100644 +index e0c13a112c95eed9867d4608e18dc797b0c9c9cf..158719d46c96bb733a00e08c8285f41a48406abf 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -227,6 +227,14 @@ public class ItemEntity extends Entity { +@@ -241,6 +241,14 @@ public class ItemEntity extends Entity { ItemEntity entityitem = (ItemEntity) iterator.next(); if (entityitem.isMergable()) { @@ -35,5 +36,5 @@ index 7476ae301fb4ee503944d39022cb25ccb19f1232..d937a74d2e822c8542286fb5bcdfcec7 + } + // Paper End this.tryToMerge(entityitem); - if (this.removed) { + if (this.isRemoved()) { break; diff --git a/patches/server/0685-Add-BellRevealRaiderEvent.patch b/patches/server/0685-Add-BellRevealRaiderEvent.patch new file mode 100644 index 0000000000..c434ce8f0f --- /dev/null +++ b/patches/server/0685-Add-BellRevealRaiderEvent.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> +Date: Wed, 26 May 2021 17:09:07 -0400 +Subject: [PATCH] Add BellRevealRaiderEvent + + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java +index a71bf0802d04217dd11086901b7148957d32ca89..b4a5da7e2baecc856c75283cc776398042d17108 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/BellBlockEntity.java +@@ -138,7 +138,7 @@ public class BellBlockEntity extends BlockEntity { + private static void makeRaidersGlow(Level world, BlockPos pos, List hearingEntities) { + hearingEntities.stream().filter((livingEntity) -> { + return isRaiderWithinRange(pos, livingEntity); +- }).forEach(BellBlockEntity::glow); ++ }).forEach(entity -> glow(entity, pos)); // Paper - pass BlockPos + } + + private static void showBellParticles(Level world, BlockPos pos, List hearingEntities) { +@@ -170,7 +170,11 @@ public class BellBlockEntity extends BlockEntity { + return entity.isAlive() && !entity.isRemoved() && pos.closerThan(entity.position(), 48.0D) && entity.getType().is(EntityTypeTags.RAIDERS); + } + +- private static void glow(LivingEntity entity) { ++ // Paper start ++ private static void glow(LivingEntity entity) { glow(entity, null); } ++ private static void glow(LivingEntity entity, BlockPos pos) { ++ if (pos != null && !new io.papermc.paper.event.block.BellRevealRaiderEvent(entity.level.getWorld().getBlockAt(net.minecraft.server.MCUtil.toLocation(entity.level, pos)), entity.getBukkitEntity()).callEvent()) return; ++ // Paper end + entity.addEffect(new MobEffectInstance(MobEffects.GLOWING, 60)); + } + diff --git a/patches/server-remapped/0754-Fix-invulnerable-end-crystals.patch b/patches/server/0686-Fix-invulnerable-end-crystals.patch similarity index 56% rename from patches/server-remapped/0754-Fix-invulnerable-end-crystals.patch rename to patches/server/0686-Fix-invulnerable-end-crystals.patch index d830a00fa4..39d58c730d 100644 --- a/patches/server-remapped/0754-Fix-invulnerable-end-crystals.patch +++ b/patches/server/0686-Fix-invulnerable-end-crystals.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix invulnerable end crystals MC-108513 diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 74f2413773fbe30597314e02a5284172e0fc40b2..dc5ebbb44238cb5928f385d2962c9057388575f8 100644 +index 75a02252f398b3d16f8588693e71f779d7fa062a..f2981aa82c26d7bdac08f45818813025b240b77e 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -826,4 +826,9 @@ public class PaperWorldConfig { +@@ -714,5 +714,10 @@ public class PaperWorldConfig { private void fixItemsMergingThroughWalls() { fixItemsMergingThroughWalls = getBoolean("fix-items-merging-through-walls", fixItemsMergingThroughWalls); } @@ -19,11 +19,12 @@ index 74f2413773fbe30597314e02a5284172e0fc40b2..dc5ebbb44238cb5928f385d2962c9057 + fixInvulnerableEndCrystalExploit = getBoolean("unsupported-settings.fix-invulnerable-end-crystal-exploit", fixInvulnerableEndCrystalExploit); + } } + diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java -index 6292d04464950ac52fcd6d69345db5125d3127eb..8583209750e4bb70e86d7243a47c525f1726ee42 100644 +index 2c4c1fc2a2afe88864b72d86708a3ddb6a1f50a0..5b9ba62ce37aabb268d76c23f5cb41a4a5c61a2f 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java -@@ -29,6 +29,7 @@ public class EndCrystal extends Entity { +@@ -31,6 +31,7 @@ public class EndCrystal extends Entity { private static final EntityDataAccessor> DATA_BEAM_TARGET = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.OPTIONAL_BLOCK_POS); private static final EntityDataAccessor DATA_SHOW_BOTTOM = SynchedEntityData.defineId(EndCrystal.class, EntityDataSerializers.BOOLEAN); public int time; @@ -31,7 +32,7 @@ index 6292d04464950ac52fcd6d69345db5125d3127eb..8583209750e4bb70e86d7243a47c525f public EndCrystal(EntityType type, Level world) { super(type, world); -@@ -65,6 +66,17 @@ public class EndCrystal extends Entity { +@@ -67,8 +68,20 @@ public class EndCrystal extends Entity { } // CraftBukkit end } @@ -48,58 +49,27 @@ index 6292d04464950ac52fcd6d69345db5125d3127eb..8583209750e4bb70e86d7243a47c525f + // Paper end } - } -@@ -76,6 +88,7 @@ public class EndCrystal extends Entity { - } - - tag.putBoolean("ShowBottom", this.showsBottom()); + if (this.generatedByDragonFight) tag.putBoolean("Paper.GeneratedByDragonFight", this.generatedByDragonFight); // Paper - Fix invulnerable end crystals } @Override -@@ -87,6 +100,7 @@ public class EndCrystal extends Entity { - if (tag.contains("ShowBottom", 1)) { - this.setShowBottom(tag.getBoolean("ShowBottom")); +@@ -89,6 +102,7 @@ public class EndCrystal extends Entity { + if (nbt.contains("ShowBottom", 1)) { + this.setShowBottom(nbt.getBoolean("ShowBottom")); } + if (tag.contains("Paper.GeneratedByDragonFight", 1)) this.generatedByDragonFight = tag.getBoolean("Paper.GeneratedByDragonFight"); // Paper - Fix invulnerable end crystals } diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java -index b99576b524a65cc1a0de88c49324d929503d655f..d51d2fb6d24bfee63b04f32f2cb157fec9d8ee6c 100644 +index 1e53d4bef86349eaa1356444a80ae92d4311ccce..c03bf5bdb67b00c75f9fcfead882c4d944282244 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java -@@ -42,11 +42,11 @@ public class SpikeFeature extends Feature { - return (List) SpikeFeature.SPIKE_CACHE.getUnchecked(i); - } - -- public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, SpikeConfiguration config) { -- List list = config.getSpikes(); -+ public boolean generate(WorldGenLevel generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPos blockposition, SpikeConfiguration worldgenfeatureendspikeconfiguration) { // Paper - decompile fix -+ List list = worldgenfeatureendspikeconfiguration.getSpikes(); - - if (list.isEmpty()) { -- list = getSpikesForLevel(world); -+ list = getSpikesForLevel(generatoraccessseed); - } - - Iterator iterator = list.iterator(); -@@ -54,8 +54,8 @@ public class SpikeFeature extends Feature { - while (iterator.hasNext()) { - SpikeFeature.EndSpike worldgenender_spike = (SpikeFeature.EndSpike) iterator.next(); - -- if (worldgenender_spike.isCenterWithinChunk(pos)) { -- this.placeSpike(world, random, config, worldgenender_spike); -+ if (worldgenender_spike.isCenterWithinChunk(blockposition)) { -+ this.placeSpike(generatoraccessseed, random, worldgenfeatureendspikeconfiguration, worldgenender_spike); - } - } - -@@ -106,6 +106,7 @@ public class SpikeFeature extends Feature { - entityendercrystal.setBeamTarget(config.getCrystalBeamTarget()); - entityendercrystal.setInvulnerable(config.isCrystalInvulnerable()); - entityendercrystal.moveTo((double) spike.getCenterX() + 0.5D, (double) (spike.getHeight() + 1), (double) spike.getCenterZ() + 0.5D, random.nextFloat() * 360.0F, 0.0F); -+ entityendercrystal.generatedByDragonFight = true; - world.addFreshEntity(entityendercrystal); +@@ -99,6 +99,7 @@ public class SpikeFeature extends Feature { + endCrystal.setBeamTarget(config.getCrystalBeamTarget()); + endCrystal.setInvulnerable(config.isCrystalInvulnerable()); + endCrystal.moveTo((double)spike.getCenterX() + 0.5D, (double)(spike.getHeight() + 1), (double)spike.getCenterZ() + 0.5D, random.nextFloat() * 360.0F, 0.0F); ++ endCrystal.generatedByDragonFight = true; // Paper + world.addFreshEntity(endCrystal); this.setBlock(world, new BlockPos(spike.getCenterX(), spike.getHeight(), spike.getCenterZ()), Blocks.BEDROCK.defaultBlockState()); } diff --git a/patches/server-remapped/0755-Add-ElderGuardianAppearanceEvent.patch b/patches/server/0687-Add-ElderGuardianAppearanceEvent.patch similarity index 83% rename from patches/server-remapped/0755-Add-ElderGuardianAppearanceEvent.patch rename to patches/server/0687-Add-ElderGuardianAppearanceEvent.patch index 2e0af7d211..6d3483fe35 100644 --- a/patches/server-remapped/0755-Add-ElderGuardianAppearanceEvent.patch +++ b/patches/server/0687-Add-ElderGuardianAppearanceEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add ElderGuardianAppearanceEvent diff --git a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java -index b6a842f9a24634ff84f2f4f94c0f2838f10cddb0..0cf6a06f8bddac0a2a1a00f3a4b266116f7ae594 100644 +index f4bfbce1fed066faebb44ea0880de5a8c7f902cd..ee2febe92309f277f1607c0ea024d6cd291490bc 100644 --- a/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java +++ b/src/main/java/net/minecraft/world/entity/monster/ElderGuardian.java @@ -77,10 +77,12 @@ public class ElderGuardian extends Guardian { @@ -15,9 +15,9 @@ index b6a842f9a24634ff84f2f4f94c0f2838f10cddb0..0cf6a06f8bddac0a2a1a00f3a4b26611 + if (new io.papermc.paper.event.entity.ElderGuardianAppearanceEvent(getBukkitEntity(), entityplayer.getBukkitEntity()).callEvent()) { // Paper - Add Guardian Appearance Event if (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200) { entityplayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F)); - entityplayer.addEffect(new MobEffectInstance(mobeffectlist, 6000, 2), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit + entityplayer.addEffect(new MobEffectInstance(mobeffectlist, 6000, 2), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit } -+ } // Paper - Add Guardian Appearance Event ++ } // Paper - Add Guardian Appearance Event } } diff --git a/patches/server-remapped/0756-Reset-villager-inventory-on-cancelled-pickup-event.patch b/patches/server/0688-Reset-villager-inventory-on-cancelled-pickup-event.patch similarity index 77% rename from patches/server-remapped/0756-Reset-villager-inventory-on-cancelled-pickup-event.patch rename to patches/server/0688-Reset-villager-inventory-on-cancelled-pickup-event.patch index a6ef1d69fa..502eba8446 100644 --- a/patches/server-remapped/0756-Reset-villager-inventory-on-cancelled-pickup-event.patch +++ b/patches/server/0688-Reset-villager-inventory-on-cancelled-pickup-event.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset villager inventory on cancelled pickup event diff --git a/src/main/java/net/minecraft/world/SimpleContainer.java b/src/main/java/net/minecraft/world/SimpleContainer.java -index d6bb1d540e6dcbbad5e5bdf54803c495a4f3e771..3e639f5af83bea6760669696425dffd2d741cc16 100644 +index 502e29644504aabe3834351d3b479e21bd8f4be7..4e47ea7359ae56efeb2b74161dc9e7387589415b 100644 --- a/src/main/java/net/minecraft/world/SimpleContainer.java +++ b/src/main/java/net/minecraft/world/SimpleContainer.java @@ -34,6 +34,16 @@ public class SimpleContainer implements Container, StackedContentsCompatible { @@ -23,21 +23,13 @@ index d6bb1d540e6dcbbad5e5bdf54803c495a4f3e771..3e639f5af83bea6760669696425dffd2 + // Paper end + public void onOpen(CraftHumanEntity who) { - transaction.add(who); + this.transaction.add(who); } -@@ -148,6 +158,7 @@ public class SimpleContainer implements Container, StackedContentsCompatible { - return itemstack; - } - -+ public ItemStack addItem(ItemStack itemstack) { return addItem(itemstack); } // Paper - OBFHELPER - public ItemStack addItem(ItemStack stack) { - ItemStack itemstack1 = stack.copy(); - diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 7817071b1964b962c8f4017d5bb39d74ca0ca3e4..1fbb7a2db5c362a5fc9e3f81382f729c962e377b 100644 +index ee23149411a49f08d2eb4808ef78cb5a50785977..4591054d5f106f2d630fc7bd3304a8ff7f426007 100644 --- a/src/main/java/net/minecraft/world/entity/npc/Villager.java +++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -844,15 +844,19 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -888,15 +888,19 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } // CraftBukkit start @@ -59,4 +51,4 @@ index 7817071b1964b962c8f4017d5bb39d74ca0ca3e4..1fbb7a2db5c362a5fc9e3f81382f729c + // ItemStack itemstack1 = inventorysubcontainer.a(itemstack); // Paper - moved up if (itemstack1.isEmpty()) { - item.remove(); + item.discard(); diff --git a/patches/server-remapped/0757-Fix-dangerous-end-portal-logic.patch b/patches/server/0689-Fix-dangerous-end-portal-logic.patch similarity index 66% rename from patches/server-remapped/0757-Fix-dangerous-end-portal-logic.patch rename to patches/server/0689-Fix-dangerous-end-portal-logic.patch index a1fbfe0408..3eea2269ff 100644 --- a/patches/server-remapped/0757-Fix-dangerous-end-portal-logic.patch +++ b/patches/server/0689-Fix-dangerous-end-portal-logic.patch @@ -10,23 +10,11 @@ and will result in all kinds of dupes. Move the tick logic into the post tick, where portaling was designed to happen in the first place. -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 779b926921fd435620cbbc69ed6f9931a422b652..25711ab723386db0f448c54e18ef069bfcd0dd99 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1020,6 +1020,7 @@ public class ServerPlayer extends Player implements ContainerListener { - return b(destination, TeleportCause.UNKNOWN); - } - -+ @Nullable public final Entity changeDimension(ServerLevel worldserver, PlayerTeleportEvent.TeleportCause cause) { return this.b(worldserver, cause); } // Paper - OBFHELPER - @Nullable - public Entity b(ServerLevel worldserver, PlayerTeleportEvent.TeleportCause cause) { - // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d055b362459e5b4658aa220e16118ee6174c0de4..2462a78d976937cf4737f1ce0bfde2b2b7d5b1f7 100644 +index 5d4bee5470795bd9f362fff5ae653794223fa182..3e665504ff2138f8bc40cfac74b5af722d91f6e9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -312,6 +312,37 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s +@@ -341,6 +341,37 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } // Paper end - optimise entity tracking @@ -63,8 +51,8 @@ index d055b362459e5b4658aa220e16118ee6174c0de4..2462a78d976937cf4737f1ce0bfde2b2 + public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); - this.passengers = Lists.newArrayList(); -@@ -2297,6 +2328,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s + this.passengers = ImmutableList.of(); +@@ -2487,6 +2518,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } this.processPortalCooldown(); @@ -73,18 +61,10 @@ index d055b362459e5b4658aa220e16118ee6174c0de4..2462a78d976937cf4737f1ce0bfde2b2 } diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -index 2231680140d0e3c4c10b6722fd13fe0ee55ce294..52884b87b25bef8abfa824f40d02efe3f947f330 100644 +index 739c9c3a49fd3893ac39962a02a5e3620dc4fe06..62c2f947a77570228dfdf4dae16c64eb97ee2f40 100644 --- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -@@ -3,7 +3,6 @@ package net.minecraft.world.level.block; - import net.minecraft.core.BlockPos; - import net.minecraft.resources.ResourceKey; - import net.minecraft.server.level.ServerLevel; --import net.minecraft.server.level.ServerPlayer; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.level.BlockGetter; - import net.minecraft.world.level.Level; -@@ -50,16 +49,10 @@ public class EndPortalBlock extends BaseEntityBlock { +@@ -53,16 +53,10 @@ public class EndPortalBlock extends BaseEntityBlock { // return; // CraftBukkit - always fire event in case plugins wish to change it } @@ -93,7 +73,7 @@ index 2231680140d0e3c4c10b6722fd13fe0ee55ce294..52884b87b25bef8abfa824f40d02efe3 - world.getCraftServer().getPluginManager().callEvent(event); - - if (entity instanceof ServerPlayer) { -- ((ServerPlayer) entity).b(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL); +- ((ServerPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL); - return; - } - // CraftBukkit end