Paper/paper-server/nms-patches/net/minecraft/world/entity/raid/PersistentRaid.patch
CraftBukkit/Spigot 65bc2541a3 Update to Minecraft 1.20.5
By: md_5 <git@md-5.net>
2024-04-24 01:15:00 +10:00

28 lines
1.4 KiB
Diff

--- a/net/minecraft/world/entity/raid/PersistentRaid.java
+++ b/net/minecraft/world/entity/raid/PersistentRaid.java
@@ -115,11 +115,23 @@
Raid raid = this.getOrCreateRaid(entityplayer.serverLevel(), blockposition2);
+ /* CraftBukkit - moved down
if (!raid.isStarted() && !this.raidMap.containsKey(raid.getId())) {
this.raidMap.put(raid.getId(), raid);
}
+ */
- if (!raid.isStarted() || raid.getRaidOmenLevel() < raid.getMaxRaidOmenLevel()) {
+ 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(raid, entityplayer)) {
+ entityplayer.removeEffect(net.minecraft.world.effect.MobEffects.RAID_OMEN);
+ return null;
+ }
+
+ if (!raid.isStarted() && !this.raidMap.containsKey(raid.getId())) {
+ this.raidMap.put(raid.getId(), raid);
+ }
+ // CraftBukkit end
raid.absorbRaidOmen(entityplayer);
}