Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 11:00:06 +01:00
b8edb0e130
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 6b34da8f SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender CraftBukkit Changes: db4ba2897 SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender 4f7ff4dec PR-1246: Add missing AbstractTestingBase to tests which need them f70a7b68d SPIGOT-7465, MC-264979: Fresh installations print NoSuchFileException for server.properties 8ef7afef6 PR-1240: Call BlockGrowEvent for vines that are growing on additional sides of an existing vine block Spigot Changes: d2eba2c8 Rebuild patches
39 Zeilen
2.5 KiB
Diff
39 Zeilen
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Nassim Jahnke <nassim@njahnke.dev>
|
|
Date: Fri, 7 Jan 2022 11:45:15 +0100
|
|
Subject: [PATCH] Reset placed block on exception
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
index e68b7a1b03783e4f9de24c5ae8773fc359bd2d37..e581dc10f3c805f7f8b6e4c842092609e7e1a0f8 100644
|
|
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
|
@@ -80,6 +80,7 @@ public class BlockItem extends Item {
|
|
if (this instanceof PlaceOnWaterBlockItem || this instanceof SolidBucketItem) {
|
|
blockstate = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos());
|
|
}
|
|
+ final org.bukkit.block.BlockState oldBlockstate = blockstate != null ? blockstate : org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos()); // Paper
|
|
// CraftBukkit end
|
|
|
|
if (iblockdata == null) {
|
|
@@ -95,7 +96,19 @@ public class BlockItem extends Item {
|
|
|
|
if (iblockdata1.is(iblockdata.getBlock())) {
|
|
iblockdata1 = this.updateBlockStateFromTag(blockposition, world, itemstack, iblockdata1);
|
|
+ // Paper start - reset block on exception
|
|
+ try {
|
|
this.updateCustomBlockEntityTag(blockposition, world, entityhuman, itemstack, iblockdata1);
|
|
+ } catch (Exception e) {
|
|
+ oldBlockstate.update(true, false);
|
|
+ if (entityhuman instanceof ServerPlayer player) {
|
|
+ org.apache.logging.log4j.LogManager.getLogger().error("Player {} tried placing invalid block", player.getScoreboardName(), e);
|
|
+ player.getBukkitEntity().kickPlayer("Packet processing error");
|
|
+ return InteractionResult.FAIL;
|
|
+ }
|
|
+ throw e; // Rethrow exception if not placed by a player
|
|
+ }
|
|
+ // Paper end
|
|
iblockdata1.getBlock().setPlacedBy(world, blockposition, iblockdata1, entityhuman, itemstack);
|
|
// CraftBukkit start
|
|
if (blockstate != null) {
|