--- a/net/minecraft/world/entity/raid/Raids.java
+++ b/net/minecraft/world/entity/raid/Raids.java
@@ -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);
                     }
 
