Add evolve effect

This commit is contained in:
libraryaddict 2014-12-16 15:23:31 +13:00
parent 6d3a1116b9
commit 7e6b6bd1b2

View File

@ -38,6 +38,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.scheduler.BukkitRunnable;
public class SearchAndDestroy extends TeamGame
{
@ -82,8 +83,42 @@ public class SearchAndDestroy extends TeamGame
public void onEvolve(Player player)
{
final int newTier = (_evolves.containsKey(player.getName()) ? _evolves.get(player.getName()) : 0) + 1;
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_REMEDY, 1.3F, 0);
final Location center = player.getLocation();
new BukkitRunnable()
{
double y = 2.2;
double rotAngle;
public void run()
{
if (y <= 0)
{
cancel();
}
else
{
for (int i = 0; i < 8; i++)
{
for (int a = 0; a < 2; a++)
{
double angle = ((2 * Math.PI) / 360D) * ((rotAngle + ((360D / 2) * a)) % 360);
double x = Math.cos(angle);
double z = Math.sin(angle);
Location l = center.clone().add(x, y, z);
l.getWorld().spigot()
.playEffect(l, newTier == 2 ? Effect.FLAME : Effect.WATERDRIP, 0, 0, 0, 0, 0, 0, 1, 30);
}
y -= 0.008;
rotAngle += 8;
}
}
}
}.runTaskTimer(Manager.GetPlugin(), 0, 0);
_kills.put(player.getName(), _kills.get(player.getName()) - 2);
_evolves.put(player.getName(), (_evolves.containsKey(player.getName()) ? _evolves.get(player.getName()) : 0) + 1);
_evolves.put(player.getName(), newTier);
}
@EventHandler
@ -163,7 +198,7 @@ public class SearchAndDestroy extends TeamGame
}
DeathMessages = true;
// TODO The code below could be used when a team is defeated.
// TODO The code below could be used when a team is defeated.
/* if (getBombs().size() == 1)
{
GameTeam winning = getBombs().get(0).getTeam();