aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/raid/Raids.java.patch
blob: 8c6e6b1a8e35b5d39493dadec13dc6d48626b6f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--- a/net/minecraft/world/entity/raid/Raids.java
+++ b/net/minecraft/world/entity/raid/Raids.java
@@ -118,19 +121,32 @@
                 Raid raid = this.getOrCreateRaid(serverPlayer.serverLevel(), blockPos1);
                 boolean flag = false;
                 if (!raid.isStarted()) {
+                    /* CraftBukkit - moved down
                     if (!this.raidMap.containsKey(raid.getId())) {
                         this.raidMap.put(raid.getId(), raid);
                     }
 
                     flag = true;
-                } else if (raid.getBadOmenLevel() < raid.getMaxBadOmenLevel()) {
+                    // CraftBukkit start - fixed a bug with raid: players could add up Bad Omen level even when the raid had finished
+                } else if (raid.isInProgress() && raid.getBadOmenLevel() < raid.getMaxBadOmenLevel()) {
                     flag = true;
+                    // CraftBukkit end
                 } else {
                     serverPlayer.removeEffect(MobEffects.BAD_OMEN);
                     serverPlayer.connection.send(new ClientboundEntityEventPacket(serverPlayer, (byte)43));
                 }
 
                 if (flag) {
+                    // CraftBukkit start
+                    if (!org.bukkit.craftbukkit.event.CraftEventFactory.callRaidTriggerEvent(raid, serverPlayer)) {
+                        serverPlayer.removeEffect(MobEffects.BAD_OMEN);
+                        return null;
+                    }
+
+                    if (!this.raidMap.containsKey(raid.getId())) {
+                        this.raidMap.put(raid.getId(), raid);
+                    }
+                    // CraftBukkit end
                     raid.absorbBadOmen(serverPlayer);
                     serverPlayer.connection.send(new ClientboundEntityEventPacket(serverPlayer, (byte)43));
                     if (!raid.hasFirstWaveSpawned()) {