--- a/net/minecraft/world/entity/raid/Raids.java
+++ b/net/minecraft/world/entity/raid/Raids.java
@@ -42,7 +_,7 @@
     );
     public static final SavedDataType<Raids> TYPE = new SavedDataType<>("raids", Raids::new, CODEC, DataFixTypes.SAVED_DATA_RAIDS);
     public static final SavedDataType<Raids> TYPE_END = new SavedDataType<>("raids_end", Raids::new, CODEC, DataFixTypes.SAVED_DATA_RAIDS);
-    private final Int2ObjectMap<Raid> raidMap = new Int2ObjectOpenHashMap<>();
+    public final Int2ObjectMap<Raid> raidMap = new Int2ObjectOpenHashMap<>();
     private int nextId = 1;
     private int tick;
 
@@ -57,6 +_,7 @@
     private Raids(List<Raids.RaidWithId> raids, int nextId, int tick) {
         for (Raids.RaidWithId raidWithId : raids) {
             this.raidMap.put(raidWithId.id, raidWithId.raid);
+            raidWithId.raid.idOrNegativeOne = raidWithId.id; // Paper - expose id of raids while method is kept around as deprecated for removal
         }
 
         this.nextId = nextId;
@@ -141,11 +_,23 @@
                     }
 
                     Raid raid = this.getOrCreateRaid(serverLevel, blockPos);
-                    if (!raid.isStarted() && !this.raidMap.containsValue(raid)) {
-                        this.raidMap.put(this.getUniqueId(), raid);
-                    }
-
-                    if (!raid.isStarted() || raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel()) {
+                    // CraftBukkit - moved down
+                    // if (!raid.isStarted() && !this.raidMap.containsValue(raid)) {
+                    //     this.raidMap.put(this.getUniqueId(), raid);
+                    // }
+
+                    if (!raid.isStarted() || (raid.isInProgress() && raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel())) { // CraftBukkit - fixed a bug with raid: players could add up Bad Omen level even when the raid had finished
+                        // CraftBukkit start
+                        if (!org.bukkit.craftbukkit.event.CraftEventFactory.callRaidTriggerEvent(serverLevel, raid, player)) {
+                            player.removeEffect(net.minecraft.world.effect.MobEffects.RAID_OMEN);
+                            return null;
+                        }
+
+                        if (!raid.isStarted() && !this.raidMap.containsValue(raid)) {
+                            this.raidMap.put(this.getUniqueId(), raid);
+                            raid.idOrNegativeOne = this.nextId; // Paper - expose id of raids while method is kept around as deprecated for removal
+                        }
+                        // CraftBukkit end
                         raid.absorbRaidOmen(player);
                     }
 
