mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-26 22:55:39 +00:00
Fix packet-related lag exploits (1.20.1) (#117)
* Fix packet-related lag exploits * Fix oopsie
This commit is contained in:
parent
2109ba025d
commit
5b98ad272f
46
patches/server/0050-Fix-packet-related-lag-exploits.patch
Normal file
46
patches/server/0050-Fix-packet-related-lag-exploits.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
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 fbc247d364d3cdee94b04b1108c99d2909b1773a..17faa1416b1e4145a81a0fff5726c6672abf008b 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
|
@@ -965,7 +965,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
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();
|
||||||
|
@@ -1125,7 +1125,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
@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);
|
||||||
|
@@ -1183,7 +1183,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
@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);
|
||||||
|
@@ -1206,7 +1206,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||||
|
@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);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user