Remove bad server.scheduleOnMain disconnect calls from old patches

The new behavior of disconnect to block the current thread until the disconnect succeeded is better than throwing it off to happen at some point
This commit is contained in:
Nassim Jahnke 2024-06-16 12:56:00 +02:00
commit 78a67f00ea
4 changed files with 9 additions and 28 deletions

View file

@ -288,8 +288,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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!");
- server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!")));
+ server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
- this.disconnect(Component.literal("Book too large!"));
+ this.disconnect(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
return;
}
byteTotal += byteLength;
@ -297,8 +297,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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());
- server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!")));
+ server.scheduleOnMain(() -> this.disconnect(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION)); // Paper - kick event cause
- this.disconnect(Component.literal("Book too large!"));
+ this.disconnect(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
return;
}
}
@ -404,8 +404,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Paper start - auto recipe limit
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
- this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam")));
+ this.server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
- this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"));
+ this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause
return;
}
}