From ac0339fc596d678e32e47323d8d6c5ece7bf4e3e Mon Sep 17 00:00:00 2001 From: LCastr0 Date: Wed, 10 May 2017 21:20:23 -0300 Subject: [PATCH] Fixed sync with dragon and fixed guardian not showing --- .../rankwineffects/WinEffectRankEternal.java | 40 +++++++++++++++---- .../rankwineffects/WinEffectRankHero.java | 6 +-- .../rankwineffects/WinEffectRankLegend.java | 2 +- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankEternal.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankEternal.java index aa5a9a1dd..03ddfa4d5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankEternal.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankEternal.java @@ -65,6 +65,32 @@ public class WinEffectRankEternal extends WinEffectRankBased _step = 0; } + @EventHandler + public void spawnGuardian(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (_guardian != null) + { + return; + } + + if (!isRunning()) + return; + + _step++; + + if (_step == 5) + { + Location npcLocation = _npc.getEntity().getBukkitEntity().getLocation(); + Manager.getPetManager().getCreatureModule().SetForce(true); + _guardian = npcLocation.getWorld().spawn(npcLocation, Guardian.class); + Manager.getPetManager().getCreatureModule().SetForce(false); + _step = 0; + } + } + @EventHandler public void onUpdate(UpdateEvent event) { @@ -74,22 +100,20 @@ public class WinEffectRankEternal extends WinEffectRankBased if (event.getType() != UpdateType.FASTEST) return; + if (_guardian == null) + { + return; + } + Location npcLocation = _npc.getEntity().getBukkitEntity().getLocation(); _step++; - if (_guardian == null) - { - Manager.getPetManager().getCreatureModule().SetForce(true); - _guardian = npcLocation.getWorld().spawn(npcLocation.add(0, 20, 0), Guardian.class); - Manager.getPetManager().getCreatureModule().SetForce(false); - } - double increment = (2 * Math.PI) / POINTS; double angle = _step * increment; Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); _guardian.setVelocity(new Vector(0,0,0)); - _guardian.teleport(_player.getLocation().clone().subtract(vector)); + _guardian.teleport(npcLocation.clone().subtract(vector)); Vector direction = npcLocation.toVector().subtract(_guardian.getEyeLocation().toVector()); Location enderLocation = _guardian.getLocation().setDirection(direction); _guardian.teleport(enderLocation); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankHero.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankHero.java index 06ffa9890..f71cf48b6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankHero.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankHero.java @@ -71,10 +71,10 @@ public class WinEffectRankHero extends WinEffectRankBased if (!isRunning()) return; - if (_step > 65) + if (_step > 62) return; - if (_step == 65) + if (_step == 62) { breakBlocks(); } @@ -100,7 +100,7 @@ public class WinEffectRankHero extends WinEffectRankBased double angle = _step * increment; Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); _enderDragon.setVelocity(new Vector(0, 0, 0)); - _enderDragon.teleport(_player.getLocation().clone().subtract(vector)); + _enderDragon.teleport(npcLocation.clone().subtract(vector)); Vector direction = npcLocation.toVector().subtract(_enderDragon.getEyeLocation().toVector()).multiply(-1); Location enderLocation = _enderDragon.getLocation().setDirection(direction); _enderDragon.teleport(enderLocation); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankLegend.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankLegend.java index 85b69d905..ab96a352c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankLegend.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/wineffect/rankrooms/rankwineffects/WinEffectRankLegend.java @@ -90,7 +90,7 @@ public class WinEffectRankLegend extends WinEffectRankBased double angle = _step * increment; Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS); _wither.setVelocity(new Vector(0,0,0)); - _wither.teleport(_player.getLocation().clone().subtract(vector)); + _wither.teleport(npcLocation.clone().subtract(vector)); Vector direction = npcLocation.toVector().subtract(_wither.getEyeLocation().toVector()); Location enderLocation = _wither.getLocation().setDirection(direction); _wither.teleport(enderLocation);