diff --git a/patches/api/Add-EntityInsideBlockEvent.patch b/patches/api/Add-EntityInsideBlockEvent.patch index 5f0108d979..fc1b1084f7 100644 --- a/patches/api/Add-EntityInsideBlockEvent.patch +++ b/patches/api/Add-EntityInsideBlockEvent.patch @@ -35,6 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + *
  • Campfire
  • + *
  • Cauldron
  • + *
  • Crops
  • ++ *
  • End Gateway
  • + *
  • Ender Portal
  • + *
  • Fires
  • + *
  • Frogspawn
  • 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-ElderGuardianAppearanceEvent.patch b/patches/server/Add-ElderGuardianAppearanceEvent.patch similarity index 100% rename from patches/unapplied/server/Add-ElderGuardianAppearanceEvent.patch rename to patches/server/Add-ElderGuardianAppearanceEvent.patch diff --git a/patches/unapplied/server/Add-EntityInsideBlockEvent.patch b/patches/server/Add-EntityInsideBlockEvent.patch similarity index 93% rename from patches/unapplied/server/Add-EntityInsideBlockEvent.patch rename to patches/server/Add-EntityInsideBlockEvent.patch index acd88689ce..acbd7ea2b8 100644 --- a/patches/unapplied/server/Add-EntityInsideBlockEvent.patch +++ b/patches/server/Add-EntityInsideBlockEvent.patch @@ -85,8 +85,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if ((Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity) entity)) { - entity.hurt(world.damageSources().inFire().directBlock(world, pos), (float) this.fireDamage); // CraftBukkit + if ((Boolean) state.getValue(CampfireBlock.LIT) && entity instanceof LivingEntity) { + entity.hurt(world.damageSources().campfire().directBlock(world, pos), (float) this.fireDamage); // CraftBukkit } diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -112,18 +112,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!world.isClientSide) { if (!(Boolean) state.getValue(DetectorRailBlock.POWERED)) { this.checkPressed(world, pos, state); -diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java +diff --git a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -@@ -0,0 +0,0 @@ public class EndPortalBlock extends BaseEntityBlock { +--- a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java +@@ -0,0 +0,0 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (world instanceof ServerLevel && entity.canChangeDimensions() && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) { - ResourceKey resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends - ServerLevel worldserver = ((ServerLevel) world).getServer().getLevel(resourcekey); + if (entity.canUsePortal(false)) { + BlockEntity tileentity = world.getBlockEntity(pos); + +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java +@@ -0,0 +0,0 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal { + + @Override + protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { ++ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent + if (entity.canUsePortal(false) && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) { + // CraftBukkit start - Entity in portal + EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java @@ -188,12 +200,12 @@ diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -@@ -0,0 +0,0 @@ public class NetherPortalBlock extends Block { +@@ -0,0 +0,0 @@ public class NetherPortalBlock extends Block implements Portal { @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (entity.canChangeDimensions()) { + if (entity.canUsePortal(false)) { // CraftBukkit start - Entity in portal EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java 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-PlayerArmSwingEvent.patch b/patches/server/Add-PlayerArmSwingEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerArmSwingEvent.patch rename to patches/server/Add-PlayerArmSwingEvent.patch diff --git a/patches/unapplied/server/Add-PlayerKickEvent-causes.patch b/patches/server/Add-PlayerKickEvent-causes.patch similarity index 79% rename from patches/unapplied/server/Add-PlayerKickEvent-causes.patch rename to patches/server/Add-PlayerKickEvent-causes.patch index 7ffdd703d7..dc5e5e87d2 100644 --- a/patches/unapplied/server/Add-PlayerKickEvent-causes.patch +++ b/patches/server/Add-PlayerKickEvent-causes.patch @@ -50,8 +50,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ServerPlayer entityplayer = (ServerPlayer) iterator.next(); if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420) -- entityplayer.connection.disconnect(org.spigotmc.SpigotConfig.whitelistMessage); // Paper - use configurable message -+ entityplayer.connection.disconnect(org.spigotmc.SpigotConfig.whitelistMessage, org.bukkit.event.player.PlayerKickEvent.Cause.WHITELIST); // Paper - use configurable message +- entityplayer.connection.disconnect(net.kyori.adventure.text.Component.text(org.spigotmc.SpigotConfig.whitelistMessage)); ++ entityplayer.connection.disconnect(net.kyori.adventure.text.Component.text(org.spigotmc.SpigotConfig.whitelistMessage), org.bukkit.event.player.PlayerKickEvent.Cause.WHITELIST); // Paper - use configurable message & kick event cause } } @@ -103,7 +103,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start - This needs to be handled on the main thread for plugins server.submit(() -> { - this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); -+ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause ++ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause }); // Paper end - This needs to be handled on the main thread for plugins } @@ -111,8 +111,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); -- this.disconnect("Invalid payload REGISTER!"); -+ this.disconnect("Invalid payload REGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause +- this.disconnect(Component.literal("Invalid payload REGISTER!")); ++ this.disconnect(Component.literal("Invalid payload REGISTER!"), PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause } } else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) { try { @@ -120,8 +120,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); -- this.disconnect("Invalid payload UNREGISTER!"); -+ this.disconnect("Invalid payload UNREGISTER!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause +- this.disconnect(Component.literal("Invalid payload UNREGISTER!")); ++ this.disconnect(Component.literal("Invalid payload UNREGISTER!"), PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause } } else { try { @@ -129,8 +129,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data); } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); -- this.disconnect("Invalid custom payload!"); -+ this.disconnect("Invalid custom payload!", org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause +- this.disconnect(Component.literal("Invalid custom payload!")); ++ this.disconnect(Component.literal("Invalid custom payload!"), PlayerKickEvent.Cause.INVALID_PAYLOAD); // Paper - kick event cause } } @@ -138,8 +138,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 PacketUtils.ensureRunningOnSameThread(packet, this, (BlockableEventLoop) this.server); if (packet.action() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id()); -- this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect")); -+ this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - kick event cause +- this.disconnect((Component) Component.translatable("multiplayer.requiredTexturePrompt.disconnect")); ++ this.disconnect((Component) Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - kick event cause } // Paper start - adventure pack callbacks // call the callbacks before the previously-existing event so the event has final say @@ -148,7 +148,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end - this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY); -+ this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY, org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_COOKIE); // Paper - kick event cause ++ this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY, PlayerKickEvent.Cause.INVALID_COOKIE); // Paper - kick event cause } protected void keepConnectionAlive() { @@ -157,7 +157,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected - this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); -+ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause ++ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause } else if (this.checkIfClosed(currentTime)) { // Paper this.keepAlivePending = true; this.keepAliveTime = currentTime; @@ -166,49 +166,45 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.closed) { if (time - this.closedListenerTime >= 15000L) { - this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE); -+ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause ++ this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause } return false; @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - } - // CraftBukkit start -- @Deprecated -+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - public void disconnect(String s) { // Paper -- this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s)); // Paper -+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); // Paper + // Paper start - adventure + public void disconnect(final net.kyori.adventure.text.Component reason) { +- this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(reason)); ++ this.disconnect(reason, PlayerKickEvent.Cause.UNKNOWN); ++ } ++ public void disconnect(final net.kyori.adventure.text.Component reason, PlayerKickEvent.Cause cause) { ++ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(reason), cause); ++ // Paper end - kick event causes } - // CraftBukkit end + // Paper end - adventure -+ // Paper start - kick event cause -+ public void disconnect(String s, PlayerKickEvent.Cause cause) { -+ this.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(s), cause); ++ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - kick event causes + public void disconnect(Component reason) { +- this.disconnect(new DisconnectionDetails(reason)); ++ // Paper start - kick event causes ++ this.disconnect(reason, PlayerKickEvent.Cause.UNKNOWN); + } -+ - // Paper start -+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - public void disconnect(final Component reason) { -- this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason)); -+ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); -+ } -+ + public void disconnect(final Component reason, PlayerKickEvent.Cause cause) { -+ this.disconnect(io.papermc.paper.adventure.PaperAdventure.asAdventure(reason), cause); ++ this.disconnect(new DisconnectionDetails(reason), cause); ++ // Paper end - kick event causes } -- public void disconnect(net.kyori.adventure.text.Component reason) { -+ public void disconnect(net.kyori.adventure.text.Component reason, org.bukkit.event.player.PlayerKickEvent.Cause cause) { // Paper - kick event cause - // Paper end +- public void disconnect(DisconnectionDetails disconnectionInfo) { ++ public void disconnect(DisconnectionDetails disconnectionInfo, PlayerKickEvent.Cause cause) { // Paper - kick event cause // CraftBukkit start - fire PlayerKickEvent if (this.processedDisconnect) { + return; @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack Waitable waitable = new Waitable() { @Override protected Object evaluate() { -- ServerCommonPacketListenerImpl.this.disconnect(reason); // Paper - adventure -+ ServerCommonPacketListenerImpl.this.disconnect(reason, cause); // Paper - adventure +- ServerCommonPacketListenerImpl.this.disconnect(disconnectionInfo); ++ ServerCommonPacketListenerImpl.this.disconnect(disconnectionInfo, cause); // Paper - kick event causes return null; } }; @@ -216,8 +212,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure -- PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage); // Paper - adventure -+ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), reason, leaveMessage, cause); // Paper - adventure +- PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(disconnectionInfo.reason()), leaveMessage); // Paper - adventure ++ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), io.papermc.paper.adventure.PaperAdventure.asAdventure(disconnectionInfo.reason()), leaveMessage, cause); // Paper - adventure & kick event causes if (this.cserver.getServer().isRunning()) { this.cserver.getPluginManager().callEvent(event); @@ -247,8 +243,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 +- this.disconnect((Component) Component.translatable("multiplayer.disconnect.idling")); ++ this.disconnect((Component) Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause } } @@ -256,17 +252,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void handleMoveVehicle(ServerboundMoveVehiclePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(), packet.getY(), packet.getZ(), packet.getYRot(), packet.getXRot())) { -- 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 - } else { +- this.disconnect((Component) Component.translatable("multiplayer.disconnect.invalid_vehicle_movement")); ++ this.disconnect((Component) Component.translatable("multiplayer.disconnect.invalid_vehicle_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_VEHICLE_MOVEMENT); // Paper - kick event cause + } else if (!this.updateAwaitingTeleport()) { Entity entity = this.player.getRootVehicle(); @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (packet.getId() == this.awaitingTeleport) { if (this.awaitingPositionFromClient == null) { -- 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 +- this.disconnect((Component) Component.translatable("multiplayer.disconnect.invalid_player_movement")); ++ this.disconnect((Component) Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause return; } @@ -309,8 +305,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end - Book size limits // CraftBukkit start if (this.lastBookTick + 20 > MinecraftServer.currentTick) { -- this.disconnect("Book edited too quickly!"); -+ this.disconnect("Book edited too quickly!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause +- this.disconnect(Component.literal("Book edited too quickly!")); ++ this.disconnect(Component.literal("Book edited too quickly!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause return; } this.lastBookTick = MinecraftServer.currentTick; @@ -318,8 +314,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void handleMovePlayer(ServerboundMovePlayerPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) { -- 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 +- this.disconnect((Component) Component.translatable("multiplayer.disconnect.invalid_player_movement")); ++ this.disconnect((Component) 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.serverLevel(); @@ -327,8 +323,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.dropCount++; if (this.dropCount >= 20) { 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 +- this.disconnect(Component.literal("You dropped your items too quickly (Hacking?)")); ++ this.disconnect(Component.literal("You dropped your items too quickly (Hacking?)"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause return; } } @@ -336,8 +332,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.player.resetLastActionTime(); } else { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); -- this.disconnect("Invalid hotbar selection (Hacking?)"); // CraftBukkit -+ this.disconnect("Invalid hotbar selection (Hacking?)", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // CraftBukkit // Paper - kick event cause +- this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)")); // CraftBukkit ++ this.disconnect(Component.literal("Invalid hotbar selection (Hacking?)"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // CraftBukkit // Paper - kick event cause } } @@ -345,8 +341,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private void tryHandleChat(String s, Runnable runnable, boolean sync) { // CraftBukkit if (ServerGamePacketListenerImpl.isChatMessageIllegal(s)) { -- this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters")); -+ this.disconnect(Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper +- this.disconnect((Component) Component.translatable("multiplayer.disconnect.illegal_characters")); ++ this.disconnect((Component) Component.translatable("multiplayer.disconnect.illegal_characters"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_CHARACTERS); // Paper } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false)); } else { @@ -361,10 +357,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return optional; @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // this.chatSpamTickCount += 20; - if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { + if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // CraftBukkit end -- this.disconnect(Component.translatable("disconnect.spam")); -+ this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause +- this.disconnect((Component) Component.translatable("disconnect.spam")); ++ this.disconnect((Component) Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause } } @@ -381,8 +377,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } if (i > 4096) { -- this.disconnect(Component.translatable("multiplayer.disconnect.too_many_pending_chats")); -+ this.disconnect(Component.translatable("multiplayer.disconnect.too_many_pending_chats"), org.bukkit.event.player.PlayerKickEvent.Cause.TOO_MANY_PENDING_CHATS); // Paper - kick event cause +- this.disconnect((Component) Component.translatable("multiplayer.disconnect.too_many_pending_chats")); ++ this.disconnect((Component) Component.translatable("multiplayer.disconnect.too_many_pending_chats"), org.bukkit.event.player.PlayerKickEvent.Cause.TOO_MANY_PENDING_CHATS); // Paper - kick event cause } } @@ -390,8 +386,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Spigot Start if ( entity == this.player && !this.player.isSpectator() ) { -- this.disconnect( "Cannot interact with self!" ); -+ this.disconnect( "Cannot interact with self!" , org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - kick event cause +- this.disconnect( Component.literal( "Cannot interact with self!" ) ); ++ this.disconnect( Component.literal( "Cannot interact with self!" ), org.bukkit.event.player.PlayerKickEvent.Cause.SELF_INTERACTION ); // Paper - kick event cause return; } // Spigot End @@ -399,8 +395,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -- ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked")); -+ ServerGamePacketListenerImpl.this.disconnect(Component.translatable("multiplayer.disconnect.invalid_entity_attacked"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_ENTITY_ATTACKED); // Paper - add cause +- ServerGamePacketListenerImpl.this.disconnect((Component) Component.translatable("multiplayer.disconnect.invalid_entity_attacked")); ++ ServerGamePacketListenerImpl.this.disconnect((Component) Component.translatable("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()); } }); @@ -448,13 +444,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end // CraftBukkit start - disconnect safely for (ServerPlayer player : this.players) { -- if (isRestarting) player.connection.disconnect(org.spigotmc.SpigotConfig.restartMessage); else // Paper -- player.connection.disconnect(this.server.server.shutdownMessage()); // CraftBukkit - add custom shutdown message // Paper - Adventure -+ if (isRestarting) player.connection.disconnect(org.spigotmc.SpigotConfig.restartMessage, org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); else // Paper - kick event cause (cause is never used here) -+ player.connection.disconnect(this.server.server.shutdownMessage(), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); // CraftBukkit - add custom shutdown message // Paper - Adventure & KickEventCause (cause is never used here) +- if (isRestarting) player.connection.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.restartMessage)); else // Paper ++ if (isRestarting) player.connection.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.restartMessage), org.bukkit.event.player.PlayerKickEvent.Cause.UNKNOWN); else // Paper - kick event cause (cause is never used here) + player.connection.disconnect(java.util.Objects.requireNonNullElseGet(this.server.server.shutdownMessage(), net.kyori.adventure.text.Component::empty)); // CraftBukkit - add custom shutdown message // Paper - Adventure } // CraftBukkit end - diff --git a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java @@ -493,8 +487,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 org.spigotmc.AsyncCatcher.catchOp("player kick"); // Spigot if (this.getHandle().connection == null) return; -- 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 +- this.getHandle().connection.disconnect(CraftChatMessage.fromStringOrEmpty(message)); ++ this.getHandle().connection.disconnect(CraftChatMessage.fromStringOrEmpty(message), org.bukkit.event.player.PlayerKickEvent.Cause.PLUGIN); // Paper - kick event cause } // Paper start @@ -532,8 +526,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Kick all players for ( ServerPlayer p : com.google.common.collect.ImmutableList.copyOf( MinecraftServer.getServer().getPlayerList().players ) ) { -- p.connection.disconnect(SpigotConfig.restartMessage); -+ p.connection.disconnect(SpigotConfig.restartMessage, org.bukkit.event.player.PlayerKickEvent.Cause.RESTART_COMMAND); // Paper - kick event reason (cause is never used)) +- p.connection.disconnect( CraftChatMessage.fromStringOrEmpty( SpigotConfig.restartMessage ) ); ++ p.connection.disconnect( CraftChatMessage.fromStringOrEmpty( SpigotConfig.restartMessage ), org.bukkit.event.player.PlayerKickEvent.Cause.RESTART_COMMAND); // Paper - kick event reason (cause is never used)) } // Give the socket a chance to send the packets try diff --git a/patches/unapplied/server/Add-PlayerSetSpawnEvent.patch b/patches/server/Add-PlayerSetSpawnEvent.patch similarity index 90% rename from patches/unapplied/server/Add-PlayerSetSpawnEvent.patch rename to patches/server/Add-PlayerSetSpawnEvent.patch index 33f0e5ae00..17506b4d08 100644 --- a/patches/unapplied/server/Add-PlayerSetSpawnEvent.patch +++ b/patches/server/Add-PlayerSetSpawnEvent.patch @@ -52,17 +52,17 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { } else if (this.bedBlocked(blockposition, enumdirection)) { - return Either.left(Player.BedSleepingProblem.OBSTRUCTED); + return Either.left(net.minecraft.world.entity.player.Player.BedSleepingProblem.OBSTRUCTED); } else { - this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true, PlayerSpawnChangeEvent.Cause.BED); // CraftBukkit + this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.BED); // Paper - Add PlayerSetSpawnEvent if (this.level().isDay()) { - return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_NOW); + return Either.left(net.minecraft.world.entity.player.Player.BedSleepingProblem.NOT_POSSIBLE_NOW); } else { -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { - return this.respawnForced; +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { + this.setRespawnPosition(player.getRespawnDimension(), player.getRespawnPosition(), player.getRespawnAngle(), player.isRespawnForced(), false); } + @Deprecated // Paper - Add PlayerSetSpawnEvent @@ -145,7 +145,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { this.respawnPosition = null; this.respawnDimension = Level.OVERWORLD; -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { this.respawnForced = false; } @@ -158,14 +158,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { - location = CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), f1, 0.0F); - } else if (blockposition != null) { - entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F)); -- entityplayer1.setRespawnPosition(null, null, 0f, false, false, PlayerSpawnChangeEvent.Cause.RESET); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed -+ entityplayer1.setRespawnPosition(null, null, 0f, false, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed // Paper - Add PlayerSetSpawnEvent - } - } + // CraftBukkit end + if (dimensiontransition.missingRespawnBlock()) { + entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F)); +- entityplayer1.setRespawnPosition(null, null, 0f, false, false, PlayerSpawnChangeEvent.Cause.RESET); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed ++ entityplayer1.setRespawnPosition(null, null, 0f, false, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed // Paper - PlayerSetSpawnEvent + } + int i = flag ? 1 : 0; diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java diff --git a/patches/unapplied/server/Add-PufferFishStateChangeEvent.patch b/patches/server/Add-PufferFishStateChangeEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PufferFishStateChangeEvent.patch rename to patches/server/Add-PufferFishStateChangeEvent.patch diff --git a/patches/unapplied/server/Add-System.out-err-catcher.patch b/patches/server/Add-System.out-err-catcher.patch similarity index 100% rename from patches/unapplied/server/Add-System.out-err-catcher.patch rename to patches/server/Add-System.out-err-catcher.patch 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-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-missing-forceDrop-toggles.patch b/patches/server/Add-missing-forceDrop-toggles.patch similarity index 100% rename from patches/unapplied/server/Add-missing-forceDrop-toggles.patch rename to patches/server/Add-missing-forceDrop-toggles.patch diff --git a/patches/unapplied/server/Add-more-LimitedRegion-API.patch b/patches/server/Add-more-LimitedRegion-API.patch similarity index 100% rename from patches/unapplied/server/Add-more-LimitedRegion-API.patch rename to patches/server/Add-more-LimitedRegion-API.patch 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/server/Adventure.patch b/patches/server/Adventure.patch index 802b12a6c1..4b6d6b29b5 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -2819,7 +2819,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // Paper start - adventure -+ public void disconnect(@Nullable final net.kyori.adventure.text.Component reason) { ++ public void disconnect(final net.kyori.adventure.text.Component reason) { + this.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(reason)); + } + // Paper end - adventure @@ -3082,7 +3082,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start - disconnect safely for (ServerPlayer player : this.players) { - player.connection.disconnect(CraftChatMessage.fromStringOrEmpty(this.server.server.getShutdownMessage())); // CraftBukkit - add custom shutdown message -+ player.connection.disconnect(this.server.server.shutdownMessage()); // CraftBukkit - add custom shutdown message // Paper - Adventure ++ player.connection.disconnect(java.util.Objects.requireNonNullElseGet(this.server.server.shutdownMessage(), net.kyori.adventure.text.Component::empty)); // CraftBukkit - add custom shutdown message // Paper - Adventure } // CraftBukkit end diff --git a/patches/unapplied/server/Allow-skipping-writing-of-comments-to-server.propert.patch b/patches/server/Allow-skipping-writing-of-comments-to-server.propert.patch similarity index 100% rename from patches/unapplied/server/Allow-skipping-writing-of-comments-to-server.propert.patch rename to patches/server/Allow-skipping-writing-of-comments-to-server.propert.patch diff --git a/patches/server/Brand-support.patch b/patches/server/Brand-support.patch index 87f4caecd8..be96476778 100644 --- a/patches/server/Brand-support.patch +++ b/patches/server/Brand-support.patch @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private volatile boolean suspendFlushingOnServerThread = false; public final java.util.Map packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit -+ protected static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support ++ protected static final ResourceLocation MINECRAFT_BRAND = ResourceLocation.withDefaultNamespace("brand"); // Paper - Brand support public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit this.server = minecraftserver; diff --git a/patches/unapplied/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch b/patches/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch similarity index 100% rename from patches/unapplied/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch rename to patches/server/Correctly-check-if-bucket-dispenses-will-succeed-for.patch diff --git a/patches/unapplied/server/Don-t-apply-cramming-damage-to-players.patch b/patches/server/Don-t-apply-cramming-damage-to-players.patch similarity index 94% rename from patches/unapplied/server/Don-t-apply-cramming-damage-to-players.patch rename to patches/server/Don-t-apply-cramming-damage-to-players.patch index b019743d40..a6e1334f2c 100644 --- a/patches/unapplied/server/Don-t-apply-cramming-damage-to-players.patch +++ b/patches/server/Don-t-apply-cramming-damage-to-players.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.Entity; -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @Override public boolean isInvulnerableTo(DamageSource damageSource) { diff --git a/patches/unapplied/server/Ensure-disconnect-for-book-edit-is-called-on-main.patch b/patches/server/Ensure-disconnect-for-book-edit-is-called-on-main.patch similarity index 70% rename from patches/unapplied/server/Ensure-disconnect-for-book-edit-is-called-on-main.patch rename to patches/server/Ensure-disconnect-for-book-edit-is-called-on-main.patch index 96098cddb1..163b593d39 100644 --- a/patches/unapplied/server/Ensure-disconnect-for-book-edit-is-called-on-main.patch +++ b/patches/server/Ensure-disconnect-for-book-edit-is-called-on-main.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end - Book size limits // CraftBukkit start if (this.lastBookTick + 20 > MinecraftServer.currentTick) { -- this.disconnect("Book edited too quickly!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause -+ server.scheduleOnMain(() -> this.disconnect("Book edited too quickly!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause // Paper - Also ensure this is called on main +- this.disconnect(Component.literal("Book edited too quickly!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause ++ server.scheduleOnMain(() -> this.disconnect(Component.literal("Book edited too quickly!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause // Paper - Also ensure this is called on main return; } this.lastBookTick = MinecraftServer.currentTick; 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-PlayerDropItemEvent-using-wrong-item.patch b/patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch similarity index 97% rename from patches/unapplied/server/Fix-PlayerDropItemEvent-using-wrong-item.patch rename to patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch index 68a88ff463..db3dc2316a 100644 --- a/patches/unapplied/server/Fix-PlayerDropItemEvent-using-wrong-item.patch +++ b/patches/server/Fix-PlayerDropItemEvent-using-wrong-item.patch @@ -34,7 +34,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { if (retainOwnership) { if (!itemstack1.isEmpty()) { diff --git a/patches/unapplied/server/Fix-commands-from-signs-not-firing-command-events.patch b/patches/server/Fix-commands-from-signs-not-firing-command-events.patch similarity index 100% rename from patches/unapplied/server/Fix-commands-from-signs-not-firing-command-events.patch rename to patches/server/Fix-commands-from-signs-not-firing-command-events.patch 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/Fix-kick-event-leave-message-not-being-sent.patch b/patches/server/Fix-kick-event-leave-message-not-being-sent.patch similarity index 82% rename from patches/unapplied/server/Fix-kick-event-leave-message-not-being-sent.patch rename to patches/server/Fix-kick-event-leave-message-not-being-sent.patch index 976512fe59..5676701e74 100644 --- a/patches/unapplied/server/Fix-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/Fix-kick-event-leave-message-not-being-sent.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { +@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { public boolean joining = true; public boolean sentListPacket = false; public boolean supressTrackerForLogin = false; // Paper - Fire PlayerJoinEvent when Player is actually ready @@ -23,11 +23,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @Override - public void onDisconnect(Component reason) { + public void onDisconnect(DisconnectionDetails info) { + // Paper start - Fix kick event leave message not being sent -+ this.onDisconnect(reason, null); ++ this.onDisconnect(info, null); + } -+ public void onDisconnect(Component reason, @Nullable net.kyori.adventure.text.Component quitMessage) { ++ public void onDisconnect(DisconnectionDetails info, @Nullable net.kyori.adventure.text.Component quitMessage) { + // Paper end - Fix kick event leave message not being sent if (this.isSingleplayerOwner()) { ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out"); @@ -38,14 +38,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent // Send the possibly modified leave message - final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure - // CraftBukkit end + this.disconnect0(new DisconnectionDetails(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()), disconnectionInfo.report(), disconnectionInfo.bugReportLink())); // Paper - Adventure + } @@ -0,0 +0,0 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack - this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> { - this.connection.disconnect(ichatbasecomponent); + this.connection.send(new ClientboundDisconnectPacket(disconnectiondetails.reason()), PacketSendListener.thenRun(() -> { + this.connection.disconnect(disconnectiondetails); })); -- this.onDisconnect(ichatbasecomponent); // CraftBukkit - fire quit instantly -+ this.onDisconnect(ichatbasecomponent, event.leaveMessage()); // CraftBukkit - fire quit instantly // Paper - use kick event leave message +- this.onDisconnect(disconnectiondetails); // CraftBukkit - fire quit instantly ++ this.onDisconnect(disconnectiondetails, event.leaveMessage()); // CraftBukkit - fire quit instantly // Paper - use kick event leave message this.connection.setReadOnly(); MinecraftServer minecraftserver = this.server; Connection networkmanager = this.connection; @@ -56,12 +56,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override - public void onDisconnect(Component reason) { + public void onDisconnect(DisconnectionDetails info) { + // Paper start - Fix kick event leave message not being sent -+ this.onDisconnect(reason, null); ++ this.onDisconnect(info, null); + } + @Override -+ public void onDisconnect(Component reason, @Nullable net.kyori.adventure.text.Component quitMessage) { ++ public void onDisconnect(DisconnectionDetails info, @Nullable net.kyori.adventure.text.Component quitMessage) { + // Paper end - Fix kick event leave message not being sent // CraftBukkit start - Rarely it would send a disconnect line twice if (this.processedDisconnect) { @@ -69,11 +69,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // CraftBukkit end - ServerGamePacketListenerImpl.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), reason.getString()); + ServerGamePacketListenerImpl.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), info.reason().getString()); - this.removePlayerFromWorld(); -- super.onDisconnect(reason); +- super.onDisconnect(info); + this.removePlayerFromWorld(quitMessage); // Paper - Fix kick event leave message not being sent -+ super.onDisconnect(reason, quitMessage); // Paper - Fix kick event leave message not being sent ++ super.onDisconnect(info, quitMessage); // Paper - Fix kick event leave message not being sent } + // Paper start - Fix kick event leave message not being sent diff --git a/patches/unapplied/server/Fix-potions-splash-events.patch b/patches/server/Fix-potions-splash-events.patch similarity index 100% rename from patches/unapplied/server/Fix-potions-splash-events.patch rename to patches/server/Fix-potions-splash-events.patch diff --git a/patches/unapplied/server/Fix-return-value-of-Block-applyBoneMeal-always-being.patch b/patches/server/Fix-return-value-of-Block-applyBoneMeal-always-being.patch similarity index 100% rename from patches/unapplied/server/Fix-return-value-of-Block-applyBoneMeal-always-being.patch rename to patches/server/Fix-return-value-of-Block-applyBoneMeal-always-being.patch diff --git a/patches/unapplied/server/Improve-item-default-attribute-API.patch b/patches/server/Improve-item-default-attribute-API.patch similarity index 90% rename from patches/unapplied/server/Improve-item-default-attribute-API.patch rename to patches/server/Improve-item-default-attribute-API.patch index 57ab200db8..ae1011d824 100644 --- a/patches/unapplied/server/Improve-item-default-attribute-API.patch +++ b/patches/server/Improve-item-default-attribute-API.patch @@ -11,13 +11,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java +++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java @@ -0,0 +0,0 @@ public class CraftAttributeInstance implements AttributeInstance { - return new AttributeModifier(nms.id(), nms.name, nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()]); + return new AttributeModifier(CraftNamespacedKey.fromMinecraft(nms.id()), nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()], org.bukkit.inventory.EquipmentSlotGroup.ANY); } - public static AttributeModifier convert(net.minecraft.world.entity.ai.attributes.AttributeModifier nms, EquipmentSlot slot) { -- return new AttributeModifier(nms.id(), nms.name, nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()], slot); +- return new AttributeModifier(CraftNamespacedKey.fromMinecraft(nms.id()), nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()], slot.getGroup()); + public static AttributeModifier convert(net.minecraft.world.entity.ai.attributes.AttributeModifier nms, net.minecraft.world.entity.EquipmentSlotGroup slot) { // Paper -+ return new AttributeModifier(nms.id(), nms.name, nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()], org.bukkit.craftbukkit.CraftEquipmentSlot.getSlot(slot)); // Paper ++ return new AttributeModifier(CraftNamespacedKey.fromMinecraft(nms.id()), nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()], org.bukkit.craftbukkit.CraftEquipmentSlot.getSlot(slot)); // Paper } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java 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 90% rename from patches/unapplied/server/Limit-item-frame-cursors-on-maps.patch rename to patches/server/Limit-item-frame-cursors-on-maps.patch index cd21324617..c64f3c2367 100644 --- a/patches/unapplied/server/Limit-item-frame-cursors-on-maps.patch +++ b/patches/server/Limit-item-frame-cursors-on-maps.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 MapFrame worldmapframe1 = new MapFrame(blockposition, entityitemframe.getDirection().get2DDataValue() * 90, entityitemframe.getId()); + if (this.decorations.size() < player.level().paperConfig().maps.itemFrameCursorLimit) { // Paper - Limit item frame cursors on maps - this.addDecoration(MapDecorationTypes.FRAME, player.level(), "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null); + this.addDecoration(MapDecorationTypes.FRAME, player.level(), MapItemSavedData.getFrameKey(entityitemframe.getId()), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.getDirection().get2DDataValue() * 90), (Component) null); this.frameMarkers.put(worldmapframe1.getId(), worldmapframe1); + } // Paper - Limit item frame cursors on maps } diff --git a/patches/unapplied/server/Line-Of-Sight-Changes.patch b/patches/server/Line-Of-Sight-Changes.patch similarity index 100% rename from patches/unapplied/server/Line-Of-Sight-Changes.patch rename to patches/server/Line-Of-Sight-Changes.patch diff --git a/patches/unapplied/server/Make-hoppers-respect-inventory-max-stack-size.patch b/patches/server/Make-hoppers-respect-inventory-max-stack-size.patch similarity index 100% rename from patches/unapplied/server/Make-hoppers-respect-inventory-max-stack-size.patch rename to patches/server/Make-hoppers-respect-inventory-max-stack-size.patch diff --git a/patches/unapplied/server/Missing-Entity-API.patch b/patches/server/Missing-Entity-API.patch similarity index 99% rename from patches/unapplied/server/Missing-Entity-API.patch rename to patches/server/Missing-Entity-API.patch index 0bb77ccef0..d26f972cdb 100644 --- a/patches/unapplied/server/Missing-Entity-API.patch +++ b/patches/server/Missing-Entity-API.patch @@ -282,9 +282,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob @Override - public boolean canChangeDimensions() { + public boolean canUsePortal(boolean allowVehicles) { - return false; -+ return super.canChangeDimensions() && canPortal; // Paper ++ return this.canPortal; // Paper } @Override @@ -741,7 +741,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java @@ -0,0 +0,0 @@ public class CraftFireball extends AbstractProjectile implements Fireball { - return new Vector(this.getHandle().xPower, this.getHandle().yPower, this.getHandle().zPower); + return new Vector(delta.x, delta.y, delta.z); } + // Paper start - Expose power on fireball projectiles 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/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/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/patches/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch similarity index 100% rename from patches/unapplied/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch rename to patches/server/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch diff --git a/patches/unapplied/server/Optimize-entity-tracker-passenger-checks.patch b/patches/server/Optimize-entity-tracker-passenger-checks.patch similarity index 61% rename from patches/unapplied/server/Optimize-entity-tracker-passenger-checks.patch rename to patches/server/Optimize-entity-tracker-passenger-checks.patch index be13d9e403..e8d227a7ca 100644 --- a/patches/unapplied/server/Optimize-entity-tracker-passenger-checks.patch +++ b/patches/server/Optimize-entity-tracker-passenger-checks.patch @@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -0,0 +0,0 @@ public class ServerEntity { - this.trackedPlayers = trackedPlayers; - // CraftBukkit end - this.ap = Vec3.ZERO; -- this.lastPassengers = Collections.emptyList(); -+ this.lastPassengers = com.google.common.collect.ImmutableList.of(); // Paper - optimize passenger checks - this.level = worldserver; - this.broadcast = consumer; - this.entity = entity; + private Vec3 lastSentMovement; + private int tickCount; + private int teleportDelay; +- private List lastPassengers = Collections.emptyList(); ++ private List lastPassengers = com.google.common.collect.ImmutableList.of(); // Paper - optimize passenger checks + private boolean wasRiding; + private boolean wasOnGround; + @Nullable diff --git a/patches/unapplied/server/Prevent-AFK-kick-while-watching-end-credits.patch b/patches/server/Prevent-AFK-kick-while-watching-end-credits.patch similarity index 88% rename from patches/unapplied/server/Prevent-AFK-kick-while-watching-end-credits.patch rename to patches/server/Prevent-AFK-kick-while-watching-end-credits.patch index fc86f078ae..d6608eab0c 100644 --- a/patches/unapplied/server/Prevent-AFK-kick-while-watching-end-credits.patch +++ b/patches/server/Prevent-AFK-kick-while-watching-end-credits.patch @@ -15,5 +15,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L) { + if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854 - this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause + this.disconnect((Component) Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause } diff --git a/patches/server/Properly-handle-async-calls-to-restart-the-server.patch b/patches/server/Properly-handle-async-calls-to-restart-the-server.patch index d6da58a68f..7b1d6c3e29 100644 --- a/patches/server/Properly-handle-async-calls-to-restart-the-server.patch +++ b/patches/server/Properly-handle-async-calls-to-restart-the-server.patch @@ -79,8 +79,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end // CraftBukkit start - disconnect safely for (ServerPlayer player : this.players) { -+ if (isRestarting) player.connection.disconnect(org.spigotmc.SpigotConfig.restartMessage); else // Paper - player.connection.disconnect(this.server.server.shutdownMessage()); // CraftBukkit - add custom shutdown message // Paper - Adventure ++ if (isRestarting) player.connection.disconnect(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.restartMessage)); else // Paper + player.connection.disconnect(java.util.Objects.requireNonNullElseGet(this.server.server.shutdownMessage(), net.kyori.adventure.text.Component::empty)); // CraftBukkit - add custom shutdown message // Paper - Adventure } // CraftBukkit end diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java diff --git a/patches/unapplied/server/Rate-options-and-timings-for-sensors-and-behaviors.patch b/patches/server/Rate-options-and-timings-for-sensors-and-behaviors.patch similarity index 100% rename from patches/unapplied/server/Rate-options-and-timings-for-sensors-and-behaviors.patch rename to patches/server/Rate-options-and-timings-for-sensors-and-behaviors.patch diff --git a/patches/unapplied/server/Stinger-API.patch b/patches/server/Stinger-API.patch similarity index 100% rename from patches/unapplied/server/Stinger-API.patch rename to patches/server/Stinger-API.patch diff --git a/patches/unapplied/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch b/patches/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch similarity index 100% rename from patches/unapplied/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch rename to patches/server/Synchronize-PalettedContainer-instead-of-ThreadingDe.patch diff --git a/patches/unapplied/server/Use-getChunkIfLoadedImmediately-in-places.patch b/patches/server/Use-getChunkIfLoadedImmediately-in-places.patch similarity index 100% rename from patches/unapplied/server/Use-getChunkIfLoadedImmediately-in-places.patch rename to patches/server/Use-getChunkIfLoadedImmediately-in-places.patch diff --git a/patches/unapplied/server/add-per-world-spawn-limits.patch b/patches/server/add-per-world-spawn-limits.patch similarity index 100% rename from patches/unapplied/server/add-per-world-spawn-limits.patch rename to patches/server/add-per-world-spawn-limits.patch diff --git a/patches/unapplied/server/Fix-dangerous-end-portal-logic.patch b/patches/unapplied/server/Fix-dangerous-end-portal-logic.patch deleted file mode 100644 index 6f0c4c2a83..0000000000 --- a/patches/unapplied/server/Fix-dangerous-end-portal-logic.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Fri, 4 Jun 2021 17:06:52 -0400 -Subject: [PATCH] Fix dangerous end portal logic - -End portals could teleport entities during move calls. Stupid -logic given the caller will never expect that kind of thing, -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/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - return this.originWorld; - } - // Paper end - Entity origin API -+ // Paper start - make end portalling safe -+ public BlockPos portalBlock; -+ public ServerLevel portalWorld; -+ public void tickEndPortal() { -+ BlockPos pos = this.portalBlock; -+ ServerLevel world = this.portalWorld; -+ this.portalBlock = null; -+ this.portalWorld = null; -+ -+ if (pos == null || world == null || world != this.level) { -+ return; -+ } -+ -+ if (this.isPassenger() || this.isVehicle() || !this.canChangeDimensions() || this.isRemoved() || !this.valid || !this.isAlive()) { -+ return; -+ } -+ -+ ResourceKey resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends -+ ServerLevel worldserver = world.getServer().getLevel(resourcekey); -+ -+ org.bukkit.event.entity.EntityPortalEnterEvent event = new org.bukkit.event.entity.EntityPortalEnterEvent(this.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); -+ event.callEvent(); -+ -+ if (this instanceof ServerPlayer) { -+ ((ServerPlayer) this).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL); -+ return; -+ } -+ this.teleportTo(worldserver, null); -+ } -+ // Paper end - make end portalling safe - public float getBukkitYaw() { - return this.yRot; - } -@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - - this.processPortalCooldown(); -+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation) this.tickEndPortal(); // Paper - make end portalling safe - } - } - -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -@@ -0,0 +0,0 @@ public class EndPortalBlock extends BaseEntityBlock { - // return; // CraftBukkit - always fire event in case plugins wish to change it - } - -- // CraftBukkit start - Entity in portal -- EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); -- world.getCraftServer().getPluginManager().callEvent(event); -- -- if (entity instanceof ServerPlayer) { -- ((ServerPlayer) entity).changeDimension(worldserver, PlayerTeleportEvent.TeleportCause.END_PORTAL); -- return; -+ // Paper start - move all of this logic into portal tick -+ entity.portalWorld = ((ServerLevel)world); -+ entity.portalBlock = pos.immutable(); -+ if (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation) { -+ entity.tickEndPortal(); - } -- // CraftBukkit end -- entity.changeDimension(worldserver); -+ // Paper end - move all of this logic into portal tick - } - - }