From d8f5ac66fc1e8cfd49f179401e9d1b8b425d07c1 Mon Sep 17 00:00:00 2001 From: AlexTheCoder Date: Sat, 16 Apr 2016 14:05:46 -0400 Subject: [PATCH] - More chiss --- .../minecraftleague/MinecraftLeague.java | 157 ++++++++++++------ .../commands/panel/AdminPanel.java | 16 +- .../minecraftleague/data/DefenderAI.java | 2 +- .../minecraftleague/data/OreGenerator.java | 2 + .../minecraftleague/data/TeamBeacon.java | 7 +- .../minecraftleague/data/TeamTowerBase.java | 18 +- .../minecraftleague/data/TowerManager.java | 71 ++++++-- .../variation/GameVariation.java | 6 + .../variation/VariationManager.java | 13 +- .../variation/wither/WitherVariation.java | 83 ++++++--- .../variation/wither/data/TeamAltar.java | 9 + .../wither/data/WitherMinionManager.java | 6 +- .../wither/data/WitherPathfinder.java | 17 +- .../game/arcade/managers/GameFlagManager.java | 11 +- 14 files changed, 298 insertions(+), 120 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java index c0b35f088..2e659e938 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/MinecraftLeague.java @@ -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.Spawner; 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.TowerAlert; import nautilus.game.arcade.game.games.minecraftleague.data.TowerManager; @@ -103,7 +103,7 @@ public class MinecraftLeague extends TeamGame //private ConcurrentHashMap _customRespawns = new ConcurrentHashMap(); //private ConcurrentHashMap _maps = new ConcurrentHashMap(); private ConcurrentHashMap> _gear = new ConcurrentHashMap>(); - public ConcurrentHashMap Beacons = new ConcurrentHashMap(); + public ConcurrentHashMap Beacons = new ConcurrentHashMap(); //public ConcurrentHashMap TeamPoison = new ConcurrentHashMap(); private ConcurrentHashMap _blockLock = new ConcurrentHashMap(); //private ConcurrentHashMap _spawnAllow = new ConcurrentHashMap(); @@ -115,6 +115,7 @@ public class MinecraftLeague extends TeamGame private MinecraftLeagueCommand _cmd; private long _lastIncrease; private long _lastOreReset; + private long _lastGrindReset; private boolean _yellow = false; public List MapZones = new ArrayList(); @@ -126,6 +127,7 @@ public class MinecraftLeague extends TeamGame private FreezeManager _freeze; private TowerManager _tower; public TowerAlert Alert; + public boolean ScoreboardAutoWrite = true; //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; } - public TeamTowerBase getActiveTower(GameTeam team) + //public TeamTowerBase getActiveTower(GameTeam team) { - return _tower.getVulnerable(team); + //return _tower.getVulnerable(team); } public TowerManager getTowerManager() @@ -454,10 +456,25 @@ public class MinecraftLeague extends TeamGame @EventHandler public void ScoreboardUpdate(UpdateEvent event) { + if (!ScoreboardAutoWrite) + return; + if (event.getType() == UpdateType.FAST || 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) { if (!InProgress()) @@ -492,26 +509,30 @@ public class MinecraftLeague extends TeamGame GameTeam red = GetTeam(ChatColor.RED); GameTeam blue = GetTeam(ChatColor.AQUA); - TeamTowerBase redt = _tower.getVulnerable(red); - TeamTowerBase bluet = _tower.getVulnerable(blue); - String reds = "First Tower"; - String blues = "First Tower"; - - if (redt instanceof TeamTower) + String reds = ""; + String blues = ""; + for (TeamTowerBase tb : _tower.getTeamTowers(red)) { - if (((TeamTower)redt).Number > 1) - reds = "Second Tower"; + if (!reds.equalsIgnoreCase("")) + reds = reds + " "; + + String symbol = "♛"; + if (tb instanceof TeamCrystal) + symbol = "♚"; + + reds = reds + tb.getHealthColor() + symbol; } - else - reds = "Core"; - - if (bluet instanceof TeamTower) + for (TeamTowerBase tb : _tower.getTeamTowers(blue)) { - if (((TeamTower)bluet).Number > 1) - blues = "Second Tower"; + if (!blues.equalsIgnoreCase("")) + blues = blues + " "; + + String symbol = "♛"; + if (tb instanceof TeamCrystal) + symbol = "♚"; + + blues = blues + tb.getHealthColor() + symbol; } - else - blues = "Core"; _liveTime = Math.max(System.currentTimeMillis() - GetStateTime(), 0); @@ -525,13 +546,19 @@ public class MinecraftLeague extends TeamGame Scoreboard.WriteBlank(); Scoreboard.Write(C.cRedB + "Red Team"); - Scoreboard.Write(reds + ": " + redt.formatHealth(redt.getHealth())); - Scoreboard.Write("Players Alive: " + red.GetPlayers(true).size()); + Scoreboard.Write("Towers: " + reds); + for (String s : _vman.getSelected().getTeamScoreboardAdditions(red)) + { + Scoreboard.Write(s); + } Scoreboard.WriteBlank(); Scoreboard.Write(C.cAquaB + "Blue Team"); - Scoreboard.Write(blues + ": " + bluet.formatHealth(bluet.getHealth())); - Scoreboard.Write("Players Alive: " + blue.GetPlayers(true).size()); + Scoreboard.Write("Towers: " + blues); + for (String s : _vman.getSelected().getTeamScoreboardAdditions(blue)) + { + Scoreboard.Write(s); + } int i = 1; for (ExtraScoreboardData sbD : ExtraSb.keySet()) @@ -565,7 +592,7 @@ public class MinecraftLeague extends TeamGame { 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, C.cGray + "Health: " + tower.getHealth()); UtilPlayer.message(caller, C.cGray + "Alive: " + tower.Alive); @@ -623,6 +650,7 @@ public class MinecraftLeague extends TeamGame { _lastIncrease = System.currentTimeMillis(); _lastOreReset = System.currentTimeMillis(); + _lastGrindReset = System.currentTimeMillis() - UtilTime.convert(30, TimeUnit.SECONDS, TimeUnit.MILLISECONDS); Manager.GetExplosion().setEnabled(false); Manager.GetDamage().SetEnabled(false); Manager.GetCreature().SetForce(false); @@ -779,30 +807,34 @@ public class MinecraftLeague extends TeamGame 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; - int chicken = 0; - for (LivingEntity le : UtilEnt.getInRadius(grind, 15).keySet()) + _lastGrindReset = System.currentTimeMillis(); + for (Location grind : WorldData.GetCustomLocs(DataLoc.GRIND_AREA.getKey())) { - if (le.getType() == EntityType.SPIDER) - spider++; - if (le.getType() == EntityType.CHICKEN) - chicken++; - } - while (spider < 5) - { - spider++; - CreatureAllowOverride = true; - Manager.GetCreature().SpawnEntity(grind, EntityType.SPIDER); - CreatureAllowOverride = false; - } - while (chicken < 10) - { - chicken++; - CreatureAllowOverride = true; - Manager.GetCreature().SpawnEntity(grind, EntityType.CHICKEN); - CreatureAllowOverride = false; + int spider = 0; + int chicken = 0; + for (LivingEntity le : UtilEnt.getInRadius(grind, 15).keySet()) + { + if (le.getType() == EntityType.SPIDER) + spider++; + if (le.getType() == EntityType.CHICKEN) + chicken++; + } + while (spider < 5) + { + spider = 5; + CreatureAllowOverride = true; + Manager.GetCreature().SpawnEntity(grind, EntityType.SPIDER); + CreatureAllowOverride = false; + } + while (chicken < 10) + { + 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; - while (arrowsToAdd >= 1) + //int arrowsToAdd = UtilInv.getAmount(player, Material.ARROW) / 2; + //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); - gear.add(new ItemStack(Material.ARROW, subtract)); - arrowsToAdd -= subtract; + for (ItemStack arrow : UtilInv.getItems(player)) + { + if (arrow.getType() == Material.ARROW) + { + gear.add(arrow); + } + } } _gear.put(player, gear); @@ -1505,6 +1547,8 @@ public class MinecraftLeague extends TeamGame return; if (!(event.getEntity() instanceof Player)) return; + if (UtilPlayer.isSpectator(event.getEntity())) + return; Player player = (Player)event.getEntity(); storeGear(player); @@ -1590,7 +1634,14 @@ public class MinecraftLeague extends TeamGame { 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) { event.setCancelled(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/commands/panel/AdminPanel.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/commands/panel/AdminPanel.java index 03b2d274b..83db013c1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/commands/panel/AdminPanel.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/commands/panel/AdminPanel.java @@ -42,15 +42,15 @@ public class AdminPanel implements Listener _slots = new ConcurrentHashMap(); ItemStack red = new ItemBuilder(MenuButton.CRYSTAL.getRepresentation()) - .setTitle(C.cRed + "Red Tower") - .setLore(C.cGray + "Alive: " + host.getActiveTower(host.GetTeam(ChatColor.RED)).Alive, - C.cGray + "Health: " + host.getActiveTower(host.GetTeam(ChatColor.RED)).getHealth()) + .setTitle(C.cRed + "Red Core") + .setLore(C.cGray + "Alive: " + host.getTowerManager().getTeamTowers(host.GetTeam(ChatColor.RED)).getLast().Alive, + C.cGray + "Health: " + host.getTowerManager().getTeamTowers(host.GetTeam(ChatColor.RED)).getLast().getHealth()) .build(); ItemStack blue = new ItemBuilder(MenuButton.CRYSTAL.getRepresentation()) - .setTitle(C.cAqua + "Blue Tower") - .setLore(C.cGray + "Alive: " + host.getActiveTower(host.GetTeam(ChatColor.AQUA)).Alive, - C.cGray + "Health: " + host.getActiveTower(host.GetTeam(ChatColor.AQUA)).getHealth()) + .setTitle(C.cAqua + "Blue Core") + .setLore(C.cGray + "Alive: " + host.getTowerManager().getTeamTowers(host.GetTeam(ChatColor.AQUA)).getLast().Alive, + C.cGray + "Health: " + host.getTowerManager().getTeamTowers(host.GetTeam(ChatColor.AQUA)).getLast().getHealth()) .build(); _buttons.put(red, host.GetTeam(ChatColor.RED)); @@ -75,8 +75,8 @@ public class AdminPanel implements Listener GameTeam team = _buttons.get(item); ItemMeta im = item.getItemMeta(); List lore = new ArrayList(); - lore.add(C.cGray + "Alive: " + _host.getActiveTower(team).Alive); - lore.add(C.cGray + "Health: " + _host.getActiveTower(team).getHealth()); + lore.add(C.cGray + "Alive: " + _host.getTowerManager().getTeamTowers(team).getLast().Alive); + lore.add(C.cGray + "Health: " + _host.getTowerManager().getTeamTowers(team).getLast().getHealth()); im.setLore(lore); item.setItemMeta(im); _buttons.remove(item); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/DefenderAI.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/DefenderAI.java index 63d17444a..ee1d7f1c6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/DefenderAI.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/DefenderAI.java @@ -169,7 +169,7 @@ public class DefenderAI private void drawBeam() { 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(); while (UtilMath.offset(base, target) > UtilMath.offset(base, display)) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/OreGenerator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/OreGenerator.java index bde64fddb..c2caae839 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/OreGenerator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/OreGenerator.java @@ -24,6 +24,8 @@ public class OreGenerator } for (int i = 0; i < (amount + 1); i++) { + if (_choices.size() == 0) + continue; Location selected = _choices.remove(UtilMath.random.nextInt(_choices.size())); selected.getBlock().setType(oreType); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TeamBeacon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TeamBeacon.java index 917fa00b3..55d16241c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TeamBeacon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TeamBeacon.java @@ -35,9 +35,14 @@ public class TeamBeacon return false; }*/ - public void setBlock(Block block) + /*public void setBlock(Block block) { _block = block; + }*/ + + public Block getBlock() + { + return _block; } public void update() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TeamTowerBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TeamTowerBase.java index 3b452886b..4edfa82b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TeamTowerBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TeamTowerBase.java @@ -18,6 +18,7 @@ import nautilus.game.arcade.game.games.minecraftleague.DataLoc; import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -134,7 +135,7 @@ public abstract class TeamTowerBase { 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); } @@ -219,6 +220,21 @@ public abstract class TeamTowerBase 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) { if (!Vulnerable) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java index 493221319..ec9b188bd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/data/TowerManager.java @@ -7,8 +7,8 @@ import java.util.List; import java.util.concurrent.ConcurrentHashMap; import mineplex.core.common.util.UtilTextMiddle; -import nautilus.game.arcade.game.GameTeam; 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.MinecraftLeague; import nautilus.game.arcade.world.WorldData; @@ -25,10 +25,10 @@ public class TowerManager implements Listener { public MinecraftLeague Host; private ConcurrentHashMap _towers = new ConcurrentHashMap(); - private ConcurrentHashMap _vulnerableTower = new ConcurrentHashMap(); + //private ConcurrentHashMap _vulnerableTower = new ConcurrentHashMap(); private ConcurrentHashMap _def = new ConcurrentHashMap(); //private ConcurrentHashMap _mapZone = new ConcurrentHashMap(); - private ConcurrentHashMap _beacons = new ConcurrentHashMap(); + private ConcurrentHashMap> _beacons = new ConcurrentHashMap>(); private OreGenerator _ore; public boolean Attack = false; @@ -38,20 +38,47 @@ public class TowerManager implements Listener _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); else - _vulnerableTower.put(base.getTeam(), 3); + _vulnerableTower.put(base.getTeam(), 3);*/ - base.setVulnerable(true); - _beacons.get(base.getTeam()).setBlock(base.getBeacon().getBlock()); + List beacon = new ArrayList(); + 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) { - int amount = 10; + int amount = 20; if (start) amount = 40; @@ -66,6 +93,11 @@ public class TowerManager implements Listener _ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.RED_ORE.getKey()), amount); else _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 { @@ -137,10 +169,10 @@ public class TowerManager implements Listener return i; } - public TeamTowerBase getVulnerable(GameTeam team) + /*public TeamTowerBase getVulnerable(GameTeam team) { return getTeamTowers(team).get(_vulnerableTower.get(team) - 1); - } + }*/ public void parseTowers(WorldData data) { @@ -171,12 +203,12 @@ public class TowerManager implements Listener _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())); Host.Beacons.put(red, _beacons.get(red)); - Host.Beacons.put(blue, _beacons.get(blue)); - makeVulnerable(getTeamTowers(red).getFirst()); - makeVulnerable(getTeamTowers(blue).getFirst()); + Host.Beacons.put(blue, _beacons.get(blue));*/ ironOreGen(red, true); ironOreGen(blue, true); } @@ -199,7 +231,7 @@ public class TowerManager implements Listener public void handleTowerDeath(TeamTowerBase towerBase) { - towerBase.setVulnerable(false); + //towerBase.setVulnerable(false); //ironOreGen(towerBase.getTeam()); for (Player player : towerBase.getTeam().GetPlayers(true)) { @@ -221,6 +253,8 @@ public class TowerManager implements Listener else enemy = Host.GetTeam(ChatColor.RED); + Host.ScoreboardAutoWrite = false; + Host.writeEndSb(enemy.GetColor() + enemy.getDisplayName()); Host.AnnounceEnd(enemy); for (GameTeam team : Host.GetTeamList()) @@ -243,8 +277,9 @@ public class TowerManager implements Listener return; } - TeamTower tower = (TeamTower)towerBase; - makeVulnerable(getTeamTowers(tower.getTeam()).get(tower.Number)); + if (getTeamTowers(towerBase.getTeam()).getFirst().Alive || getTeamTowers(towerBase.getTeam()).get(1).Alive) + return; + makeVulnerable(towerBase.getTeam(), true); } public void toggleAttack() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/GameVariation.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/GameVariation.java index a1efa8a2c..3b713809f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/GameVariation.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/GameVariation.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.minecraftleague.variation; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague; 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() { HandlerList.unregisterAll(this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/VariationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/VariationManager.java index 2b7a4630b..fc392060e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/VariationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/VariationManager.java @@ -18,7 +18,7 @@ public class VariationManager implements Listener private MinecraftLeague _host; private GameVariation _variation; - private VariationType _selected; + //private VariationType _selected; public VariationManager(MinecraftLeague host) { @@ -26,6 +26,11 @@ public class VariationManager implements Listener Bukkit.getPluginManager().registerEvents(this, _host.getArcadeManager().getPlugin()); } + public GameVariation getSelected() + { + return _variation; + } + public void selectVariation() { VariationType type = null; @@ -39,7 +44,7 @@ public class VariationManager implements Listener try { _variation = type.getVariation().getConstructor(MinecraftLeague.class).newInstance(_host); - _selected = type; + //_selected = type; } catch (NoSuchMethodException ex) { @@ -58,7 +63,7 @@ public class VariationManager implements Listener return; } - Bukkit.broadcastMessage(type.getDisplayMessage()); + //Bukkit.broadcastMessage(type.getDisplayMessage()); Bukkit.getPluginManager().registerEvents(_variation, _host.getArcadeManager().getPlugin()); _variation.ParseData(); } @@ -88,7 +93,7 @@ public class VariationManager implements Listener { if (_variation != null) { - event.getPlayer().sendMessage(_selected.getDisplayMessage()); + //event.getPlayer().sendMessage(_selected.getDisplayMessage()); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/WitherVariation.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/WitherVariation.java index bdfd42dd1..7ac0dd513 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/WitherVariation.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/WitherVariation.java @@ -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))); } + @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 options) { Location ret = null; @@ -213,6 +231,13 @@ public class WitherVariation extends GameVariation Host.Objective.resetPlayerToMainObjective(player); }*/ 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() { @@ -258,20 +283,26 @@ public class WitherVariation extends GameVariation { event.setCancelled(true); - TeamTowerBase red = Host.getActiveTower(Host.GetTeam(ChatColor.RED)); - TeamTowerBase blue = Host.getActiveTower(Host.GetTeam(ChatColor.AQUA)); + LinkedList red = Host.getTowerManager().getTeamTowers(Host.GetTeam(ChatColor.RED)); + LinkedList blue = Host.getTowerManager().getTeamTowers(Host.GetTeam(ChatColor.AQUA)); HashMap 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()); - if (inside.containsKey(red.getLocation().getBlock())) + double dmg = 10 * (Host.GetTeam(ChatColor.RED).GetPlayers(true).size() + Host.GetTeam(ChatColor.RED).GetPlayers(true).size()); + for (TeamTowerBase tb : red) { - red.damage(dmg, null); - Host.Alert.alert(red.getTeam(), red); + if (inside.containsKey(tb.getLocation().getBlock())) + { + tb.damage(dmg, null); + Host.Alert.alert(tb.getTeam(), tb); + } } - if (inside.containsKey(blue.getLocation().getBlock())) + for (TeamTowerBase tb : blue) { - blue.damage(dmg, null); - Host.Alert.alert(blue.getTeam(), blue); + if (inside.containsKey(tb.getLocation().getBlock())) + { + tb.damage(dmg, null); + Host.Alert.alert(tb.getTeam(), tb); + } } for (Block b : inside.keySet()) { @@ -285,23 +316,29 @@ public class WitherVariation extends GameVariation } for (GameTeam owner : Host.GetTeamList()) { - if (Host.getActiveTower(owner).getLocation().distance(b.getLocation()) < 7) - { - if (b.getType() == Material.BEDROCK) + for (TeamTowerBase tb : Host.getTowerManager().getTeamTowers(owner)) + { + if (!tb.Vulnerable) continue; - if (b.getType() == Material.OBSIDIAN) - { - if (new Random().nextDouble() > (.75 / 2)) + + if (tb.getLocation().distance(b.getLocation()) < 7) + { + if (b.getType() == Material.BEDROCK) 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); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/TeamAltar.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/TeamAltar.java index 0834d76b2..b3e284132 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/TeamAltar.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/TeamAltar.java @@ -170,6 +170,10 @@ public class TeamAltar scare.playSound(scare.getLocation(), Sound.WITHER_SPAWN, 10, 0); } } + else + { + _host.Host.CreatureAllowOverride = true; + } _placed++; } } @@ -191,4 +195,9 @@ public class TeamAltar { return _center.clone(); } + + public int getPlacedSkulls() + { + return _placed; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherMinionManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherMinionManager.java index 218eff1fb..8f51d79ef 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherMinionManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherMinionManager.java @@ -223,7 +223,7 @@ public class WitherMinionManager implements Listener { 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() { - UtilTextMiddle.display("", C.cGold + "Place the skull on top of", event.getPlayer()); + UtilTextMiddle.display("", "Place the skull on top of", event.getPlayer()); } }, 20 * 5); Bukkit.getScheduler().runTaskLater(_host.Manager.getPlugin(), new Runnable() { 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); //_host.Host.Objective.setPlayerObjective(event.getPlayer(), new ReturnSkullObjective()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherPathfinder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherPathfinder.java index 074e0fb15..b380b9ba1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherPathfinder.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minecraftleague/variation/wither/data/WitherPathfinder.java @@ -12,6 +12,7 @@ import mineplex.core.common.util.UtilTime.TimeUnit; import nautilus.game.arcade.game.GameTeam; 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.TeamTowerBase; import nautilus.game.arcade.game.games.minecraftleague.data.TowerManager; 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()); } + 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 */ @@ -140,7 +151,7 @@ public class WitherPathfinder if ((_ent == null) || _ent.isDead() || !_ent.isValid()) return true; - Entity eTower = _towerManager.getVulnerable(_enemy).getEntity(); + Entity eTower = getProperTarget().getEntity(); if (eTower == null || !eTower.isValid() || eTower.isDead()) { _ent.remove(); @@ -185,8 +196,8 @@ public class WitherPathfinder if (_team.GetColor() == ChatColor.AQUA) tName = "BLUE"; Integer cNumber = -1; - if (_towerManager.getVulnerable(_enemy) instanceof TeamTower) - cNumber = ((TeamTower)_towerManager.getVulnerable(_enemy)).Number; + if (getProperTarget() instanceof TeamTower) + cNumber = ((TeamTower)getProperTarget()).Number; else cNumber = 3; Location finalize = _host.Host.WorldData.GetCustomLocs(DataLoc.TOWER_WAYPOINT.getKey().replace("$team$", tName).replace("$number$", cNumber + "")).get(0); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index e406623c2..9b550b070 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -13,6 +13,7 @@ import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; @@ -965,14 +966,14 @@ public class GameFlagManager implements Listener } else { - Manager.GetDamage().NewDamageEvent(player, null, null, - DamageCause.VOID, 9001, false, false, false, - "Border", "Border Damage"); - if (!Manager.GetDamage().IsEnabled()) { 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; } 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); } } } \ No newline at end of file