SPIGOT-6616: Cancellable StriderTemperatureChangeEvent

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2021-07-03 09:36:51 +10:00
parent fec9294c47
commit bc5ed0e911
2 changed files with 6 additions and 4 deletions

View file

@ -1,14 +1,15 @@
--- a/net/minecraft/world/entity/monster/EntityStrider.java
+++ b/net/minecraft/world/entity/monster/EntityStrider.java
@@ -321,7 +321,12 @@
@@ -321,7 +321,13 @@
IBlockData iblockdata1 = this.aU();
boolean flag = iblockdata.a((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.a((Tag) TagsBlock.STRIDER_WARM_BLOCKS) || this.b((Tag) TagsFluid.LAVA) > 0.0D;
- this.setShivering(!flag);
+ // CraftBukkit start
+ if (!flag ^ this.isShivering()) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callStriderTemperatureChangeEvent(this, !flag);
+ this.setShivering(!flag);
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callStriderTemperatureChangeEvent(this, !flag)) {
+ this.setShivering(!flag);
+ }
+ }
+ // CraftBukkit end
super.tick();

View file

@ -1585,9 +1585,10 @@ public class CraftEventFactory {
return event;
}
public static void callStriderTemperatureChangeEvent(EntityStrider strider, boolean shivering) {
public static boolean callStriderTemperatureChangeEvent(EntityStrider strider, boolean shivering) {
StriderTemperatureChangeEvent event = new StriderTemperatureChangeEvent((Strider) strider.getBukkitEntity(), shivering);
Bukkit.getPluginManager().callEvent(event);
return !event.isCancelled();
}
public static boolean handleEntitySpellCastEvent(EntityIllagerWizard caster, EntityIllagerWizard.Spell spell) {