mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2025-01-08 14:47:38 +00:00
47 lines
3.8 KiB
Diff
47 lines
3.8 KiB
Diff
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
|
|
index d3fd35a33da5ce40667781f7ee35e89531b4ea96..f92385c4f72fce6ceec40e21ea081eeb1bd8fc25 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -866,7 +866,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
this.player.sendMessage(new TranslatableComponent("advMode.notEnabled"), Util.NIL_UUID);
|
|
} else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission
|
|
this.player.sendMessage(new TranslatableComponent("advMode.notAllowed"), Util.NIL_UUID);
|
|
- } else {
|
|
+ } else if (this.player.level.isLoadedAndInBounds(packet.getPos())) { // Scissors
|
|
BaseCommandBlock commandblocklistenerabstract = null;
|
|
CommandBlockEntity tileentitycommand = null;
|
|
BlockPos blockposition = packet.getPos();
|
|
@@ -1027,7 +1027,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
@Override
|
|
public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) {
|
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
|
- if (!ScissorsConfig.disableGameMasterBlocks && this.player.canUseGameMasterBlocks()) { // Scissors - Add configuration option to completely disable game master blocks
|
|
+ if (!ScissorsConfig.disableGameMasterBlocks && 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);
|
|
@@ -1085,7 +1085,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
@Override
|
|
public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) {
|
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
|
- if (!ScissorsConfig.disableGameMasterBlocks && this.player.canUseGameMasterBlocks()) { // Scissors - Add configuration option to completely disable game master blocks
|
|
+ if (!ScissorsConfig.disableGameMasterBlocks && 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);
|
|
@@ -1108,7 +1108,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
|
@Override
|
|
public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) {
|
|
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());
|
|
- if (!ScissorsConfig.disableGameMasterBlocks && this.player.canUseGameMasterBlocks()) { // Scissors - Add configuration option to completely disable game master blocks
|
|
+ if (!ScissorsConfig.disableGameMasterBlocks && this.player.canUseGameMasterBlocks() && this.player.level.isLoadedAndInBounds(packet.getPos())) { // Scissors
|
|
BlockPos blockposition = packet.getPos();
|
|
BlockEntity tileentity = this.player.level.getBlockEntity(blockposition);
|
|
|