adding proper forcefield for minions and giants.
This commit is contained in:
parent
114ae33d89
commit
3260550368
@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
@ -50,6 +51,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -287,7 +289,7 @@ public class TypeWars extends TeamGame
|
||||
public void Players(UpdateEvent event)
|
||||
{
|
||||
|
||||
if(GetState() != GameState.Live)
|
||||
if(GetState() != GameState.Live && GetState() != GameState.Prepare && GetState() != GameState.End)
|
||||
return;
|
||||
|
||||
for(Player player : GetPlayers(true))
|
||||
@ -306,6 +308,42 @@ public class TypeWars extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ForcefieldUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
return;
|
||||
|
||||
for (Minion minion : _activeMinions)
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (UtilMath.offset(other, minion.getEntity()) > 2)
|
||||
continue;
|
||||
|
||||
if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false))
|
||||
{
|
||||
UtilAction.velocity(other, UtilAlg.getTrajectory2d(minion.getEntity(), other), 1.6, true, 0.8, 0, 10, true);
|
||||
other.getWorld().playSound(other.getLocation(), Sound.CHICKEN_EGG_POP, 2f, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Giant giant : _giants.values())
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (UtilMath.offset(other, giant) > 7)
|
||||
continue;
|
||||
|
||||
if (Recharge.Instance.use(other, "Forcefield Bump", 500, false, false))
|
||||
{
|
||||
UtilAction.velocity(other, UtilAlg.getTrajectory2d(giant, other), 1.6, true, 0.8, 0, 10, true);
|
||||
other.getWorld().playSound(other.getLocation(), Sound.CHICKEN_EGG_POP, 2f, 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Location _tutorialLocationRed, _tutorialLocationBlue;
|
||||
|
||||
private void initSpawns()
|
||||
|
Loading…
Reference in New Issue
Block a user