Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
40 Zeilen
2.6 KiB
Diff
40 Zeilen
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: aerulion <aerulion@gmail.com>
|
|
Date: Mon, 21 Aug 2023 04:36:07 +0200
|
|
Subject: [PATCH] Add BlockFace to BlockDamageEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
index 4747b05619f37009a5a236678aceec6cfc1c0b79..d0ca98c3f9ea5c8cb1053da6b17e9a90c86b3ae7 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
@@ -253,7 +253,7 @@ public class ServerPlayerGameMode {
|
|
}
|
|
return;
|
|
}
|
|
- org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, pos, this.player.getInventory().getSelected(), f >= 1.0f);
|
|
+ org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, pos, direction, this.player.getInventory().getSelected(), f >= 1.0f); // Paper - Add BlockFace to BlockDamageEvent
|
|
|
|
if (blockEvent.isCancelled()) {
|
|
// Let the client know the block still exists
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
index ebb39bd51dceab1d55eea81d33273af21acfc69b..49aa24d64d69fdccfdbca930b149a4b9c80e2b78 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
@@ -650,13 +650,13 @@ public class CraftEventFactory {
|
|
/**
|
|
* BlockDamageEvent
|
|
*/
|
|
- public static BlockDamageEvent callBlockDamageEvent(ServerPlayer who, BlockPos pos, ItemStack itemstack, boolean instaBreak) {
|
|
+ public static BlockDamageEvent callBlockDamageEvent(ServerPlayer who, BlockPos pos, Direction direction, ItemStack itemstack, boolean instaBreak) { // Paper - Add BlockFace to BlockDamageEvent
|
|
Player player = who.getBukkitEntity();
|
|
CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack);
|
|
|
|
Block blockClicked = CraftBlock.at(who.level(), pos);
|
|
|
|
- BlockDamageEvent event = new BlockDamageEvent(player, blockClicked, itemInHand, instaBreak);
|
|
+ BlockDamageEvent event = new BlockDamageEvent(player, blockClicked, CraftBlock.notchToBlockFace(direction), itemInHand, instaBreak); // Paper - Add BlockFace to BlockDamageEvent
|
|
player.getServer().getPluginManager().callEvent(event);
|
|
|
|
return event;
|