2023-09-26 22:20:12 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: WillQi <williamqipizza@gmail.com>
|
|
|
|
Date: Mon, 15 May 2023 23:45:09 -0600
|
|
|
|
Subject: [PATCH] Fix off region raid heroes
|
|
|
|
|
|
|
|
This patch aims to solve a potential incorrect thread call when completing a raid.
|
|
|
|
If a player is a hero of the village but proceeds to leave the region of the
|
|
|
|
raid before it's completion, it would throw an exception due to not being on the
|
|
|
|
same region thread anymore.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
2024-07-31 05:09:52 +02:00
|
|
|
index e1987d1d6e5fd05e155c05dd1fdaf569e303d74a..909d1966b2f22c65ef4b887521b3b0e772f2a7ee 100644
|
2023-09-26 22:20:12 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
|
2024-07-31 05:09:52 +02:00
|
|
|
@@ -429,14 +429,22 @@ public class Raid {
|
2023-09-26 22:20:12 +02:00
|
|
|
LivingEntity entityliving = (LivingEntity) entity;
|
|
|
|
|
|
|
|
if (!entity.isSpectator()) {
|
2024-05-10 06:07:34 +02:00
|
|
|
- entityliving.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.raidOmenLevel - 1, false, false, true));
|
|
|
|
+ //entityliving.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.raidOmenLevel - 1, false, false, true)); // Folia - Fix off region raid heroes - move down
|
2023-09-26 22:20:12 +02:00
|
|
|
if (entityliving instanceof ServerPlayer) {
|
|
|
|
ServerPlayer entityplayer = (ServerPlayer) entityliving;
|
|
|
|
|
|
|
|
- entityplayer.awardStat(Stats.RAID_WIN);
|
|
|
|
- CriteriaTriggers.RAID_WIN.trigger(entityplayer);
|
|
|
|
+ // Folia start - Fix off region raid heroes - moved down
|
|
|
|
winners.add(entityplayer.getBukkitEntity()); // CraftBukkit
|
|
|
|
}
|
|
|
|
+ // Folia start - Fix off region raid heroes
|
|
|
|
+ entityliving.getBukkitEntity().taskScheduler.schedule((LivingEntity lv) -> {
|
2024-05-10 06:07:34 +02:00
|
|
|
+ lv.addEffect(new MobEffectInstance(MobEffects.HERO_OF_THE_VILLAGE, 48000, this.raidOmenLevel - 1, false, false, true));
|
2023-09-26 22:20:12 +02:00
|
|
|
+ if (lv instanceof ServerPlayer entityplayer) {
|
|
|
|
+ entityplayer.awardStat(Stats.RAID_WIN);
|
|
|
|
+ CriteriaTriggers.RAID_WIN.trigger(entityplayer);
|
|
|
|
+ }
|
|
|
|
+ }, null, 1L);
|
|
|
|
+ // Folia end - Fix off region raid heroes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|