Fixing Nuke animation bugs.

This commit is contained in:
Sarah 2015-10-08 19:04:39 +02:00
parent 34a554584c
commit f8528c9cff
2 changed files with 54 additions and 27 deletions

View File

@ -31,8 +31,10 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
public class Minion implements Listener
@ -267,7 +269,17 @@ public class Minion implements Listener
_killed = killed;
_player = player;
_die = true;
((Creeper) _entity).damage(10000);
try
{
((Creeper) _entity).damage(10000);
}
catch (Exception e) {}
}
@EventHandler(priority=EventPriority.LOWEST)
public void noItems(EntityDeathEvent event)
{
event.getDrops().clear();
}
@EventHandler

View File

@ -155,8 +155,8 @@ public class TypeWars extends TeamGame
_lineShorten.put(team, new ArrayList<Location>());
}
_timeToSpawnBlue = 30000 / GetTeam(ChatColor.RED).GetPlayers(true).size();
_timeToSpawnBlue = 30000 / GetTeam(ChatColor.BLUE).GetPlayers(true).size();
_timeToSpawnBlue = 10000 / GetTeamList().get(0).GetPlayers(true).size();
_timeToSpawnBlue = 10000 / GetTeamList().get(1).GetPlayers(true).size();
_lastSpawnedRed = System.currentTimeMillis();
_lastSpawnedBlue = System.currentTimeMillis();
@ -208,6 +208,12 @@ public class TypeWars extends TeamGame
{
if(teams != team)
{
if(getMinions(team).size() >= 60)
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "Your Team cant have more than 60 Minions"));
return;
}
this.CreatureAllowOverride = true;
_moneyMap.put(event.getPlayer(), _moneyMap.get(event.getPlayer()) - type.getCost());
UtilPlayer.message(event.getPlayer(), F.main("Game", "You bought a Minion."));
@ -235,33 +241,41 @@ public class TypeWars extends TeamGame
if(UtilTime.elapsed(_lastSpawnedRed, _timeToSpawnRed))
{
_lastSpawnedRed = System.currentTimeMillis();
this.CreatureAllowOverride = true;
int rdm = UtilMath.r(_minionSpawns.get(GetTeam(ChatColor.RED)).size());
Minion minion = new Minion(Manager, _minionSpawns.get(GetTeam(ChatColor.RED)).get(rdm), _minionSpawns.get(GetTeam(ChatColor.BLUE)).get(rdm), GetTeam(ChatColor.RED));
Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin());
_activeMinions.add(minion);
this.CreatureAllowOverride = false;
if(getMinions(GetTeamList().get(0)).size() < 60)
{
_lastSpawnedRed = System.currentTimeMillis();
if(_timeToSpawnRed > 12000 / GetTeam(ChatColor.BLUE).GetPlayers(true).size())
_timeToSpawnRed = _timeToSpawnRed - 75;
this.CreatureAllowOverride = true;
int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(0)).size());
Minion minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(0)).get(rdm), _minionSpawns.get(GetTeamList().get(1)).get(rdm), GetTeamList().get(0));
Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin());
_activeMinions.add(minion);
this.CreatureAllowOverride = false;
if(_timeToSpawnRed > 10000 / GetTeamList().get(1).GetPlayers(true).size())
_timeToSpawnRed = _timeToSpawnRed - 75;
}
}
if(UtilTime.elapsed(_lastSpawnedBlue, _timeToSpawnBlue))
{
_lastSpawnedBlue = System.currentTimeMillis();
if(getMinions(GetTeamList().get(1)).size() < 60)
{
_lastSpawnedBlue = System.currentTimeMillis();
this.CreatureAllowOverride = true;
int rdm = UtilMath.r(_minionSpawns.get(GetTeam(ChatColor.BLUE)).size());
Minion minion = new Minion(Manager, _minionSpawns.get(GetTeam(ChatColor.BLUE)).get(rdm), _minionSpawns.get(GetTeam(ChatColor.RED)).get(rdm), GetTeam(ChatColor.BLUE));
Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin());
_activeMinions.add(minion);
this.CreatureAllowOverride = true;
int rdm = UtilMath.r(_minionSpawns.get(GetTeamList().get(1)).size());
Minion minion = new Minion(Manager, _minionSpawns.get(GetTeamList().get(1)).get(rdm), _minionSpawns.get(GetTeamList().get(0)).get(rdm), GetTeamList().get(1));
Bukkit.getPluginManager().registerEvents(minion, Manager.getPlugin());
_activeMinions.add(minion);
this.CreatureAllowOverride = false;
this.CreatureAllowOverride = false;
if(_timeToSpawnBlue > 12000 / GetTeam(ChatColor.RED).GetPlayers(true).size())
_timeToSpawnBlue = _timeToSpawnRed - 75;
if(_timeToSpawnBlue > 10000 / GetTeamList().get(0).GetPlayers(true).size())
_timeToSpawnBlue = _timeToSpawnRed - 75;
}
}
}
@ -628,7 +642,7 @@ public class TypeWars extends TeamGame
@EventHandler
public void nuke(UpdateEvent event)
{
if(event.getType() != UpdateType.FASTEST)
if(event.getType() != UpdateType.TICK)
return;
if(_pendingNukes.isEmpty())
@ -668,10 +682,11 @@ public class TypeWars extends TeamGame
_deadMinions.add(minion);
}
if(_nukeFrame >= locations.size())
if(_nukeFrame >= locations.size() - 1)
{
_nukeFrame = -1;
_nukeFrame = 0;
_pendingNukes.remove(0);
break;
}
i++;
}
@ -710,6 +725,6 @@ public class TypeWars extends TeamGame
public void addNuke(Player player)
{
_pendingNukes.put(player);
_pendingNukes.add(player);
}
}