0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2025-04-22 08:45:49 +00:00
Files
2025-03-26 03:05:00 +11:00

32 lines
1.5 KiB
Diff

--- a/net/minecraft/world/level/gameevent/GameEventDispatcher.java
+++ b/net/minecraft/world/level/gameevent/GameEventDispatcher.java
@@ -11,6 +11,13 @@
import net.minecraft.world.level.chunk.IChunkAccess;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftGameEvent;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.event.world.GenericGameEvent;
+// CraftBukkit end
+
public class GameEventDispatcher {
private final WorldServer level;
@@ -22,6 +29,14 @@
public void post(Holder<GameEvent> holder, Vec3D vec3d, GameEvent.a gameevent_a) {
int i = ((GameEvent) holder.value()).notificationRadius();
BlockPosition blockposition = BlockPosition.containing(vec3d);
+ // CraftBukkit start
+ GenericGameEvent event = new GenericGameEvent(CraftGameEvent.minecraftToBukkit(holder.value()), CraftLocation.toBukkit(blockposition, level.getWorld()), (gameevent_a.sourceEntity() == null) ? null : gameevent_a.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
+ level.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ i = event.getRadius();
+ // CraftBukkit end
int j = SectionPosition.blockToSectionCoord(blockposition.getX() - i);
int k = SectionPosition.blockToSectionCoord(blockposition.getY() - i);
int l = SectionPosition.blockToSectionCoord(blockposition.getZ() - i);