mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 12:41:50 +01:00
64 lines
3 KiB
Diff
64 lines
3 KiB
Diff
--- a/net/minecraft/server/DragonControllerManager.java
|
|
+++ b/net/minecraft/server/DragonControllerManager.java
|
|
@@ -2,32 +2,44 @@
|
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
+import org.bukkit.craftbukkit.entity.CraftEnderDragon;
|
|
+import org.bukkit.entity.EnderDragon;
|
|
+import org.bukkit.event.entity.EnderDragonChangePhaseEvent;
|
|
|
|
public class DragonControllerManager {
|
|
|
|
private static final Logger a = LogManager.getLogger();
|
|
- private final EntityEnderDragon b;
|
|
- private final IDragonController[] c = new IDragonController[DragonControllerPhase.c()];
|
|
- private IDragonController d;
|
|
+ private final EntityEnderDragon b; // PAIL: Rename enderDragon
|
|
+ private final IDragonController[] c = new IDragonController[DragonControllerPhase.c()]; // PAIL: Rename dragonControllers
|
|
+ private IDragonController d; // PAIL: Rename currentDragonController
|
|
|
|
public DragonControllerManager(EntityEnderDragon entityenderdragon) {
|
|
this.b = entityenderdragon;
|
|
this.a(DragonControllerPhase.k);
|
|
}
|
|
|
|
- public void a(DragonControllerPhase<?> dragoncontrollerphase) {
|
|
- if (this.d == null || dragoncontrollerphase != this.d.i()) {
|
|
+ public void a(DragonControllerPhase<?> dragoncontrollerphase) { // PAIL: Rename setControllerPhase
|
|
+ if (this.d == null || dragoncontrollerphase != this.d.i()) { // PAIL: Rename getControllerPhase
|
|
if (this.d != null) {
|
|
- this.d.e();
|
|
+ this.d.e(); // PAIL: Rename
|
|
}
|
|
|
|
- this.d = this.b(dragoncontrollerphase);
|
|
+ // CraftBukkit start - Call EnderDragonChangePhaseEvent
|
|
+ EnderDragonChangePhaseEvent event = new EnderDragonChangePhaseEvent((CraftEnderDragon) this.b.getBukkitEntity(), this.d == null ? null : CraftEnderDragon.getBukkitPhase(this.d.i()), CraftEnderDragon.getBukkitPhase(dragoncontrollerphase));
|
|
+ this.b.world.getServer().getPluginManager().callEvent(event);
|
|
+ if (event.isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+ dragoncontrollerphase = CraftEnderDragon.getMinecraftPhase(event.getNewPhase());
|
|
+ // CraftBukkit end
|
|
+
|
|
+ this.d = this.b(dragoncontrollerphase); // PAIL: Rename getDragonController
|
|
if (!this.b.world.isClientSide) {
|
|
- this.b.getDataWatcher().set(EntityEnderDragon.a, Integer.valueOf(dragoncontrollerphase.b()));
|
|
+ this.b.getDataWatcher().set(EntityEnderDragon.a, Integer.valueOf(dragoncontrollerphase.b())); // PAIL: Rename getId
|
|
}
|
|
|
|
DragonControllerManager.a.debug("Dragon is now in phase {} on the {}", new Object[] { dragoncontrollerphase, this.b.world.isClientSide ? "client" : "server"});
|
|
- this.d.d();
|
|
+ this.d.d(); // PAIL: Rename reset
|
|
}
|
|
}
|
|
|
|
@@ -42,6 +54,6 @@
|
|
this.c[i] = dragoncontrollerphase.a(this.b);
|
|
}
|
|
|
|
- return this.c[i];
|
|
+ return (T) this.c[i];
|
|
}
|
|
}
|