- More chiss

This commit is contained in:
AlexTheCoder 2016-04-16 14:05:46 -04:00
parent 09f9ae3b7a
commit d8f5ac66fc
14 changed files with 298 additions and 120 deletions

View File

@ -33,7 +33,7 @@ import nautilus.game.arcade.game.games.minecraftleague.data.BlockProtection;
import nautilus.game.arcade.game.games.minecraftleague.data.MapZone; import nautilus.game.arcade.game.games.minecraftleague.data.MapZone;
import nautilus.game.arcade.game.games.minecraftleague.data.Spawner; import nautilus.game.arcade.game.games.minecraftleague.data.Spawner;
import nautilus.game.arcade.game.games.minecraftleague.data.TeamBeacon; import nautilus.game.arcade.game.games.minecraftleague.data.TeamBeacon;
import nautilus.game.arcade.game.games.minecraftleague.data.TeamTower; import nautilus.game.arcade.game.games.minecraftleague.data.TeamCrystal;
import nautilus.game.arcade.game.games.minecraftleague.data.TeamTowerBase; import nautilus.game.arcade.game.games.minecraftleague.data.TeamTowerBase;
import nautilus.game.arcade.game.games.minecraftleague.data.TowerAlert; import nautilus.game.arcade.game.games.minecraftleague.data.TowerAlert;
import nautilus.game.arcade.game.games.minecraftleague.data.TowerManager; import nautilus.game.arcade.game.games.minecraftleague.data.TowerManager;
@ -103,7 +103,7 @@ public class MinecraftLeague extends TeamGame
//private ConcurrentHashMap<Player, PlayerRespawnPoint> _customRespawns = new ConcurrentHashMap<Player, PlayerRespawnPoint>(); //private ConcurrentHashMap<Player, PlayerRespawnPoint> _customRespawns = new ConcurrentHashMap<Player, PlayerRespawnPoint>();
//private ConcurrentHashMap<GameTeam, TeamMap> _maps = new ConcurrentHashMap<GameTeam, TeamMap>(); //private ConcurrentHashMap<GameTeam, TeamMap> _maps = new ConcurrentHashMap<GameTeam, TeamMap>();
private ConcurrentHashMap<Player, List<ItemStack>> _gear = new ConcurrentHashMap<Player, List<ItemStack>>(); private ConcurrentHashMap<Player, List<ItemStack>> _gear = new ConcurrentHashMap<Player, List<ItemStack>>();
public ConcurrentHashMap<GameTeam, TeamBeacon> Beacons = new ConcurrentHashMap<GameTeam, TeamBeacon>(); public ConcurrentHashMap<Block, TeamBeacon> Beacons = new ConcurrentHashMap<Block, TeamBeacon>();
//public ConcurrentHashMap<GameTeam, Long> TeamPoison = new ConcurrentHashMap<GameTeam, Long>(); //public ConcurrentHashMap<GameTeam, Long> TeamPoison = new ConcurrentHashMap<GameTeam, Long>();
private ConcurrentHashMap<Player, BlockProtection> _blockLock = new ConcurrentHashMap<Player, BlockProtection>(); private ConcurrentHashMap<Player, BlockProtection> _blockLock = new ConcurrentHashMap<Player, BlockProtection>();
//private ConcurrentHashMap<Player, Long> _spawnAllow = new ConcurrentHashMap<Player, Long>(); //private ConcurrentHashMap<Player, Long> _spawnAllow = new ConcurrentHashMap<Player, Long>();
@ -115,6 +115,7 @@ public class MinecraftLeague extends TeamGame
private MinecraftLeagueCommand _cmd; private MinecraftLeagueCommand _cmd;
private long _lastIncrease; private long _lastIncrease;
private long _lastOreReset; private long _lastOreReset;
private long _lastGrindReset;
private boolean _yellow = false; private boolean _yellow = false;
public List<MapZone> MapZones = new ArrayList<MapZone>(); public List<MapZone> MapZones = new ArrayList<MapZone>();
@ -126,6 +127,7 @@ public class MinecraftLeague extends TeamGame
private FreezeManager _freeze; private FreezeManager _freeze;
private TowerManager _tower; private TowerManager _tower;
public TowerAlert Alert; public TowerAlert Alert;
public boolean ScoreboardAutoWrite = true;
//private final EntityType[] _passive = new EntityType[] {EntityType.CHICKEN, EntityType.COW, EntityType.PIG, EntityType.RABBIT, EntityType.SHEEP}; //private final EntityType[] _passive = new EntityType[] {EntityType.CHICKEN, EntityType.COW, EntityType.PIG, EntityType.RABBIT, EntityType.SHEEP};
@ -394,9 +396,9 @@ public class MinecraftLeague extends TeamGame
return ids; return ids;
} }
public TeamTowerBase getActiveTower(GameTeam team) //public TeamTowerBase getActiveTower(GameTeam team)
{ {
return _tower.getVulnerable(team); //return _tower.getVulnerable(team);
} }
public TowerManager getTowerManager() public TowerManager getTowerManager()
@ -454,10 +456,25 @@ public class MinecraftLeague extends TeamGame
@EventHandler @EventHandler
public void ScoreboardUpdate(UpdateEvent event) public void ScoreboardUpdate(UpdateEvent event)
{ {
if (!ScoreboardAutoWrite)
return;
if (event.getType() == UpdateType.FAST || event.getType() == UpdateType.SEC) if (event.getType() == UpdateType.FAST || event.getType() == UpdateType.SEC)
scoreboardWrite(event.getType() == UpdateType.SEC); scoreboardWrite(event.getType() == UpdateType.SEC);
} }
public void writeEndSb(String winner)
{
Scoreboard.Reset();
Scoreboard.WriteBlank();
Scoreboard.Write(C.cDRedB + "Minecraft League");
Scoreboard.WriteBlank();
Scoreboard.Write(C.cGoldB + "Winner:");
Scoreboard.Write(winner);
Scoreboard.Draw();
}
private void scoreboardWrite(boolean sec) private void scoreboardWrite(boolean sec)
{ {
if (!InProgress()) if (!InProgress())
@ -492,26 +509,30 @@ public class MinecraftLeague extends TeamGame
GameTeam red = GetTeam(ChatColor.RED); GameTeam red = GetTeam(ChatColor.RED);
GameTeam blue = GetTeam(ChatColor.AQUA); GameTeam blue = GetTeam(ChatColor.AQUA);
TeamTowerBase redt = _tower.getVulnerable(red); String reds = "";
TeamTowerBase bluet = _tower.getVulnerable(blue); String blues = "";
String reds = "First Tower"; for (TeamTowerBase tb : _tower.getTeamTowers(red))
String blues = "First Tower";
if (redt instanceof TeamTower)
{ {
if (((TeamTower)redt).Number > 1) if (!reds.equalsIgnoreCase(""))
reds = "Second Tower"; reds = reds + " ";
String symbol = "";
if (tb instanceof TeamCrystal)
symbol = "";
reds = reds + tb.getHealthColor() + symbol;
} }
else for (TeamTowerBase tb : _tower.getTeamTowers(blue))
reds = "Core";
if (bluet instanceof TeamTower)
{ {
if (((TeamTower)bluet).Number > 1) if (!blues.equalsIgnoreCase(""))
blues = "Second Tower"; blues = blues + " ";
String symbol = "";
if (tb instanceof TeamCrystal)
symbol = "";
blues = blues + tb.getHealthColor() + symbol;
} }
else
blues = "Core";
_liveTime = Math.max(System.currentTimeMillis() - GetStateTime(), 0); _liveTime = Math.max(System.currentTimeMillis() - GetStateTime(), 0);
@ -525,13 +546,19 @@ public class MinecraftLeague extends TeamGame
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cRedB + "Red Team"); Scoreboard.Write(C.cRedB + "Red Team");
Scoreboard.Write(reds + ": " + redt.formatHealth(redt.getHealth())); Scoreboard.Write("Towers: " + reds);
Scoreboard.Write("Players Alive: " + red.GetPlayers(true).size()); for (String s : _vman.getSelected().getTeamScoreboardAdditions(red))
{
Scoreboard.Write(s);
}
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cAquaB + "Blue Team"); Scoreboard.Write(C.cAquaB + "Blue Team");
Scoreboard.Write(blues + ": " + bluet.formatHealth(bluet.getHealth())); Scoreboard.Write("Towers: " + blues);
Scoreboard.Write("Players Alive: " + blue.GetPlayers(true).size()); for (String s : _vman.getSelected().getTeamScoreboardAdditions(blue))
{
Scoreboard.Write(s);
}
int i = 1; int i = 1;
for (ExtraScoreboardData sbD : ExtraSb.keySet()) for (ExtraScoreboardData sbD : ExtraSb.keySet())
@ -565,7 +592,7 @@ public class MinecraftLeague extends TeamGame
{ {
for (GameTeam team : GetTeamList()) for (GameTeam team : GetTeamList())
{ {
TeamTowerBase tower = _tower.getVulnerable(team); TeamTowerBase tower = _tower.getTeamTowers(team).getLast();
UtilPlayer.message(caller, team.GetColor() + team.GetName()); UtilPlayer.message(caller, team.GetColor() + team.GetName());
UtilPlayer.message(caller, C.cGray + "Health: " + tower.getHealth()); UtilPlayer.message(caller, C.cGray + "Health: " + tower.getHealth());
UtilPlayer.message(caller, C.cGray + "Alive: " + tower.Alive); UtilPlayer.message(caller, C.cGray + "Alive: " + tower.Alive);
@ -623,6 +650,7 @@ public class MinecraftLeague extends TeamGame
{ {
_lastIncrease = System.currentTimeMillis(); _lastIncrease = System.currentTimeMillis();
_lastOreReset = System.currentTimeMillis(); _lastOreReset = System.currentTimeMillis();
_lastGrindReset = System.currentTimeMillis() - UtilTime.convert(30, TimeUnit.SECONDS, TimeUnit.MILLISECONDS);
Manager.GetExplosion().setEnabled(false); Manager.GetExplosion().setEnabled(false);
Manager.GetDamage().SetEnabled(false); Manager.GetDamage().SetEnabled(false);
Manager.GetCreature().SetForce(false); Manager.GetCreature().SetForce(false);
@ -779,30 +807,34 @@ public class MinecraftLeague extends TeamGame
this.DeathSpectateSecs = Math.min(20, this.DeathSpectateSecs + 2.5); this.DeathSpectateSecs = Math.min(20, this.DeathSpectateSecs + 2.5);
} }
for (Location grind : WorldData.GetCustomLocs(DataLoc.GRIND_AREA.getKey())) if (UtilTime.elapsed(_lastGrindReset, UtilTime.convert(30, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
{ {
int spider = 0; _lastGrindReset = System.currentTimeMillis();
int chicken = 0; for (Location grind : WorldData.GetCustomLocs(DataLoc.GRIND_AREA.getKey()))
for (LivingEntity le : UtilEnt.getInRadius(grind, 15).keySet())
{ {
if (le.getType() == EntityType.SPIDER) int spider = 0;
spider++; int chicken = 0;
if (le.getType() == EntityType.CHICKEN) for (LivingEntity le : UtilEnt.getInRadius(grind, 15).keySet())
chicken++; {
} if (le.getType() == EntityType.SPIDER)
while (spider < 5) spider++;
{ if (le.getType() == EntityType.CHICKEN)
spider++; chicken++;
CreatureAllowOverride = true; }
Manager.GetCreature().SpawnEntity(grind, EntityType.SPIDER); while (spider < 5)
CreatureAllowOverride = false; {
} spider = 5;
while (chicken < 10) CreatureAllowOverride = true;
{ Manager.GetCreature().SpawnEntity(grind, EntityType.SPIDER);
chicken++; CreatureAllowOverride = false;
CreatureAllowOverride = true; }
Manager.GetCreature().SpawnEntity(grind, EntityType.CHICKEN); while (chicken < 10)
CreatureAllowOverride = false; {
chicken = 10;
CreatureAllowOverride = true;
Manager.GetCreature().SpawnEntity(grind, EntityType.CHICKEN);
CreatureAllowOverride = false;
}
} }
} }
@ -1487,12 +1519,22 @@ public class MinecraftLeague extends TeamGame
} }
} }
int arrowsToAdd = UtilInv.getAmount(player, Material.ARROW) / 2; //int arrowsToAdd = UtilInv.getAmount(player, Material.ARROW) / 2;
while (arrowsToAdd >= 1) //while (arrowsToAdd >= 1)
//{
//int subtract = Math.min(64, arrowsToAdd);
//gear.add(new ItemStack(Material.ARROW, subtract));
//arrowsToAdd -= subtract;
//}
if (UtilInv.getAmount(player, Material.ARROW) >= 1)
{ {
int subtract = Math.min(64, arrowsToAdd); for (ItemStack arrow : UtilInv.getItems(player))
gear.add(new ItemStack(Material.ARROW, subtract)); {
arrowsToAdd -= subtract; if (arrow.getType() == Material.ARROW)
{
gear.add(arrow);
}
}
} }
_gear.put(player, gear); _gear.put(player, gear);
@ -1505,6 +1547,8 @@ public class MinecraftLeague extends TeamGame
return; return;
if (!(event.getEntity() instanceof Player)) if (!(event.getEntity() instanceof Player))
return; return;
if (UtilPlayer.isSpectator(event.getEntity()))
return;
Player player = (Player)event.getEntity(); Player player = (Player)event.getEntity();
storeGear(player); storeGear(player);
@ -1590,7 +1634,14 @@ public class MinecraftLeague extends TeamGame
{ {
if (OverTime) if (OverTime)
{ {
_tower.getVulnerable(GetTeam(event.GetPlayer())).damage(20, null); for (TeamTowerBase tb : _tower.getTeamTowers(GetTeam(event.GetPlayer())))
{
if (tb.Alive)
{
tb.damage(20, null);
break;
}
}
if (_tower.getAmountAlive(GetTeam(event.GetPlayer())) >= 1) if (_tower.getAmountAlive(GetTeam(event.GetPlayer())) >= 1)
{ {
event.setCancelled(true); event.setCancelled(true);

View File

@ -42,15 +42,15 @@ public class AdminPanel implements Listener
_slots = new ConcurrentHashMap<GameTeam, Integer>(); _slots = new ConcurrentHashMap<GameTeam, Integer>();
ItemStack red = new ItemBuilder(MenuButton.CRYSTAL.getRepresentation()) ItemStack red = new ItemBuilder(MenuButton.CRYSTAL.getRepresentation())
.setTitle(C.cRed + "Red Tower") .setTitle(C.cRed + "Red Core")
.setLore(C.cGray + "Alive: " + host.getActiveTower(host.GetTeam(ChatColor.RED)).Alive, .setLore(C.cGray + "Alive: " + host.getTowerManager().getTeamTowers(host.GetTeam(ChatColor.RED)).getLast().Alive,
C.cGray + "Health: " + host.getActiveTower(host.GetTeam(ChatColor.RED)).getHealth()) C.cGray + "Health: " + host.getTowerManager().getTeamTowers(host.GetTeam(ChatColor.RED)).getLast().getHealth())
.build(); .build();
ItemStack blue = new ItemBuilder(MenuButton.CRYSTAL.getRepresentation()) ItemStack blue = new ItemBuilder(MenuButton.CRYSTAL.getRepresentation())
.setTitle(C.cAqua + "Blue Tower") .setTitle(C.cAqua + "Blue Core")
.setLore(C.cGray + "Alive: " + host.getActiveTower(host.GetTeam(ChatColor.AQUA)).Alive, .setLore(C.cGray + "Alive: " + host.getTowerManager().getTeamTowers(host.GetTeam(ChatColor.AQUA)).getLast().Alive,
C.cGray + "Health: " + host.getActiveTower(host.GetTeam(ChatColor.AQUA)).getHealth()) C.cGray + "Health: " + host.getTowerManager().getTeamTowers(host.GetTeam(ChatColor.AQUA)).getLast().getHealth())
.build(); .build();
_buttons.put(red, host.GetTeam(ChatColor.RED)); _buttons.put(red, host.GetTeam(ChatColor.RED));
@ -75,8 +75,8 @@ public class AdminPanel implements Listener
GameTeam team = _buttons.get(item); GameTeam team = _buttons.get(item);
ItemMeta im = item.getItemMeta(); ItemMeta im = item.getItemMeta();
List<String> lore = new ArrayList<String>(); List<String> lore = new ArrayList<String>();
lore.add(C.cGray + "Alive: " + _host.getActiveTower(team).Alive); lore.add(C.cGray + "Alive: " + _host.getTowerManager().getTeamTowers(team).getLast().Alive);
lore.add(C.cGray + "Health: " + _host.getActiveTower(team).getHealth()); lore.add(C.cGray + "Health: " + _host.getTowerManager().getTeamTowers(team).getLast().getHealth());
im.setLore(lore); im.setLore(lore);
item.setItemMeta(im); item.setItemMeta(im);
_buttons.remove(item); _buttons.remove(item);

View File

@ -169,7 +169,7 @@ public class DefenderAI
private void drawBeam() private void drawBeam()
{ {
Location base = _base.clone().add(0, 10, 0); Location base = _base.clone().add(0, 10, 0);
Location target = _manager.getTeamTowers(_tower.getTeam()).get(_number).getLocation().clone().add(0, 10, 0); Location target = _manager.getTeamTowers(_tower.getTeam()).getLast().getLocation().clone().add(0, 10, 0);//_manager.getTeamTowers(_tower.getTeam()).get(_number).getLocation().clone().add(0, 10, 0);
Location display = base.clone(); Location display = base.clone();
while (UtilMath.offset(base, target) > UtilMath.offset(base, display)) while (UtilMath.offset(base, target) > UtilMath.offset(base, display))
{ {

View File

@ -24,6 +24,8 @@ public class OreGenerator
} }
for (int i = 0; i < (amount + 1); i++) for (int i = 0; i < (amount + 1); i++)
{ {
if (_choices.size() == 0)
continue;
Location selected = _choices.remove(UtilMath.random.nextInt(_choices.size())); Location selected = _choices.remove(UtilMath.random.nextInt(_choices.size()));
selected.getBlock().setType(oreType); selected.getBlock().setType(oreType);
} }

View File

@ -35,9 +35,14 @@ public class TeamBeacon
return false; return false;
}*/ }*/
public void setBlock(Block block) /*public void setBlock(Block block)
{ {
_block = block; _block = block;
}*/
public Block getBlock()
{
return _block;
} }
public void update() public void update()

View File

@ -18,6 +18,7 @@ import nautilus.game.arcade.game.games.minecraftleague.DataLoc;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague; import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
@ -134,7 +135,7 @@ public abstract class TeamTowerBase
{ {
b.setType(Material.AIR); b.setType(Material.AIR);
} }
for (int i = 1; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
getBeacon().clone().add(0, i, 0).getBlock().setType(Material.BEDROCK); getBeacon().clone().add(0, i, 0).getBlock().setType(Material.BEDROCK);
} }
@ -219,6 +220,21 @@ public abstract class TeamTowerBase
return tag; return tag;
} }
public ChatColor getHealthColor()
{
if (!Alive)
return ChatColor.GRAY;
ChatColor color = ChatColor.YELLOW;
if (_health > (.9 * _maxHealth))
color = ChatColor.GREEN;
else if (_health < (.45 * _maxHealth))
color = ChatColor.RED;
return color;
}
public boolean damage(double damage, Player player) public boolean damage(double damage, Player player)
{ {
if (!Vulnerable) if (!Vulnerable)

View File

@ -7,8 +7,8 @@ import java.util.List;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minecraftleague.DataLoc; import nautilus.game.arcade.game.games.minecraftleague.DataLoc;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague; import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.world.WorldData; import nautilus.game.arcade.world.WorldData;
@ -25,10 +25,10 @@ public class TowerManager implements Listener
{ {
public MinecraftLeague Host; public MinecraftLeague Host;
private ConcurrentHashMap<TeamTowerBase, GameTeam> _towers = new ConcurrentHashMap<TeamTowerBase, GameTeam>(); private ConcurrentHashMap<TeamTowerBase, GameTeam> _towers = new ConcurrentHashMap<TeamTowerBase, GameTeam>();
private ConcurrentHashMap<GameTeam, Integer> _vulnerableTower = new ConcurrentHashMap<GameTeam, Integer>(); //private ConcurrentHashMap<GameTeam, Integer> _vulnerableTower = new ConcurrentHashMap<GameTeam, Integer>();
private ConcurrentHashMap<TeamTowerBase, DefenderAI> _def = new ConcurrentHashMap<TeamTowerBase, DefenderAI>(); private ConcurrentHashMap<TeamTowerBase, DefenderAI> _def = new ConcurrentHashMap<TeamTowerBase, DefenderAI>();
//private ConcurrentHashMap<TeamTowerBase, MapZone> _mapZone = new ConcurrentHashMap<TeamTowerBase, MapZone>(); //private ConcurrentHashMap<TeamTowerBase, MapZone> _mapZone = new ConcurrentHashMap<TeamTowerBase, MapZone>();
private ConcurrentHashMap<GameTeam, TeamBeacon> _beacons = new ConcurrentHashMap<GameTeam, TeamBeacon>(); private ConcurrentHashMap<GameTeam, List<TeamBeacon>> _beacons = new ConcurrentHashMap<GameTeam, List<TeamBeacon>>();
private OreGenerator _ore; private OreGenerator _ore;
public boolean Attack = false; public boolean Attack = false;
@ -38,20 +38,47 @@ public class TowerManager implements Listener
_ore = new OreGenerator(); _ore = new OreGenerator();
} }
private void makeVulnerable(TeamTowerBase base) private void makeVulnerable(/*TeamTowerBase base*/GameTeam team, boolean core)
{ {
if (base instanceof TeamTower) /*if (base instanceof TeamTower)
_vulnerableTower.put(base.getTeam(), ((TeamTower)base).Number); _vulnerableTower.put(base.getTeam(), ((TeamTower)base).Number);
else else
_vulnerableTower.put(base.getTeam(), 3); _vulnerableTower.put(base.getTeam(), 3);*/
base.setVulnerable(true); List<TeamBeacon> beacon = new ArrayList<TeamBeacon>();
_beacons.get(base.getTeam()).setBlock(base.getBeacon().getBlock()); if (core)
{
for (TeamBeacon tb : _beacons.get(team))
Host.Beacons.remove(tb.getBlock());
_beacons.remove(team);
}
for (TeamTowerBase base : getTeamTowers(team))
{
if (base instanceof TeamTower)
{
base.setVulnerable(!core);
if (!core)
{
beacon.add(new TeamBeacon(team, base.getBeacon().getBlock()));
}
}
}
if (core)
{
getTeamTowers(team).getLast().setVulnerable(true);
beacon.add(new TeamBeacon(team, getTeamTowers(team).getLast().getBeacon().getBlock()));
}
_beacons.put(team, beacon);
for (TeamBeacon tb : beacon)
{
Host.Beacons.put(tb.getBlock(), tb);
}
} }
public void ironOreGen(GameTeam team, boolean start) public void ironOreGen(GameTeam team, boolean start)
{ {
int amount = 10; int amount = 20;
if (start) if (start)
amount = 40; amount = 40;
@ -66,6 +93,11 @@ public class TowerManager implements Listener
_ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.RED_ORE.getKey()), amount); _ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.RED_ORE.getKey()), amount);
else else
_ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.BLUE_ORE.getKey()), amount); _ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.BLUE_ORE.getKey()), amount);
for (Location loc : Host.WorldData.GetCustomLocs(DataLoc.MOSH_IRON.getKey()))
{
loc.getBlock().setType(Material.STONE);
}
} }
else else
{ {
@ -137,10 +169,10 @@ public class TowerManager implements Listener
return i; return i;
} }
public TeamTowerBase getVulnerable(GameTeam team) /*public TeamTowerBase getVulnerable(GameTeam team)
{ {
return getTeamTowers(team).get(_vulnerableTower.get(team) - 1); return getTeamTowers(team).get(_vulnerableTower.get(team) - 1);
} }*/
public void parseTowers(WorldData data) public void parseTowers(WorldData data)
{ {
@ -171,12 +203,12 @@ public class TowerManager implements Listener
_mapZone.put(tower, zone);*/ _mapZone.put(tower, zone);*/
} }
_beacons.put(red, new TeamBeacon(red, getTeamTowers(red).getFirst().getBeacon().getBlock())); makeVulnerable(red, false);
makeVulnerable(blue, false);
/*_beacons.put(red, new TeamBeacon(red, getTeamTowers(red).getFirst().getBeacon().getBlock()));
_beacons.put(blue, new TeamBeacon(blue, getTeamTowers(blue).getFirst().getBeacon().getBlock())); _beacons.put(blue, new TeamBeacon(blue, getTeamTowers(blue).getFirst().getBeacon().getBlock()));
Host.Beacons.put(red, _beacons.get(red)); Host.Beacons.put(red, _beacons.get(red));
Host.Beacons.put(blue, _beacons.get(blue)); Host.Beacons.put(blue, _beacons.get(blue));*/
makeVulnerable(getTeamTowers(red).getFirst());
makeVulnerable(getTeamTowers(blue).getFirst());
ironOreGen(red, true); ironOreGen(red, true);
ironOreGen(blue, true); ironOreGen(blue, true);
} }
@ -199,7 +231,7 @@ public class TowerManager implements Listener
public void handleTowerDeath(TeamTowerBase towerBase) public void handleTowerDeath(TeamTowerBase towerBase)
{ {
towerBase.setVulnerable(false); //towerBase.setVulnerable(false);
//ironOreGen(towerBase.getTeam()); //ironOreGen(towerBase.getTeam());
for (Player player : towerBase.getTeam().GetPlayers(true)) for (Player player : towerBase.getTeam().GetPlayers(true))
{ {
@ -221,6 +253,8 @@ public class TowerManager implements Listener
else else
enemy = Host.GetTeam(ChatColor.RED); enemy = Host.GetTeam(ChatColor.RED);
Host.ScoreboardAutoWrite = false;
Host.writeEndSb(enemy.GetColor() + enemy.getDisplayName());
Host.AnnounceEnd(enemy); Host.AnnounceEnd(enemy);
for (GameTeam team : Host.GetTeamList()) for (GameTeam team : Host.GetTeamList())
@ -243,8 +277,9 @@ public class TowerManager implements Listener
return; return;
} }
TeamTower tower = (TeamTower)towerBase; if (getTeamTowers(towerBase.getTeam()).getFirst().Alive || getTeamTowers(towerBase.getTeam()).get(1).Alive)
makeVulnerable(getTeamTowers(tower.getTeam()).get(tower.Number)); return;
makeVulnerable(towerBase.getTeam(), true);
} }
public void toggleAttack() public void toggleAttack()

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.minecraftleague.variation; package nautilus.game.arcade.game.games.minecraftleague.variation;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague; import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
import nautilus.game.arcade.world.WorldData; import nautilus.game.arcade.world.WorldData;
@ -25,6 +26,11 @@ public abstract class GameVariation implements Listener
} }
public String[] getTeamScoreboardAdditions(GameTeam team)
{
return new String[]{};
}
public void deregister() public void deregister()
{ {
HandlerList.unregisterAll(this); HandlerList.unregisterAll(this);

View File

@ -18,7 +18,7 @@ public class VariationManager implements Listener
private MinecraftLeague _host; private MinecraftLeague _host;
private GameVariation _variation; private GameVariation _variation;
private VariationType _selected; //private VariationType _selected;
public VariationManager(MinecraftLeague host) public VariationManager(MinecraftLeague host)
{ {
@ -26,6 +26,11 @@ public class VariationManager implements Listener
Bukkit.getPluginManager().registerEvents(this, _host.getArcadeManager().getPlugin()); Bukkit.getPluginManager().registerEvents(this, _host.getArcadeManager().getPlugin());
} }
public GameVariation getSelected()
{
return _variation;
}
public void selectVariation() public void selectVariation()
{ {
VariationType type = null; VariationType type = null;
@ -39,7 +44,7 @@ public class VariationManager implements Listener
try try
{ {
_variation = type.getVariation().getConstructor(MinecraftLeague.class).newInstance(_host); _variation = type.getVariation().getConstructor(MinecraftLeague.class).newInstance(_host);
_selected = type; //_selected = type;
} }
catch (NoSuchMethodException ex) catch (NoSuchMethodException ex)
{ {
@ -58,7 +63,7 @@ public class VariationManager implements Listener
return; return;
} }
Bukkit.broadcastMessage(type.getDisplayMessage()); //Bukkit.broadcastMessage(type.getDisplayMessage());
Bukkit.getPluginManager().registerEvents(_variation, _host.getArcadeManager().getPlugin()); Bukkit.getPluginManager().registerEvents(_variation, _host.getArcadeManager().getPlugin());
_variation.ParseData(); _variation.ParseData();
} }
@ -88,7 +93,7 @@ public class VariationManager implements Listener
{ {
if (_variation != null) if (_variation != null)
{ {
event.getPlayer().sendMessage(_selected.getDisplayMessage()); //event.getPlayer().sendMessage(_selected.getDisplayMessage());
} }
} }
} }

View File

@ -77,6 +77,24 @@ public class WitherVariation extends GameVariation
_altars.put(Host.GetTeam(ChatColor.RED), new TeamAltar(this, Host.GetTeam(ChatColor.RED), WorldData.GetDataLocs(DataLoc.RED_ALTAR.getKey()).get(0))); _altars.put(Host.GetTeam(ChatColor.RED), new TeamAltar(this, Host.GetTeam(ChatColor.RED), WorldData.GetDataLocs(DataLoc.RED_ALTAR.getKey()).get(0)));
} }
@Override
public String[] getTeamScoreboardAdditions(GameTeam team)
{
String skulls = "☠ ☠ ☠";
for (int i = 1; i < 4; i++)
{
if (!skulls.equalsIgnoreCase(""))
skulls = skulls + " ";
if (_altars.get(team).getPlacedSkulls() >= i)
skulls = skulls + ChatColor.GREEN + "";
else
skulls = skulls + ChatColor.GRAY + "";
}
return new String[] {"Altar Skulls: " + skulls};
}
private Location getNearest(Location to, ConcurrentHashMap<Location, Double> options) private Location getNearest(Location to, ConcurrentHashMap<Location, Double> options)
{ {
Location ret = null; Location ret = null;
@ -213,6 +231,13 @@ public class WitherVariation extends GameVariation
Host.Objective.resetPlayerToMainObjective(player); Host.Objective.resetPlayerToMainObjective(player);
}*/ }*/
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
{
public void run()
{
Host.CreatureAllowOverride = false;
}
}, 20 * 3);
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
{ {
public void run() public void run()
{ {
@ -258,20 +283,26 @@ public class WitherVariation extends GameVariation
{ {
event.setCancelled(true); event.setCancelled(true);
TeamTowerBase red = Host.getActiveTower(Host.GetTeam(ChatColor.RED)); LinkedList<TeamTowerBase> red = Host.getTowerManager().getTeamTowers(Host.GetTeam(ChatColor.RED));
TeamTowerBase blue = Host.getActiveTower(Host.GetTeam(ChatColor.AQUA)); LinkedList<TeamTowerBase> blue = Host.getTowerManager().getTeamTowers(Host.GetTeam(ChatColor.AQUA));
HashMap<Block, Double> inside = UtilBlock.getInRadius(event.getLocation().getBlock(), 4, false); HashMap<Block, Double> inside = UtilBlock.getInRadius(event.getLocation().getBlock(), 4, false);
double dmg = 20 * (Host.GetTeam(ChatColor.RED).GetPlayers(true).size() + Host.GetTeam(ChatColor.RED).GetPlayers(true).size()); double dmg = 10 * (Host.GetTeam(ChatColor.RED).GetPlayers(true).size() + Host.GetTeam(ChatColor.RED).GetPlayers(true).size());
if (inside.containsKey(red.getLocation().getBlock())) for (TeamTowerBase tb : red)
{ {
red.damage(dmg, null); if (inside.containsKey(tb.getLocation().getBlock()))
Host.Alert.alert(red.getTeam(), red); {
tb.damage(dmg, null);
Host.Alert.alert(tb.getTeam(), tb);
}
} }
if (inside.containsKey(blue.getLocation().getBlock())) for (TeamTowerBase tb : blue)
{ {
blue.damage(dmg, null); if (inside.containsKey(tb.getLocation().getBlock()))
Host.Alert.alert(blue.getTeam(), blue); {
tb.damage(dmg, null);
Host.Alert.alert(tb.getTeam(), tb);
}
} }
for (Block b : inside.keySet()) for (Block b : inside.keySet())
{ {
@ -285,23 +316,29 @@ public class WitherVariation extends GameVariation
} }
for (GameTeam owner : Host.GetTeamList()) for (GameTeam owner : Host.GetTeamList())
{ {
if (Host.getActiveTower(owner).getLocation().distance(b.getLocation()) < 7) for (TeamTowerBase tb : Host.getTowerManager().getTeamTowers(owner))
{ {
if (b.getType() == Material.BEDROCK) if (!tb.Vulnerable)
continue; continue;
if (b.getType() == Material.OBSIDIAN)
{ if (tb.getLocation().distance(b.getLocation()) < 7)
if (new Random().nextDouble() > (.75 / 2)) {
if (b.getType() == Material.BEDROCK)
continue; continue;
if (b.getType() == Material.OBSIDIAN)
{
if (new Random().nextDouble() > (.75 / 2))
continue;
}
if (b.getType() == Material.AIR)
continue;
if (b.getType() == Material.STATIONARY_WATER || b.getType() == Material.WATER)
continue;
if (b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA)
continue;
//WorldData.World.dropItem(b.getLocation(), new ItemBuilder(b.getType()).setData(b.getData()).build());
b.setType(Material.AIR);
} }
if (b.getType() == Material.AIR)
continue;
if (b.getType() == Material.STATIONARY_WATER || b.getType() == Material.WATER)
continue;
if (b.getType() == Material.STATIONARY_LAVA || b.getType() == Material.LAVA)
continue;
//WorldData.World.dropItem(b.getLocation(), new ItemBuilder(b.getType()).setData(b.getData()).build());
b.setType(Material.AIR);
} }
} }
} }

View File

@ -170,6 +170,10 @@ public class TeamAltar
scare.playSound(scare.getLocation(), Sound.WITHER_SPAWN, 10, 0); scare.playSound(scare.getLocation(), Sound.WITHER_SPAWN, 10, 0);
} }
} }
else
{
_host.Host.CreatureAllowOverride = true;
}
_placed++; _placed++;
} }
} }
@ -191,4 +195,9 @@ public class TeamAltar
{ {
return _center.clone(); return _center.clone();
} }
public int getPlacedSkulls()
{
return _placed;
}
} }

View File

@ -223,7 +223,7 @@ public class WitherMinionManager implements Listener
{ {
if (secLeft > 0) if (secLeft > 0)
{ {
UtilTextMiddle.display(C.cGold + secLeft + " Seconds", "Until Wither Skeleton Spawn"); UtilTextMiddle.display(secLeft + " Seconds", "Until Wither Skeleton Spawn");
} }
} }
} }
@ -375,14 +375,14 @@ public class WitherMinionManager implements Listener
{ {
public void run() public void run()
{ {
UtilTextMiddle.display("", C.cGold + "Place the skull on top of", event.getPlayer()); UtilTextMiddle.display("", "Place the skull on top of", event.getPlayer());
} }
}, 20 * 5); }, 20 * 5);
Bukkit.getScheduler().runTaskLater(_host.Manager.getPlugin(), new Runnable() Bukkit.getScheduler().runTaskLater(_host.Manager.getPlugin(), new Runnable()
{ {
public void run() public void run()
{ {
UtilTextMiddle.display("", C.cGold + "Your Altar's Soul Sand!", event.getPlayer()); UtilTextMiddle.display("", "Your Altar's Soul Sand!", event.getPlayer());
} }
}, 20 * 8); }, 20 * 8);
//_host.Host.Objective.setPlayerObjective(event.getPlayer(), new ReturnSkullObjective()); //_host.Host.Objective.setPlayerObjective(event.getPlayer(), new ReturnSkullObjective());

View File

@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilTime.TimeUnit;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minecraftleague.DataLoc; import nautilus.game.arcade.game.games.minecraftleague.DataLoc;
import nautilus.game.arcade.game.games.minecraftleague.data.TeamTower; import nautilus.game.arcade.game.games.minecraftleague.data.TeamTower;
import nautilus.game.arcade.game.games.minecraftleague.data.TeamTowerBase;
import nautilus.game.arcade.game.games.minecraftleague.data.TowerManager; import nautilus.game.arcade.game.games.minecraftleague.data.TowerManager;
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.WitherVariation; import nautilus.game.arcade.game.games.minecraftleague.variation.wither.WitherVariation;
@ -132,6 +133,16 @@ public class WitherPathfinder
//skull.setDirection(UtilAlg.getTrajectory(_ent.getLocation(), loc).normalize()); //skull.setDirection(UtilAlg.getTrajectory(_ent.getLocation(), loc).normalize());
} }
private TeamTowerBase getProperTarget()
{
for (TeamTowerBase t : _towerManager.getTeamTowers(_enemy))
{
if (t.Alive)
return t;
}
return null;
}
/** /**
* Returns true if the entity is dead or invalid * Returns true if the entity is dead or invalid
*/ */
@ -140,7 +151,7 @@ public class WitherPathfinder
if ((_ent == null) || _ent.isDead() || !_ent.isValid()) if ((_ent == null) || _ent.isDead() || !_ent.isValid())
return true; return true;
Entity eTower = _towerManager.getVulnerable(_enemy).getEntity(); Entity eTower = getProperTarget().getEntity();
if (eTower == null || !eTower.isValid() || eTower.isDead()) if (eTower == null || !eTower.isValid() || eTower.isDead())
{ {
_ent.remove(); _ent.remove();
@ -185,8 +196,8 @@ public class WitherPathfinder
if (_team.GetColor() == ChatColor.AQUA) if (_team.GetColor() == ChatColor.AQUA)
tName = "BLUE"; tName = "BLUE";
Integer cNumber = -1; Integer cNumber = -1;
if (_towerManager.getVulnerable(_enemy) instanceof TeamTower) if (getProperTarget() instanceof TeamTower)
cNumber = ((TeamTower)_towerManager.getVulnerable(_enemy)).Number; cNumber = ((TeamTower)getProperTarget()).Number;
else else
cNumber = 3; cNumber = 3;
Location finalize = _host.Host.WorldData.GetCustomLocs(DataLoc.TOWER_WAYPOINT.getKey().replace("$team$", tName).replace("$number$", cNumber + "")).get(0); Location finalize = _host.Host.WorldData.GetCustomLocs(DataLoc.TOWER_WAYPOINT.getKey().replace("$team$", tName).replace("$number$", cNumber + "")).get(0);

View File

@ -13,6 +13,7 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.common.util.UtilTime.TimeUnit;
@ -965,14 +966,14 @@ public class GameFlagManager implements Listener
} }
else else
{ {
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.VOID, 9001, false, false, false,
"Border", "Border Damage");
if (!Manager.GetDamage().IsEnabled()) if (!Manager.GetDamage().IsEnabled())
{ {
Bukkit.getPluginManager().callEvent(new EntityDamageEvent(player, DamageCause.VOID, 9001)); Bukkit.getPluginManager().callEvent(new EntityDamageEvent(player, DamageCause.VOID, 9001));
} }
Manager.GetDamage().NewDamageEvent(player, null, null,
DamageCause.VOID, 9001, false, false, false,
"Border", "Border Damage");
} }
} }
@ -1291,7 +1292,7 @@ public class GameFlagManager implements Listener
continue; continue;
} }
long sec = UtilTime.convert(_respawnTimers.get(player) - System.currentTimeMillis(), TimeUnit.MILLISECONDS, TimeUnit.SECONDS); long sec = UtilTime.convert(_respawnTimers.get(player) - System.currentTimeMillis(), TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
UtilTextMiddle.display("Respawning In", sec + " Seconds", player); UtilTextBottom.display("Respawning In: " + sec + " Seconds", player);
} }
} }
} }