From 858e57bb0daed6cc097fda66fb5084d634814407 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 7 Aug 2015 14:39:29 -0400 Subject: [PATCH] edited a few things --- .../game/games/evolution/Evolution.java | 28 +++++-- .../games/evolution/evolve/EvolveData.java | 80 ++++++------------- 2 files changed, 47 insertions(+), 61 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 83b9cf12c..a151e4843 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -10,6 +10,8 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.ConditionActive; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -98,8 +100,6 @@ public class Evolution extends SoloGame DeathOut = false; PrepareFreeze = false; - - this.PrepareFreeze = false; GemKillDeathRespawn = 2; GemAssistDeathRespawn = .5; @@ -254,21 +254,36 @@ public class Evolution extends SoloGame @EventHandler public void startEvolve(EvolutionBeginEvent event) { - Manager.GetCondition().Factory().Cloak("Evolution", event.getPlayer(), null, Double.MAX_VALUE, false, false); - Recharge.Instance.Get(event.getPlayer()).clear(); } @EventHandler public void stopEvolve(EvolutionEndEvent event) { + if (Manager.GetCondition().GetActiveConditions().containsKey(event.getPlayer())) + { + for (ConditionActive condition : Manager.GetCondition().GetActiveConditions().get(event.getPlayer())) + { + if (condition.GetCondition().GetType() == ConditionType.CLOAK) + continue; + + condition.GetCondition().Expire(); + } + } + upgradeKit(event.getPlayer(), true); } @EventHandler public void endEvolve(final EvolutionPostEvolveEvent event) { - event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn()); + try + { + Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire(); + } + catch (NullPointerException ex) + { + } } @EventHandler @@ -315,6 +330,9 @@ public class Evolution extends SoloGame End(); return; } + + killer.teleport(GetTeam(killer).GetSpawn()); + Manager.GetCondition().Factory().Cloak("Evolving", killer, null, 10, true, true); } //Boolean ending diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 2c88d0180..adc7825a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -14,14 +14,11 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.packethandler.PacketPlayOutCamera; -import mineplex.minecraft.game.core.condition.Condition.ConditionType; -import mineplex.minecraft.game.core.condition.ConditionActive; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; import net.minecraft.server.v1_7_R4.Entity; -import net.minecraft.server.v1_7_R4.EntityBat; import net.minecraft.server.v1_7_R4.EntityBlaze; import net.minecraft.server.v1_7_R4.EntityChicken; import net.minecraft.server.v1_7_R4.EntityCreeper; @@ -43,11 +40,11 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftBat; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.entity.Bat; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftZombie; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; public class EvolveData @@ -68,54 +65,50 @@ public class EvolveData private String _evolveTop; - private Bat _bat; + private Zombie _zombie; + private int _ticks = 0; public EvolveData(EvolveManager manager, Player player, EvoKit from, EvoKit to) { _manager = manager; _player = player; - _manager.Host.Manager.GetCondition().Factory().Cloak(null, _player, null, Double.MAX_VALUE, false, false); _to = to; _evolveTop = C.cWhite + "You evolved into " + ("aeiou".indexOf(_to.GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + C.cGreen + C.Bold + _to.GetName(); _eFrom = spawn(from.getEntity()); - setupBat(); + setupZombie(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); - - teleport(true); - + setupPlayer(); } - private void setupBat() + private void setupZombie() { _manager.Host.CreatureAllowOverride = true; - Bat bat = _manager.getLocation().getWorld().spawn(_manager.getLocation(), Bat.class); + Zombie zombie = _manager.getLocation().getWorld().spawn(_manager.getLocation(), Zombie.class); _manager.Host.CreatureAllowOverride = false; - bat.setAwake(true); - bat.setRemoveWhenFarAway(false); + UtilEnt.Vegetate(zombie, true); + UtilEnt.ghost(zombie, false, true); - UtilEnt.Vegetate(bat, true); - UtilEnt.ghost(bat, false, true); - - _bat = bat; + _zombie = zombie; } private void setupPlayer() { //Spectate - PacketPlayOutCamera packet = new PacketPlayOutCamera(_bat); + PacketPlayOutCamera packet = new PacketPlayOutCamera(_zombie); UtilPlayer.sendPacket(_player, packet); } //Boolean completed public boolean tick() { + _ticks++; teleport(false); //Hasn't ended yet @@ -134,17 +127,6 @@ public class EvolveData UtilTextMiddle.display(null, _evolveTop, _player); - if (_manager.Host.Manager.GetCondition().GetActiveConditions().containsKey(_player)) - { - for (ConditionActive condition : _manager.Host.Manager.GetCondition().GetActiveConditions().get(_player)) - { - if (condition.GetCondition().GetType() == ConditionType.CLOAK) - continue; - - condition.GetCondition().Expire(); - } - } - _manager.Host.SetKit(_player, _manager.Host.GetKit(_player), false); Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player)); @@ -165,27 +147,14 @@ public class EvolveData return false; despawn(_eTo); - - UtilAction.velocity(_player, 0.0, 0.0, 0.0, false); - + //Stop spectating PacketPlayOutCamera packet = new PacketPlayOutCamera(_player); UtilPlayer.sendPacket(_player, packet); - _bat.remove(); + _zombie.remove(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); - - try - { - _manager.Host.Manager.GetCondition().GetActiveCondition(_player, ConditionType.CLOAK).Expire(); - } - catch (NullPointerException ex) - { - ex.printStackTrace(); - } - - _to.ApplyKit(_player); return true; } } @@ -202,26 +171,25 @@ public class EvolveData double sizeMod = 3.5; double speed = 15d; - double oX = -Math.sin(_bat.getTicksLived()/speed) * 2 * sizeMod; + double oX = -Math.sin(_ticks/speed) * 2 * sizeMod; double oY = 3; - double oZ = Math.cos(_bat.getTicksLived()/speed) * 2 * sizeMod; + double oZ = Math.cos(_ticks/speed) * 2 * sizeMod; if (teleport) { - _bat.teleport(_manager.getLocation().clone().add(oX, oY, oZ)); + _zombie.teleport(_manager.getLocation().clone().add(oX, oY, oZ)); + setupPlayer(); } else { - UtilAction.velocity(_bat, - UtilAlg.getTrajectory(_bat.getLocation(), _manager.getLocation().clone().add(oX, oY, oZ)), - 0.4, false, 0, 0.0, 1, true); + UtilAction.velocity(_zombie, + UtilAlg.getTrajectory(_zombie.getLocation(), _manager.getLocation().clone().add(oX, oY, oZ)), + 0.4, false, 0, 0.0, 0.0, false); } - setupPlayer(); + EntityZombie eB = ((CraftZombie) _zombie).getHandle(); - EntityBat eB = ((CraftBat) _bat).getHandle(); - - Vector to = UtilAlg.getTrajectory(_bat.getEyeLocation(), _manager.getLocation()); + Vector to = UtilAlg.getTrajectory(_zombie.getEyeLocation(), _manager.getLocation()).normalize(); try {