PaperMC/paper-server/nms-patches/net/minecraft/world/entity/raid/PersistentRaid.patch
CraftBukkit/Spigot 25f3b50f6b Update to Minecraft 1.19
By: md_5 <git@md-5.net>
2022-06-08 02:00:00 +10:00

37 lines
1.8 KiB
Diff

--- a/net/minecraft/world/entity/raid/PersistentRaid.java
+++ b/net/minecraft/world/entity/raid/PersistentRaid.java
@@ -112,19 +112,33 @@
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 {
entityplayer.removeEffect(MobEffects.BAD_OMEN);
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, (byte) 43));
}
if (flag) {
+ // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callRaidTriggerEvent(raid, entityplayer)) {
+ entityplayer.removeEffect(MobEffects.BAD_OMEN);
+ return null;
+ }
+
+ if (!this.raidMap.containsKey(raid.getId())) {
+ this.raidMap.put(raid.getId(), raid);
+ }
+ // CraftBukkit end
raid.absorbBadOmen(entityplayer);
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, (byte) 43));
if (!raid.hasFirstWaveSpawned()) {