Paper/Spigot-Server-Patches/0441-fix-blockstate-capture-undoing.patch
egg82 555ca59af7
Add root/admin user detection (#2432)
This patch detects whether or not the server is currently executing as a privileged user and spits out a warning. The warning serves as a sort-of PSA for newer server admins who don't understand the risks of running as root.

We've seen plenty of bad/malicious plugins hit markets, and there's been a few close-calls with exploits in the past. Hopefully this helps mitigate some potential damage to servers, even if it is just a warning.
2020-02-18 22:10:41 -06:00

33 lines
1.7 KiB
Diff

From 6f341bdfd51609e529a4f9865f7775a57b1b4cc5 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com>
Date: Mon, 17 Feb 2020 22:53:33 +0100
Subject: [PATCH] fix blockstate capture undoing
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 3c966b4ab..baad98517 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -349,7 +349,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
Block block = iblockdata.getBlock();
// CraftBukkit start - capture blockstates
+ boolean capturedBlockState = false; //Paper - fix blockstate capture undoing
if (this.captureBlockStates && !this.capturedBlockStates.containsKey(blockposition)) {
+ capturedBlockState = true; //Paper - fix blockstate capture undoing
CraftBlockState blockstate = (CraftBlockState) world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState(); // Paper - use CB getState to get a suitable snapshot
this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate);
}
@@ -360,7 +362,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
if (iblockdata1 == null) {
// CraftBukkit start - remove blockstate if failed
- if (this.captureBlockStates) {
+ if (/*this.captureBlockStates*/ capturedBlockState) { //Paper - fix blockstate capture undoing
this.capturedBlockStates.remove(blockposition);
}
// CraftBukkit end
--
2.25.0