From 69403e54d0861477dd60bbd9faf21b34b31cf876 Mon Sep 17 00:00:00 2001 From: granny Date: Mon, 29 Apr 2024 19:21:50 -0700 Subject: [PATCH] make it compile --- patches/api/0043-Add-PreExplodeEvents.patch | 9 ++++----- patches/server/0276-Add-PreExplodeEvents.patch | 8 +++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/patches/api/0043-Add-PreExplodeEvents.patch b/patches/api/0043-Add-PreExplodeEvents.patch index 5ba7e435d..db26aac79 100644 --- a/patches/api/0043-Add-PreExplodeEvents.patch +++ b/patches/api/0043-Add-PreExplodeEvents.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add PreExplodeEvents diff --git a/src/main/java/org/purpurmc/purpur/event/PreBlockExplodeEvent.java b/src/main/java/org/purpurmc/purpur/event/PreBlockExplodeEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..32602b398ede24a35ed8a996faa2b23455615a7b +index 0000000000000000000000000000000000000000..8ea97ddceedb7c719e8a50a0dd8f3f0919ca1647 --- /dev/null +++ b/src/main/java/org/purpurmc/purpur/event/PreBlockExplodeEvent.java -@@ -0,0 +1,54 @@ +@@ -0,0 +1,53 @@ +package org.purpurmc.purpur.event; + +import org.bukkit.block.Block; @@ -18,7 +18,6 @@ index 0000000000000000000000000000000000000000..32602b398ede24a35ed8a996faa2b234 +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockExplodeEvent; +import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; +import java.util.Collections; + +/** @@ -29,8 +28,8 @@ index 0000000000000000000000000000000000000000..32602b398ede24a35ed8a996faa2b234 + private boolean cancelled; + private final float yield; + -+ public PreBlockExplodeEvent(@NotNull final Block what, final float yield, @Nullable BlockState explodedBlockState) { -+ super(what, Collections.emptyList(), yield, explodedBlockState); ++ public PreBlockExplodeEvent(@NotNull final Block what, final float yield, @NotNull BlockState explodedBlockState) { ++ super(what, explodedBlockState, Collections.emptyList(), yield); + this.yield = yield; + this.cancelled = false; + } diff --git a/patches/server/0276-Add-PreExplodeEvents.patch b/patches/server/0276-Add-PreExplodeEvents.patch index 4fc6f26f6..1b502ebb6 100644 --- a/patches/server/0276-Add-PreExplodeEvents.patch +++ b/patches/server/0276-Add-PreExplodeEvents.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PreExplodeEvents diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index ed31528ddfec06e723827a505daeca5938dba865..58aa5059c484c9e8acf429a3ae4f07d83594f991 100644 +index 69d8ff6a97335b6fe4b20a8229a77f2591b0f050..f5e84bf8817e2d53557e0909d8c9e0e0e8206a16 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java -@@ -430,6 +430,23 @@ public class Explosion { +@@ -430,6 +430,25 @@ public class Explosion { return; } // CraftBukkit end @@ -22,7 +22,9 @@ index ed31528ddfec06e723827a505daeca5938dba865..58aa5059c484c9e8acf429a3ae4f07d8 + } + }else { + Location location = new Location(this.level.getWorld(), this.x, this.y, this.z); -+ if(!new org.purpurmc.purpur.event.PreBlockExplodeEvent(location.getBlock(), this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, this.damageSource.explodedBlockState).callEvent()) { ++ org.bukkit.block.Block block = location.getBlock(); ++ org.bukkit.block.BlockState blockState = (this.damageSource.blockState != null) ? this.damageSource.blockState : block.getState(); ++ if(!new org.purpurmc.purpur.event.PreBlockExplodeEvent(location.getBlock(), this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F, blockState).callEvent()) { + this.wasCanceled = true; + return; + }