9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-27 10:59:17 +00:00

Fix a bug

This commit is contained in:
violetc
2022-12-22 11:59:57 +08:00
parent 41a408e73d
commit 98cca6ac08

View File

@@ -94,7 +94,7 @@ index 58b093bb1de78ee3b3b2ea364aa50474883f443a..a59cf7c1a34ee54b3a64047498ce4e09
this.debugLogging(pos, true, sequence, reason);
} else {
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index 3ab714721b51b039291b8e8a4b4da5118e18f5b7..1aedc8e019fb9d5307a5a2c6c2cc8e8646d51428 100644
index 3ab714721b51b039291b8e8a4b4da5118e18f5b7..1ee9c431282851882cdc337ea01ee59067163903 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
@@ -32,9 +32,12 @@ import net.minecraft.world.level.block.state.StateDefinition;
@@ -110,7 +110,7 @@ index 3ab714721b51b039291b8e8a4b4da5118e18f5b7..1aedc8e019fb9d5307a5a2c6c2cc8e86
// CraftBukkit end
public class BlockItem extends Item {
@@ -83,6 +86,18 @@ public class BlockItem extends Item {
@@ -83,6 +86,20 @@ public class BlockItem extends Item {
final org.bukkit.block.BlockState oldBlockstate = blockstate != null ? blockstate : org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos()); // Paper
// CraftBukkit end
@@ -120,7 +120,9 @@ index 3ab714721b51b039291b8e8a4b4da5118e18f5b7..1aedc8e019fb9d5307a5a2c6c2cc8e86
+ if (player != null && iblockdata != null) {
+ player.addPlaceBlockCountPerTick();
+ if (!player.allowOperation()) {
+ MinecraftServer.getServer().server.getPluginManager().callEvent(new PlayerOperationLimitEvent(player.getBukkitEntity(), PlayerOperationLimitEvent.Operation.PLACE, blockstate.getBlock()));
+ if (blockstate != null) {
+ MinecraftServer.getServer().server.getPluginManager().callEvent(new PlayerOperationLimitEvent(player.getBukkitEntity(), PlayerOperationLimitEvent.Operation.PLACE, blockstate.getBlock()));
+ }
+ return InteractionResult.FAIL;
+ }
+ }