13
0
geforkt von Mirrors/Paper
Paper/paper-server/nms-patches/DragonControllerManager.patch
CraftBukkit/Spigot b2efd58164 Organise imports
By: md_5 <git@md-5.net>
2021-03-09 08:47:33 +11:00

43 Zeilen
1.8 KiB
Diff

--- a/net/minecraft/server/DragonControllerManager.java
+++ b/net/minecraft/server/DragonControllerManager.java
@@ -3,6 +3,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftEnderDragon;
+import org.bukkit.event.entity.EnderDragonChangePhaseEvent;
+// CraftBukkit end
+
public class DragonControllerManager {
private static final Logger LOGGER = LogManager.getLogger();
@@ -21,6 +26,19 @@
this.currentDragonController.e();
}
+ // CraftBukkit start - Call EnderDragonChangePhaseEvent
+ EnderDragonChangePhaseEvent event = new EnderDragonChangePhaseEvent(
+ (CraftEnderDragon) this.enderDragon.getBukkitEntity(),
+ (this.currentDragonController == null) ? null : CraftEnderDragon.getBukkitPhase(this.currentDragonController.getControllerPhase()),
+ CraftEnderDragon.getBukkitPhase(dragoncontrollerphase)
+ );
+ this.enderDragon.world.getServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return;
+ }
+ dragoncontrollerphase = CraftEnderDragon.getMinecraftPhase(event.getNewPhase());
+ // CraftBukkit end
+
this.currentDragonController = this.b(dragoncontrollerphase);
if (!this.enderDragon.world.isClientSide) {
this.enderDragon.getDataWatcher().set(EntityEnderDragon.PHASE, dragoncontrollerphase.b());
@@ -42,6 +60,6 @@
this.dragonControllers[i] = dragoncontrollerphase.a(this.enderDragon);
}
- return this.dragonControllers[i];
+ return (T) this.dragonControllers[i]; // CraftBukkit - decompile error
}
}