mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 12:02:36 +01:00
b99d3df2d8
By: Doc <nachito94@msn.com>
32 lines
1.6 KiB
Diff
32 lines
1.6 KiB
Diff
--- a/net/minecraft/world/level/gameevent/GameEventDispatcher.java
|
|
+++ b/net/minecraft/world/level/gameevent/GameEventDispatcher.java
|
|
@@ -11,6 +11,14 @@
|
|
import net.minecraft.world.level.chunk.Chunk;
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
+// CraftBukkit start
|
|
+import net.minecraft.core.registries.BuiltInRegistries;
|
|
+import org.bukkit.Bukkit;
|
|
+import org.bukkit.craftbukkit.util.CraftLocation;
|
|
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
|
+import org.bukkit.event.world.GenericGameEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class GameEventDispatcher {
|
|
|
|
private final WorldServer level;
|
|
@@ -22,6 +30,14 @@
|
|
public void post(GameEvent gameevent, Vec3D vec3d, GameEvent.a gameevent_a) {
|
|
int i = gameevent.getNotificationRadius();
|
|
BlockPosition blockposition = BlockPosition.containing(vec3d);
|
|
+ // CraftBukkit start
|
|
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(BuiltInRegistries.GAME_EVENT.getKey(gameevent))), 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);
|