From e5d357308bd6406da89a36e821a4b0b0f3d95b4f Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Mon, 24 Jun 2024 13:13:40 +0800 Subject: [PATCH] Do not place player if the server is full --- ...t-place-player-if-the-server-is-full.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 patches/server/0078-Do-not-place-player-if-the-server-is-full.patch diff --git a/patches/server/0078-Do-not-place-player-if-the-server-is-full.patch b/patches/server/0078-Do-not-place-player-if-the-server-is-full.patch new file mode 100644 index 000000000..ae9a36ae0 --- /dev/null +++ b/patches/server/0078-Do-not-place-player-if-the-server-is-full.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> +Date: Mon, 24 Jun 2024 10:49:04 +0800 +Subject: [PATCH] Do not place player if the server is full + +Fix https://github.com/PaperMC/Paper/issues/10668 + +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 180b50c9c23c6934d3e99500a25635df32f7169c..0a0146c0898ace3048c965200b4a08c9db4b7b69 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -78,6 +78,7 @@ import net.minecraft.server.level.ClientInformation; + import net.minecraft.server.level.ServerLevel; + import net.minecraft.server.level.ServerPlayer; + import net.minecraft.server.network.CommonListenerCookie; ++import net.minecraft.server.network.ServerCommonPacketListenerImpl; + import net.minecraft.server.network.ServerGamePacketListenerImpl; + import net.minecraft.server.network.ServerLoginPacketListenerImpl; + import net.minecraft.sounds.SoundEvents; +@@ -281,6 +282,13 @@ public abstract class PlayerList { + return; + } + // Gale end - MultiPaper - do not place player in world if kicked before being spawned in ++ // Leaf start - Do not place player if the server is full - copied from canPlayerLogin ++ if (this.players.size() >= this.maxPlayers && !(player.getBukkitEntity().hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameprofile))) { // Purpur ++ connection.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage))); ++ //playerconnection.disconnect(io.papermc.paper.adventure.PaperAdventure.asVanilla(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); ++ return; ++ } ++ // Leaf end - Do not place player if the server is full - copied from canPlayerLogin + + Location loc = ev.getSpawnLocation(); + worldserver1 = ((CraftWorld) loc.getWorld()).getHandle();