Paper/nms-patches/PersistentRaid.patch

38 lines
1.8 KiB
Diff
Raw Normal View History

2019-08-12 13:43:10 +02:00
--- a/net/minecraft/server/PersistentRaid.java
+++ b/net/minecraft/server/PersistentRaid.java
@@ -92,19 +92,33 @@
boolean flag = false;
2019-12-10 23:00:00 +01:00
if (!raid.isStarted()) {
2019-08-12 13:43:10 +02:00
+ /* CraftBukkit - moved down
2019-12-10 23:00:00 +01:00
if (!this.raids.containsKey(raid.getId())) {
this.raids.put(raid.getId(), raid);
2019-08-12 13:43:10 +02:00
}
+ */
flag = true;
2019-12-10 23:00:00 +01:00
- } else if (raid.getBadOmenLevel() < raid.getMaxBadOmenLevel()) {
2019-08-12 13:43:10 +02:00
+ // CraftBukkit start - fixed a bug with raid: players could add up Bad Omen level even when the raid had finished
2019-12-10 23:00:00 +01:00
+ } else if (raid.isInProgress() && raid.getBadOmenLevel() < raid.getMaxBadOmenLevel()) {
2019-08-12 13:43:10 +02:00
flag = true;
+ // CraftBukkit end
} else {
entityplayer.removeEffect(MobEffects.BAD_OMEN);
entityplayer.playerConnection.sendPacket(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;
+ }
+
2019-12-10 23:00:00 +01:00
+ if (!this.raids.containsKey(raid.getId())) {
+ this.raids.put(raid.getId(), raid);
2019-08-12 13:43:10 +02:00
+ }
+ // CraftBukkit end
raid.a((EntityHuman) entityplayer);
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) 43));
if (!raid.c()) {