mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
fix bad method call in PreBlockExplodeEvent event
This commit is contained in:
@@ -6,17 +6,19 @@ 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
|
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
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..b7db0db7f3afbccdb07390d1bcada109e9e6b30b
|
index 0000000000000000000000000000000000000000..32602b398ede24a35ed8a996faa2b23455615a7b
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/event/PreBlockExplodeEvent.java
|
+++ b/src/main/java/org/purpurmc/purpur/event/PreBlockExplodeEvent.java
|
||||||
@@ -0,0 +1,52 @@
|
@@ -0,0 +1,54 @@
|
||||||
+package org.purpurmc.purpur.event;
|
+package org.purpurmc.purpur.event;
|
||||||
+
|
+
|
||||||
+import org.bukkit.block.Block;
|
+import org.bukkit.block.Block;
|
||||||
|
+import org.bukkit.block.BlockState;
|
||||||
+import org.bukkit.event.Cancellable;
|
+import org.bukkit.event.Cancellable;
|
||||||
+import org.bukkit.event.HandlerList;
|
+import org.bukkit.event.HandlerList;
|
||||||
+import org.bukkit.event.block.BlockExplodeEvent;
|
+import org.bukkit.event.block.BlockExplodeEvent;
|
||||||
+import org.jetbrains.annotations.NotNull;
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+import org.jetbrains.annotations.Nullable;
|
||||||
+import java.util.Collections;
|
+import java.util.Collections;
|
||||||
+
|
+
|
||||||
+/**
|
+/**
|
||||||
@@ -27,8 +29,8 @@ index 0000000000000000000000000000000000000000..b7db0db7f3afbccdb07390d1bcada109
|
|||||||
+ private boolean cancelled;
|
+ private boolean cancelled;
|
||||||
+ private final float yield;
|
+ private final float yield;
|
||||||
+
|
+
|
||||||
+ public PreBlockExplodeEvent(@NotNull final Block what, final float yield) {
|
+ public PreBlockExplodeEvent(@NotNull final Block what, final float yield, @Nullable BlockState explodedBlockState) {
|
||||||
+ super(what, Collections.emptyList(), yield);
|
+ super(what, Collections.emptyList(), yield, explodedBlockState);
|
||||||
+ this.yield = yield;
|
+ this.yield = yield;
|
||||||
+ this.cancelled = false;
|
+ this.cancelled = false;
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ 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
|
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||||
index dcc3b333f3647631e2fb695d0854036d3bc009be..6772c4584f1d243df76b42a730376247c8f04e3b 100644
|
index dcc3b333f3647631e2fb695d0854036d3bc009be..4932374ab9a3d8582fb0ef024d817ad896dd23c4 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||||
@@ -141,6 +141,23 @@ public class Explosion {
|
@@ -141,6 +141,23 @@ public class Explosion {
|
||||||
@@ -22,7 +22,7 @@ index dcc3b333f3647631e2fb695d0854036d3bc009be..6772c4584f1d243df76b42a730376247
|
|||||||
+ }
|
+ }
|
||||||
+ }else {
|
+ }else {
|
||||||
+ Location location = new Location(this.level.getWorld(), this.x, this.y, this.z);
|
+ 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).callEvent()) {
|
+ 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()) {
|
||||||
+ this.wasCanceled = true;
|
+ this.wasCanceled = true;
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
Reference in New Issue
Block a user