2023-07-05 15:08:19 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Luna <lunahatesgogle@gmail.com>
|
|
|
|
Date: Tue, 4 Jul 2023 18:49:34 -0300
|
|
|
|
Subject: [PATCH] Fix packet-related lag exploits
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
2023-08-21 19:00:03 +00:00
|
|
|
index d16d9c0a271b85f8c1758e22359129ad0f5f3366..a56b70845e5f21927d5786e1e300f581a6ae153d 100644
|
2023-07-05 15:08:19 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
2023-08-06 21:48:24 +00:00
|
|
|
@@ -967,7 +967,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
2023-07-05 15:08:19 +00:00
|
|
|
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
|
|
|
|
} else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission
|
|
|
|
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
|
|
|
|
- } else {
|
|
|
|
+ } else if (this.player.level().isLoadedAndInBounds(packet.getPos())) { // Scissors
|
|
|
|
BaseCommandBlock commandblocklistenerabstract = null;
|
|
|
|
CommandBlockEntity tileentitycommand = null;
|
|
|
|
BlockPos blockposition = packet.getPos();
|
2023-08-06 21:48:24 +00:00
|
|
|
@@ -1127,7 +1127,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
2023-07-05 15:08:19 +00:00
|
|
|
@Override
|
|
|
|
public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) {
|
|
|
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
|
|
|
- if (this.player.canUseGameMasterBlocks()) {
|
|
|
|
+ if (this.player.canUseGameMasterBlocks() && this.player.level().isLoadedAndInBounds(packet.getPos())) { // Scissors
|
|
|
|
BlockPos blockposition = packet.getPos();
|
|
|
|
BlockState iblockdata = this.player.level().getBlockState(blockposition);
|
|
|
|
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
2023-08-06 21:48:24 +00:00
|
|
|
@@ -1185,7 +1185,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
2023-07-05 15:08:19 +00:00
|
|
|
@Override
|
|
|
|
public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) {
|
|
|
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
|
|
|
- if (this.player.canUseGameMasterBlocks()) {
|
|
|
|
+ if (this.player.canUseGameMasterBlocks() && this.player.level().isLoadedAndInBounds(packet.getPos())) { // Scissors
|
|
|
|
BlockPos blockposition = packet.getPos();
|
|
|
|
BlockState iblockdata = this.player.level().getBlockState(blockposition);
|
|
|
|
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
2023-08-06 21:48:24 +00:00
|
|
|
@@ -1208,7 +1208,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
2023-07-05 15:08:19 +00:00
|
|
|
@Override
|
|
|
|
public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) {
|
|
|
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
|
|
|
|
- if (this.player.canUseGameMasterBlocks()) {
|
|
|
|
+ if (this.player.canUseGameMasterBlocks() && this.player.level().isLoadedAndInBounds(packet.getPos())) { // Scissors
|
|
|
|
BlockPos blockposition = packet.getPos();
|
|
|
|
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
|
|
|
|
|