- Lots of polish
This commit is contained in:
parent
2530bc512e
commit
40175db217
@ -15,6 +15,8 @@ public enum DataLoc
|
||||
//MAP_IRON("SILVER"),
|
||||
RED_ORE("15"),
|
||||
BLUE_ORE("14"),
|
||||
DIAMOND_ORE("56"),
|
||||
COAL_ORE("16"),
|
||||
|
||||
//Wither
|
||||
WITHER_WAYPOINT("PURPLE"),
|
||||
|
@ -33,12 +33,15 @@ import nautilus.game.arcade.game.games.minecraftleague.commands.freeze.FreezeMan
|
||||
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.TeamTowerBase;
|
||||
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.map.ItemMapManager;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.data.objectives.GearObjective;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.kit.KitPlayer;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.objective.ObjectiveManager;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.ExtraScoreboardData;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.GameVariation;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.VariationManager;
|
||||
@ -95,7 +98,7 @@ public class MinecraftLeague extends TeamGame
|
||||
//private ConcurrentHashMap<Player, PlayerRespawnPoint> _customRespawns = new ConcurrentHashMap<Player, PlayerRespawnPoint>();
|
||||
//private ConcurrentHashMap<GameTeam, TeamMap> _maps = new ConcurrentHashMap<GameTeam, TeamMap>();
|
||||
private ConcurrentHashMap<Player, List<ItemStack>> _gear = new ConcurrentHashMap<Player, List<ItemStack>>();
|
||||
//private ConcurrentHashMap<GameTeam, TeamBeacon> _beacons = new ConcurrentHashMap<GameTeam, TeamBeacon>();
|
||||
public ConcurrentHashMap<GameTeam, TeamBeacon> Beacons = new ConcurrentHashMap<GameTeam, TeamBeacon>();
|
||||
private ConcurrentHashMap<Player, BlockProtection> _blockLock = new ConcurrentHashMap<Player, BlockProtection>();
|
||||
//private ConcurrentHashMap<Player, Long> _spawnAllow = new ConcurrentHashMap<Player, Long>();
|
||||
private List<Spawner> _spawners = new ArrayList<Spawner>();
|
||||
@ -105,6 +108,7 @@ public class MinecraftLeague extends TeamGame
|
||||
private long _liveTime = 0;
|
||||
private MinecraftLeagueCommand _cmd;
|
||||
private long _lastIncrease;
|
||||
private long _lastOreReset;
|
||||
private boolean _yellow = false;
|
||||
|
||||
public List<MapZone> MapZones = new ArrayList<MapZone>();
|
||||
@ -112,6 +116,7 @@ public class MinecraftLeague extends TeamGame
|
||||
public boolean OverTime = false;
|
||||
|
||||
private VariationManager _vman;
|
||||
public ObjectiveManager Objective;
|
||||
private FreezeManager _freeze;
|
||||
private TowerManager _tower;
|
||||
public TowerAlert Alert;
|
||||
@ -139,7 +144,7 @@ public class MinecraftLeague extends TeamGame
|
||||
this.DeathOut = false;
|
||||
this.DamageSelf = false;
|
||||
this.DeathSpectateSecs = 5;
|
||||
this.WorldBoundaryKill = false;
|
||||
this.WorldBoundaryKill = true;
|
||||
this.DeathDropItems = true;
|
||||
this.CreatureAllow = true;
|
||||
this.HungerSet = 20;
|
||||
@ -168,7 +173,7 @@ public class MinecraftLeague extends TeamGame
|
||||
|
||||
_help = new String[]
|
||||
{
|
||||
"Respawn Crystals have 100 health per person in-game!",
|
||||
"Respawn Crystals have 150 health per person in-game!",
|
||||
"The better the sword you have, the more damage you deal to Respawn Crystals!",
|
||||
//"Right-click a bed in order to change your personal spawn location!",
|
||||
"Your map will display the locations of your enemies in OverTime!"
|
||||
@ -180,6 +185,7 @@ public class MinecraftLeague extends TeamGame
|
||||
);
|
||||
|
||||
_vman = new VariationManager(this);
|
||||
Objective = new ObjectiveManager(this);
|
||||
_freeze = new FreezeManager();
|
||||
_tower = new TowerManager(this);
|
||||
Alert = new TowerAlert();
|
||||
@ -285,6 +291,8 @@ public class MinecraftLeague extends TeamGame
|
||||
|
||||
if (ret.getType() == Material.MAP)
|
||||
ret = new ItemStack(Material.AIR);
|
||||
if (UtilItem.isTool(ret))
|
||||
ret = new ItemStack(ret.getType());
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -420,6 +428,15 @@ public class MinecraftLeague extends TeamGame
|
||||
Ore.add(new OreDeposit(loc, Material.IRON_ORE, new int[] {190, 190, 190}));
|
||||
}*/
|
||||
|
||||
for (Location diamond : WorldData.GetCustomLocs(DataLoc.DIAMOND_ORE.getKey()))
|
||||
{
|
||||
diamond.getBlock().setType(Material.DIAMOND_ORE);
|
||||
}
|
||||
for (Location coal : WorldData.GetCustomLocs(DataLoc.COAL_ORE.getKey()))
|
||||
{
|
||||
coal.getBlock().setType(Material.COAL_ORE);
|
||||
}
|
||||
|
||||
MapManager = new ItemMapManager(this, WorldData.World, WorldData.MinX, WorldData.MinZ, WorldData.MaxX, WorldData.MaxZ);
|
||||
|
||||
_vman.selectVariation();
|
||||
@ -597,6 +614,7 @@ public class MinecraftLeague extends TeamGame
|
||||
if (event.GetState() == GameState.Live)
|
||||
{
|
||||
_lastIncrease = System.currentTimeMillis();
|
||||
_lastOreReset = System.currentTimeMillis();
|
||||
Manager.GetExplosion().setEnabled(false);
|
||||
Manager.GetDamage().SetEnabled(false);
|
||||
Manager.GetCreature().SetForce(true);
|
||||
@ -604,6 +622,7 @@ public class MinecraftLeague extends TeamGame
|
||||
_cmd = new MinecraftLeagueCommand(Manager, this);
|
||||
Manager.addCommand(_cmd);
|
||||
Manager.getGameChatManager().TeamSpy = false;
|
||||
Objective.setMainObjective(new GearObjective());
|
||||
}
|
||||
|
||||
if (event.GetState() == GameState.End)
|
||||
@ -708,19 +727,35 @@ public class MinecraftLeague extends TeamGame
|
||||
spawner.update();
|
||||
}
|
||||
|
||||
/*for (TeamBeacon beacon : _beacons.values())
|
||||
for (TeamBeacon beacon : Beacons.values())
|
||||
{
|
||||
beacon.update();
|
||||
}*/
|
||||
}
|
||||
|
||||
Alert.update();
|
||||
//Alert.update();
|
||||
|
||||
if (UtilTime.elapsed(_lastOreReset, UtilTime.convert(5, TimeUnit.MINUTES, TimeUnit.MILLISECONDS)))
|
||||
{
|
||||
_lastOreReset = System.currentTimeMillis();
|
||||
for (Location loc : WorldData.GetCustomLocs(DataLoc.DIAMOND_ORE.getKey()))
|
||||
{
|
||||
loc.getBlock().setType(Material.DIAMOND_ORE);
|
||||
}
|
||||
for (Location loc : WorldData.GetCustomLocs(DataLoc.COAL_ORE.getKey()))
|
||||
{
|
||||
loc.getBlock().setType(Material.COAL_ORE);
|
||||
}
|
||||
_tower.ironOreGen(GetTeam(ChatColor.RED));
|
||||
_tower.ironOreGen(GetTeam(ChatColor.AQUA));
|
||||
UtilTextMiddle.display("", C.cGold + "All Ores have been refreshed!");
|
||||
}
|
||||
|
||||
if (!OverTime)
|
||||
{
|
||||
if (UtilTime.elapsed(GetStateTime(), UtilTime.convert(15, TimeUnit.MINUTES, TimeUnit.MILLISECONDS)))
|
||||
{
|
||||
OverTime = true;
|
||||
UtilTextMiddle.display(C.cDRed + "Overtime", C.cDRed + "Dying will now cause your crystal to lose 20 health!");
|
||||
UtilTextMiddle.display(C.cGold + "Overtime", C.cGold + "Dying will now cause your crystal to lose 20 health!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -751,10 +786,14 @@ public class MinecraftLeague extends TeamGame
|
||||
player.setFireTicks(-1);
|
||||
player.setFoodLevel(20);
|
||||
}
|
||||
if (UtilInv.contains(player, Material.LAVA_BUCKET, (byte) 0, 1))
|
||||
{
|
||||
UtilInv.insert(player, new ItemStack(Material.BUCKET, UtilInv.removeAll(player, Material.LAVA_BUCKET, (byte) 0)));
|
||||
}
|
||||
if (player.getOpenInventory().getType() == InventoryType.BEACON)
|
||||
player.closeInventory();
|
||||
if (player.getFireTicks() > 20 * 3)
|
||||
player.setFireTicks(20 * 3);
|
||||
if (player.getFireTicks() > 20 * 4)
|
||||
player.setFireTicks(20 * 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -897,6 +936,26 @@ public class MinecraftLeague extends TeamGame
|
||||
_customRespawns.put(player, new PlayerRespawnPoint(player, event.getClickedBlock().getLocation()));
|
||||
}*/
|
||||
|
||||
private boolean isLockedTo(Block block, Player to, boolean ignoreTeam)
|
||||
{
|
||||
for (BlockProtection prot : _blockLock.values())
|
||||
{
|
||||
if (prot.hasBlock(block))
|
||||
return prot.isLockedTo(to, block, ignoreTeam);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isOwner(Block block, Player owner)
|
||||
{
|
||||
for (BlockProtection prot : _blockLock.values())
|
||||
{
|
||||
if (prot.hasBlock(block))
|
||||
return prot.getOwner().getName().equalsIgnoreCase(owner.getName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void lockBlock(BlockPlaceEvent event)
|
||||
{
|
||||
@ -914,7 +973,10 @@ public class MinecraftLeague extends TeamGame
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
_blockLock.get(event.getPlayer()).unlockBlock(event.getBlock());
|
||||
if (isLockedTo(event.getBlock(), event.getPlayer(), true))
|
||||
_blockLock.get(event.getPlayer()).unlockBlock(event.getBlock());
|
||||
else
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -926,6 +988,12 @@ public class MinecraftLeague extends TeamGame
|
||||
if (event.getClickedBlock() == null)
|
||||
return;
|
||||
|
||||
if (UtilPlayer.isSpectator(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
@ -933,24 +1001,24 @@ public class MinecraftLeague extends TeamGame
|
||||
|
||||
if (block.getType() == Material.CHEST || block.getType() == Material.TRAPPED_CHEST || block.getType() == Material.FURNACE)
|
||||
{
|
||||
for (Player owner : _blockLock.keySet())
|
||||
if (isLockedTo(event.getClickedBlock(), event.getPlayer(), false))
|
||||
{
|
||||
BlockProtection prot = _blockLock.get(owner);
|
||||
|
||||
if (prot.isLockedTo(event.getPlayer(), block))
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (isOwner(event.getClickedBlock(), event.getPlayer()))
|
||||
{
|
||||
if (event.getPlayer().isSneaking())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
_blockLock.get(event.getPlayer()).unlockBlock(event.getClickedBlock());
|
||||
return;
|
||||
}
|
||||
else
|
||||
}
|
||||
if (!isOwner(event.getClickedBlock(), event.getPlayer()))
|
||||
{
|
||||
if (!isLockedTo(event.getClickedBlock(), event.getPlayer(), true))
|
||||
{
|
||||
if (owner.getName().equalsIgnoreCase(event.getPlayer().getName()))
|
||||
{
|
||||
if (event.getPlayer().isSneaking())
|
||||
{
|
||||
prot.unlockBlock(block);
|
||||
}
|
||||
}
|
||||
_blockLock.get(event.getPlayer()).lockBlock(event.getClickedBlock());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1155,6 +1223,10 @@ public class MinecraftLeague extends TeamGame
|
||||
{
|
||||
event.getInventory().setResult(new ItemStack(Material.ARROW, (event.getInventory().getResult().getAmount() * 2)));
|
||||
}
|
||||
if (event.getInventory().getResult().getType() == Material.FLINT_AND_STEEL)
|
||||
{
|
||||
event.getInventory().setResult(new ItemBuilder(Material.FLINT_AND_STEEL).setData((short) (Material.FLINT_AND_STEEL.getMaxDurability() - 4)).build());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -1214,7 +1286,7 @@ public class MinecraftLeague extends TeamGame
|
||||
return;
|
||||
|
||||
int playercount = GetTeam(ChatColor.RED).GetPlayers(false).size() + GetTeam(ChatColor.AQUA).GetPlayers(false).size();
|
||||
_tower.prepareHealth(playercount, 50 * 2);
|
||||
_tower.prepareHealth(playercount, 150);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -1263,10 +1335,10 @@ public class MinecraftLeague extends TeamGame
|
||||
}
|
||||
for (Player player : GetTeam(ChatColor.AQUA).GetPlayers(true))
|
||||
{
|
||||
player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setColor(Color.BLUE).build());
|
||||
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.BLUE).build());
|
||||
player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.BLUE).build());
|
||||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.BLUE).build());
|
||||
player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setColor(Color.BLUE).setUnbreakable(true).build());
|
||||
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.BLUE).setUnbreakable(true).build());
|
||||
player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.BLUE).setUnbreakable(true).build());
|
||||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.BLUE).setUnbreakable(true).build());
|
||||
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
|
||||
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
|
||||
//player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 5));
|
||||
@ -1274,10 +1346,10 @@ public class MinecraftLeague extends TeamGame
|
||||
}
|
||||
for (Player player : GetTeam(ChatColor.RED).GetPlayers(true))
|
||||
{
|
||||
player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setColor(Color.RED).build());
|
||||
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.RED).build());
|
||||
player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.RED).build());
|
||||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.RED).build());
|
||||
player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setColor(Color.RED).setUnbreakable(true).build());
|
||||
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.RED).setUnbreakable(true).build());
|
||||
player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.RED).setUnbreakable(true).build());
|
||||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.RED).setUnbreakable(true).build());
|
||||
player.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
|
||||
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
|
||||
//player.getInventory().addItem(new ItemStack(Material.COOKED_BEEF, 5));
|
||||
@ -1326,6 +1398,18 @@ public class MinecraftLeague extends TeamGame
|
||||
else
|
||||
gear.add(new ItemStack(Material.AIR));
|
||||
|
||||
if (UtilInv.contains(player, Material.BOW, (byte) 0, 1))
|
||||
{
|
||||
for (ItemStack poss : UtilInv.getItems(player))
|
||||
{
|
||||
if (poss.getType() == Material.BOW)
|
||||
{
|
||||
gear.add(poss);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int arrowsToAdd = UtilInv.getAmount(player, Material.ARROW) / 2;
|
||||
while (arrowsToAdd >= 1)
|
||||
{
|
||||
@ -1479,7 +1563,7 @@ public class MinecraftLeague extends TeamGame
|
||||
//_spawnAllow.put(player, System.currentTimeMillis() + UtilTime.convert((long) this.DeathSpectateSecs, TimeUnit.SECONDS, TimeUnit.MILLISECONDS));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPickup(PlayerPickupItemEvent event)
|
||||
{
|
||||
if (UtilPlayer.isSpectator(event.getPlayer()))
|
||||
@ -1495,14 +1579,19 @@ public class MinecraftLeague extends TeamGame
|
||||
if (event.getEntity() instanceof Enderman)
|
||||
event.setCancelled(true);
|
||||
|
||||
if (event.getEntityType() == EntityType.DROPPED_ITEM || event.getEntityType() == EntityType.ARROW)
|
||||
return;
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
for (TeamTowerBase tower : _tower.getTeamTowers(team))
|
||||
{
|
||||
if (event.getLocation().getWorld().getUID() != WorldData.World.getUID())
|
||||
continue;
|
||||
|
||||
if (event.getLocation().distance(tower.getLocation()) <= 5)
|
||||
event.setCancelled(true);
|
||||
for (TeamTowerBase tower : _tower.getTeamTowers(team))
|
||||
{
|
||||
if (event.getLocation().getWorld().getUID() != WorldData.World.getUID())
|
||||
continue;
|
||||
|
||||
if (event.getLocation().distance(tower.getLocation()) <= 5)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class AdminPanel implements Listener
|
||||
.build();
|
||||
|
||||
ItemStack blue = new ItemBuilder(MenuButton.CRYSTAL.getRepresentation())
|
||||
.setTitle(C.cAqua + "Blue Crystal")
|
||||
.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())
|
||||
.build();
|
||||
|
@ -7,6 +7,7 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -22,12 +23,22 @@ public class BlockProtection
|
||||
_player = player;
|
||||
}
|
||||
|
||||
public boolean isLockedTo(Player opening, Block block)
|
||||
public Player getOwner()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public boolean hasBlock(Block block)
|
||||
{
|
||||
return _blocks.contains(block);
|
||||
}
|
||||
|
||||
public boolean isLockedTo(Player opening, Block block, boolean ignoreTeam)
|
||||
{
|
||||
if (!_blocks.contains(block))
|
||||
return false;
|
||||
if (_host.GetTeam(_player).GetColor() != _host.GetTeam(opening).GetColor())
|
||||
return false;
|
||||
return ignoreTeam;
|
||||
if (opening.getName().equalsIgnoreCase(_player.getName()))
|
||||
return false;
|
||||
|
||||
@ -40,14 +51,18 @@ public class BlockProtection
|
||||
return;
|
||||
|
||||
_blocks.add(block);
|
||||
_player.playSound(_player.getLocation(), Sound.ANVIL_USE, 5, 1);
|
||||
UtilPlayer.message(_player, F.main("Game", "You have locked this block to your team! Right-click it while sneaking to unlock it!"));
|
||||
}
|
||||
|
||||
public void unlockBlock(Block block)
|
||||
public boolean unlockBlock(Block block)
|
||||
{
|
||||
if (_blocks.remove(block))
|
||||
{
|
||||
_player.playSound(_player.getLocation(), Sound.ANVIL_USE, 5, 1);
|
||||
UtilPlayer.message(_player, F.main("Game", "You have unlocked this block!"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ public class DefenderAI
|
||||
{
|
||||
private TowerManager _manager;
|
||||
private TeamTowerBase _tower;
|
||||
private int _number;
|
||||
private long _lastAttack;
|
||||
private long _procTime;
|
||||
private DefenseAnimation _animation;
|
||||
@ -27,6 +28,12 @@ public class DefenderAI
|
||||
{
|
||||
_manager = manager;
|
||||
_tower = tower;
|
||||
|
||||
if (tower instanceof TeamTower)
|
||||
_number = ((TeamTower)tower).Number;
|
||||
else
|
||||
_number = 3;
|
||||
|
||||
_lastAttack = System.currentTimeMillis();
|
||||
_procTime = -1;
|
||||
_animation = new DefenseAnimation();
|
||||
@ -37,18 +44,13 @@ public class DefenderAI
|
||||
if (!_tower.Alive)
|
||||
return;
|
||||
|
||||
if (_tower instanceof TeamTower)
|
||||
_animation.activate();
|
||||
else
|
||||
attack();
|
||||
|
||||
attack();
|
||||
_animation.update();
|
||||
}
|
||||
|
||||
private void animate()
|
||||
{
|
||||
_animation.activate();
|
||||
_animation.deactivate(); //<-- Used for when attack hits
|
||||
}
|
||||
|
||||
private void attack()
|
||||
@ -58,21 +60,26 @@ public class DefenderAI
|
||||
if (System.currentTimeMillis() >= _procTime)
|
||||
{
|
||||
_procTime = -1;
|
||||
_lastAttack = System.currentTimeMillis();
|
||||
attackProc();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!UtilTime.elapsed(_lastAttack, UtilTime.convert(1, TimeUnit.MINUTES, TimeUnit.MILLISECONDS)))
|
||||
if (!_manager.Attack)
|
||||
return;
|
||||
if (UtilMath.random.nextDouble() < .75)
|
||||
if (!UtilTime.elapsed(_lastAttack, UtilTime.convert(30, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
|
||||
return;
|
||||
_procTime = System.currentTimeMillis() + UtilTime.convert(45, TimeUnit.SECONDS, TimeUnit.MILLISECONDS);
|
||||
/*if (UtilMath.random.nextDouble() < .75)
|
||||
return;*/
|
||||
_lastAttack = System.currentTimeMillis();
|
||||
_procTime = System.currentTimeMillis() + UtilTime.convert(25, TimeUnit.SECONDS, TimeUnit.MILLISECONDS);
|
||||
animate();
|
||||
}
|
||||
|
||||
private void attackProc()
|
||||
{
|
||||
for (LivingEntity le : UtilEnt.getInRadius(_tower.getLocation(), 15).keySet())
|
||||
_animation.deactivate();
|
||||
for (LivingEntity le : UtilEnt.getInRadius(_tower.getLocation(), 7).keySet())
|
||||
{
|
||||
if (!(le instanceof Player))
|
||||
continue;
|
||||
@ -101,7 +108,8 @@ public class DefenderAI
|
||||
{
|
||||
_step = 0;
|
||||
_lastStepIncrease = System.currentTimeMillis();
|
||||
if (_tower instanceof TeamTower)
|
||||
_base = _tower.getLocation().clone();
|
||||
/*if (_tower instanceof TeamTower)
|
||||
{
|
||||
//_baseRadius = -1;
|
||||
_base = _tower.getLocation().clone().add(0, 10, 0);
|
||||
@ -110,7 +118,7 @@ public class DefenderAI
|
||||
{
|
||||
//_baseRadius = 11;
|
||||
_base = _tower.getLocation().clone();
|
||||
}
|
||||
}*/
|
||||
_radius = /*_baseRadius*/2;
|
||||
}
|
||||
|
||||
@ -126,41 +134,40 @@ public class DefenderAI
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (_number != 3)
|
||||
drawBeam();
|
||||
|
||||
if (!_active)
|
||||
return;
|
||||
|
||||
if (_tower instanceof TeamTower)
|
||||
if (UtilTime.elapsed(_lastStepIncrease, UtilTime.convert(3, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
|
||||
{
|
||||
drawBeam();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UtilTime.elapsed(_lastStepIncrease, UtilTime.convert(3, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
|
||||
{
|
||||
_step++;
|
||||
_lastStepIncrease = System.currentTimeMillis();
|
||||
}
|
||||
drawHelix();
|
||||
_step++;
|
||||
_lastStepIncrease = System.currentTimeMillis();
|
||||
}
|
||||
drawHelix();
|
||||
}
|
||||
|
||||
private void drawHelix()
|
||||
{
|
||||
for (double y = 0; y <= _step; y += .5)
|
||||
double height = Math.min(_step, 15D);
|
||||
|
||||
for (double y = 0; y <= height; y += .5)
|
||||
{
|
||||
double x = _radius * Math.cos(y);
|
||||
double z = _radius * Math.sin(y);
|
||||
Location play = new Location(_base.getWorld(), _base.getX() + x, _base.getY() + y, _base.getZ() + z);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, play, null, 0, 1, ViewDist.MAX);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, play, null, 0, 3, ViewDist.MAX);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawBeam()
|
||||
{
|
||||
Location target = _manager.getTeamTowers(_tower.getTeam()).getLast().getLocation().clone().add(0, 10, 0);
|
||||
Location display = _base.clone();
|
||||
while (UtilMath.offset(_base, target) > UtilMath.offset(_base, display))
|
||||
Location base = _base.clone().add(0, 10, 0);
|
||||
Location target = _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))
|
||||
{
|
||||
Vector v = UtilAlg.getTrajectory(display, target);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, display, null, 0, 1, ViewDist.MAX);
|
||||
|
@ -2,13 +2,10 @@ package nautilus.game.arcade.game.games.minecraftleague.data;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
@ -17,18 +14,18 @@ public class TeamBeacon
|
||||
{
|
||||
private GameTeam _team;
|
||||
private Block _block;
|
||||
private Location _core;
|
||||
//private Location _core;
|
||||
|
||||
public TeamBeacon(GameTeam team, Block block, Location core)
|
||||
public TeamBeacon(GameTeam team, Block block/*, Location core*/)
|
||||
{
|
||||
_team = team;
|
||||
_block = block;
|
||||
_core = core;
|
||||
//_core = core;
|
||||
|
||||
_block.setType(Material.BEACON);
|
||||
}
|
||||
|
||||
public boolean isBlock(Block match)
|
||||
/*public boolean isBlock(Block match)
|
||||
{
|
||||
if (match.getX() == _block.getX())
|
||||
if (match.getZ() == _block.getZ())
|
||||
@ -36,6 +33,11 @@ public class TeamBeacon
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}*/
|
||||
|
||||
public void setBlock(Block block)
|
||||
{
|
||||
_block = block;
|
||||
}
|
||||
|
||||
public void update()
|
||||
@ -49,17 +51,17 @@ public class TeamBeacon
|
||||
ignore.add(Material.STAINED_GLASS);
|
||||
ignore.add(Material.STAINED_GLASS_PANE);
|
||||
//Bukkit.broadcastMessage(UtilBlock.getHighest(_block.getWorld(), _block.getX(), _block.getZ(), ignore) + "");
|
||||
if (!isBlock(UtilBlock.getHighest(_block.getWorld(), _block.getX(), _block.getZ(), ignore).getRelative(BlockFace.DOWN)))
|
||||
return;
|
||||
//if (!isBlock(UtilBlock.getHighest(_block.getWorld(), _block.getX(), _block.getZ(), ignore).getRelative(BlockFace.DOWN)))
|
||||
//return;
|
||||
|
||||
for (Player player : _team.GetPlayers(true))
|
||||
{
|
||||
if (player.getLocation().distance(_core) < 15)
|
||||
if (player.getLocation().distance(_block.getLocation()) < 15)
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 5 * 20, 0));
|
||||
//player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 5 * 20, 0));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 5 * 20, 0));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 5 * 20, 0));
|
||||
//player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 5 * 20, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,16 +75,16 @@ public abstract class TeamTowerBase
|
||||
{
|
||||
String message = "";
|
||||
if (player != null)
|
||||
message = C.cRedB + player.getName() + " has destroyed " + _team.getDisplayName() + "'s " + C.cDPurpleB + _type + C.cRedB + "!";
|
||||
message = _host.GetTeam(player).GetColor() + player.getName() + _team.GetColor() + " has destroyed " + _team.getDisplayName() + "'s " + C.cDPurpleB + _type + _team.GetColor() + "!";
|
||||
else
|
||||
message = C.cRedB + _team.getDisplayName() + "'s " + C.cDPurpleB + _type + C.cRedB + " has been destroyed!";
|
||||
message = _team.GetColor() + _team.getDisplayName() + "'s " + C.cDPurpleB + _type + _team.GetColor() + " has been destroyed!";
|
||||
|
||||
Bukkit.broadcastMessage(message);
|
||||
|
||||
if (!_type.equalsIgnoreCase("Tower"))
|
||||
{
|
||||
for (Player inform : _team.GetPlayers(true))
|
||||
UtilTextMiddle.display(C.cRedB + "Team Crystal Destroyed", C.cRed + "You will no longer respawn!", inform);
|
||||
UtilTextMiddle.display(C.cGold + "Team Crystal Destroyed", C.cGold + "You will no longer respawn!", inform);
|
||||
}
|
||||
|
||||
Alive = false;
|
||||
@ -147,7 +147,7 @@ public abstract class TeamTowerBase
|
||||
}
|
||||
}
|
||||
|
||||
private Location getBeacon()
|
||||
public Location getBeacon()
|
||||
{
|
||||
Location ret = null;
|
||||
for (Location loc : _host.WorldData.GetDataLocs(DataLoc.BEACON.getKey()))
|
||||
@ -223,7 +223,7 @@ public abstract class TeamTowerBase
|
||||
|
||||
_health = newHealth;
|
||||
if (player != null)
|
||||
Recharge.Instance.use(player, "Damage TeamTower", UtilTime.convert(1, TimeUnit.SECONDS, TimeUnit.MILLISECONDS), false, false);
|
||||
Recharge.Instance.use(player, "Damage TeamTower", UtilTime.convert(1/2, TimeUnit.SECONDS, TimeUnit.MILLISECONDS), false, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,49 +1,57 @@
|
||||
package nautilus.game.arcade.game.games.minecraftleague.data;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
|
||||
import org.bukkit.Instrument;
|
||||
import org.bukkit.Note;
|
||||
import org.bukkit.Note.Tone;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TowerAlert
|
||||
{
|
||||
private ConcurrentHashMap<GameTeam, Long> _alerts = new ConcurrentHashMap<GameTeam, Long>();
|
||||
private ConcurrentHashMap<GameTeam, String> _alertType = new ConcurrentHashMap<GameTeam, String>();
|
||||
//private ConcurrentHashMap<GameTeam, Long> _alerts = new ConcurrentHashMap<GameTeam, Long>();
|
||||
//private ConcurrentHashMap<GameTeam, String> _alertType = new ConcurrentHashMap<GameTeam, String>();
|
||||
|
||||
public void alert(GameTeam team, TeamTowerBase tower)
|
||||
{
|
||||
_alerts.put(team, System.currentTimeMillis());
|
||||
//_alerts.put(team, System.currentTimeMillis());
|
||||
String type = "";
|
||||
if (tower instanceof TeamTower)
|
||||
{
|
||||
int number = ((TeamTower)tower).Number;
|
||||
if (number == 1)
|
||||
_alertType.put(team, "First Tower");
|
||||
/*_alertType.put(team, */type = "First Tower";//);
|
||||
else
|
||||
_alertType.put(team, "Second Tower");
|
||||
/*_alertType.put(team, */type = "Second Tower";//);
|
||||
}
|
||||
else
|
||||
_alertType.put(team, "Crystal");
|
||||
/*_alertType.put(team, */type = "Crystal";//);
|
||||
|
||||
showAlert(team, type);
|
||||
}
|
||||
|
||||
public void update()
|
||||
private void showAlert(GameTeam team, String type)
|
||||
{
|
||||
for (GameTeam team : _alerts.keySet())
|
||||
{
|
||||
/*for (GameTeam team : _alerts.keySet())
|
||||
{*/
|
||||
for (Player player : team.GetPlayers(true))
|
||||
{
|
||||
UtilTextBottom.display(C.cRed + "Your " + _alertType.get(team) + " is under attack!", player);
|
||||
UtilTextMiddle.display("", C.cGold + "Your " + /*_alertType.get(team)*/type + " is under attack!", 0, 20 * 5, 0, player);
|
||||
playSound(player);
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(_alerts.get(team), UtilTime.convert(5, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
|
||||
/*if (UtilTime.elapsed(_alerts.get(team), UtilTime.convert(5, TimeUnit.SECONDS, TimeUnit.MILLISECONDS)))
|
||||
{
|
||||
_alerts.remove(team);
|
||||
_alertType.remove(team);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
//}
|
||||
}
|
||||
|
||||
private void playSound(Player player)
|
||||
{
|
||||
player.playNote(player.getLocation(), Instrument.PIANO, Note.sharp(1, Tone.A));
|
||||
}
|
||||
}
|
||||
|
@ -6,17 +6,18 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
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.game.games.minecraftleague.data.objectives.KillObjective;
|
||||
import nautilus.game.arcade.world.WorldData;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class TowerManager implements Listener
|
||||
{
|
||||
@ -25,7 +26,9 @@ public class TowerManager implements Listener
|
||||
private ConcurrentHashMap<GameTeam, Integer> _vulnerableTower = new ConcurrentHashMap<GameTeam, Integer>();
|
||||
private ConcurrentHashMap<TeamTowerBase, DefenderAI> _def = new ConcurrentHashMap<TeamTowerBase, DefenderAI>();
|
||||
//private ConcurrentHashMap<TeamTowerBase, MapZone> _mapZone = new ConcurrentHashMap<TeamTowerBase, MapZone>();
|
||||
private ConcurrentHashMap<GameTeam, TeamBeacon> _beacons = new ConcurrentHashMap<GameTeam, TeamBeacon>();
|
||||
private OreGenerator _ore;
|
||||
public boolean Attack = true;
|
||||
|
||||
public TowerManager(MinecraftLeague host)
|
||||
{
|
||||
@ -40,15 +43,16 @@ public class TowerManager implements Listener
|
||||
else
|
||||
_vulnerableTower.put(base.getTeam(), 3);
|
||||
|
||||
base.setVulnerable(true);;
|
||||
base.setVulnerable(true);
|
||||
_beacons.get(base.getTeam()).setBlock(base.getBeacon().getBlock());
|
||||
}
|
||||
|
||||
private void oreGen(GameTeam team)
|
||||
public void ironOreGen(GameTeam team)
|
||||
{
|
||||
if (team.GetColor() == ChatColor.RED)
|
||||
_ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.RED_ORE.getKey()), 150);
|
||||
_ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.RED_ORE.getKey()), 30);
|
||||
else
|
||||
_ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.BLUE_ORE.getKey()), 150);
|
||||
_ore.generateOre(Material.IRON_ORE, Host.WorldData.GetCustomLocs(DataLoc.BLUE_ORE.getKey()), 30);
|
||||
}
|
||||
|
||||
private List<TeamTowerBase> getAllTeamTowers(GameTeam team)
|
||||
@ -148,10 +152,14 @@ public class TowerManager implements Listener
|
||||
_mapZone.put(tower, zone);*/
|
||||
}
|
||||
|
||||
_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());
|
||||
oreGen(red);
|
||||
oreGen(blue);
|
||||
ironOreGen(red);
|
||||
ironOreGen(blue);
|
||||
}
|
||||
|
||||
public void prepareHealth(int players, double multiplier)
|
||||
@ -162,8 +170,9 @@ public class TowerManager implements Listener
|
||||
tower.setMaxHealth(players * multiplier);
|
||||
else
|
||||
{
|
||||
int divisor = 3 - ((TeamTower)tower).Number;
|
||||
double rawHealth = (.67 * multiplier) * players;
|
||||
Double health = new BigDecimal(rawHealth).intValue() * 1D;
|
||||
Double health = new BigDecimal(rawHealth / divisor).intValue() * 1D;
|
||||
tower.setMaxHealth(health);
|
||||
}
|
||||
}
|
||||
@ -172,21 +181,40 @@ public class TowerManager implements Listener
|
||||
public void handleTowerDeath(TeamTowerBase towerBase)
|
||||
{
|
||||
towerBase.setVulnerable(false);
|
||||
oreGen(towerBase.getTeam());
|
||||
Bukkit.getScheduler().runTaskLater(Host.Manager.getPlugin(), new Runnable()
|
||||
//ironOreGen(towerBase.getTeam());
|
||||
for (Player player : towerBase.getTeam().GetPlayers(true))
|
||||
{
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 20 * 60, 1));
|
||||
}
|
||||
/*Bukkit.getScheduler().runTaskLater(Host.Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
UtilTextMiddle.display("", towerBase.getTeam().GetColor() + towerBase.getTeam().GetName() + " Team ores have been replenished!", UtilServer.getPlayers());
|
||||
}
|
||||
}, 20 * 5);
|
||||
}, 20 * 5);*/
|
||||
//_mapZone.get(towerBase).setValid(false);
|
||||
if (towerBase instanceof TeamCrystal)
|
||||
{
|
||||
GameTeam enemy = null;
|
||||
if (towerBase.getTeam() == Host.GetTeam(ChatColor.RED))
|
||||
enemy = Host.GetTeam(ChatColor.AQUA);
|
||||
else
|
||||
enemy = Host.GetTeam(ChatColor.RED);
|
||||
|
||||
Host.Objective.setTeamObjective(enemy, new KillObjective());
|
||||
|
||||
return;
|
||||
}
|
||||
TeamTower tower = (TeamTower)towerBase;
|
||||
makeVulnerable(getTeamTowers(tower.getTeam()).get(tower.Number));
|
||||
}
|
||||
|
||||
public void toggleAttack()
|
||||
{
|
||||
Attack = !Attack;
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
for (TeamTowerBase tower : _towers.keySet())
|
||||
|
@ -0,0 +1,11 @@
|
||||
package nautilus.game.arcade.game.games.minecraftleague.data.objectives;
|
||||
|
||||
import nautilus.game.arcade.game.games.minecraftleague.objective.GameObjective;
|
||||
|
||||
public class GearObjective extends GameObjective
|
||||
{
|
||||
public GearObjective()
|
||||
{
|
||||
super("GEAR", "Gear Up");
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package nautilus.game.arcade.game.games.minecraftleague.data.objectives;
|
||||
|
||||
import nautilus.game.arcade.game.games.minecraftleague.objective.GameObjective;
|
||||
|
||||
public class KillObjective extends GameObjective
|
||||
{
|
||||
public KillObjective()
|
||||
{
|
||||
super("KILL_ENEMY", "Kill Enemy");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package nautilus.game.arcade.game.games.minecraftleague.objective;
|
||||
|
||||
|
||||
public abstract class GameObjective
|
||||
{
|
||||
private String _displayText, _id;
|
||||
|
||||
public GameObjective(String id, String displayText)
|
||||
{
|
||||
_id = id;
|
||||
_displayText = displayText;
|
||||
}
|
||||
|
||||
public String getID()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public String getDisplayText()
|
||||
{
|
||||
return _displayText;
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package nautilus.game.arcade.game.games.minecraftleague.objective;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.MinecraftLeague;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class ObjectiveManager implements Listener
|
||||
{
|
||||
private MinecraftLeague _host;
|
||||
private GameObjective _main;
|
||||
private ConcurrentHashMap<Player, GameObjective> _specificObjectives = new ConcurrentHashMap<Player, GameObjective>();
|
||||
private ConcurrentHashMap<GameTeam, GameObjective> _teamObjectives = new ConcurrentHashMap<GameTeam, GameObjective>();
|
||||
|
||||
public ObjectiveManager(MinecraftLeague host)
|
||||
{
|
||||
_host = host;
|
||||
Bukkit.getPluginManager().registerEvents(this, _host.getArcadeManager().getPlugin());
|
||||
}
|
||||
|
||||
private void displayObjective(Player player)
|
||||
{
|
||||
GameObjective obj = _main;
|
||||
if (_teamObjectives.containsKey(_host.GetTeam(player)))
|
||||
obj = _teamObjectives.get(_host.GetTeam(player));
|
||||
if (_specificObjectives.containsKey(player))
|
||||
obj = _specificObjectives.get(player);
|
||||
|
||||
UtilTextBottom.display(C.cGold + "Objective: " + obj.getDisplayText(), player);
|
||||
}
|
||||
|
||||
public String getMainObjective()
|
||||
{
|
||||
return _main.getID();
|
||||
}
|
||||
|
||||
public String getTeamObjective(GameTeam team)
|
||||
{
|
||||
if (_teamObjectives.containsKey(team))
|
||||
return _teamObjectives.get(team).getID();
|
||||
|
||||
return getMainObjective();
|
||||
}
|
||||
|
||||
public String getPlayerObjective(Player player)
|
||||
{
|
||||
if (_specificObjectives.containsKey(player))
|
||||
return _specificObjectives.get(player).getID();
|
||||
|
||||
return getTeamObjective(_host.GetTeam(player));
|
||||
}
|
||||
|
||||
public void setMainObjective(GameObjective objective)
|
||||
{
|
||||
_main = objective;
|
||||
}
|
||||
|
||||
public void setPlayerObjective(Player player, GameObjective objective)
|
||||
{
|
||||
resetPlayerToMainObjective(player);
|
||||
_specificObjectives.put(player, objective);
|
||||
}
|
||||
|
||||
public void resetPlayerToMainObjective(Player player)
|
||||
{
|
||||
if (!_specificObjectives.containsKey(player))
|
||||
return;
|
||||
_specificObjectives.remove(player);
|
||||
}
|
||||
|
||||
public void setTeamObjective(GameTeam team, GameObjective objective)
|
||||
{
|
||||
resetTeamToMainObjective(team);
|
||||
_teamObjectives.put(team, objective);
|
||||
}
|
||||
|
||||
public void resetTeamToMainObjective(GameTeam team)
|
||||
{
|
||||
if (!_teamObjectives.containsKey(team))
|
||||
return;
|
||||
_teamObjectives.remove(team);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (!_host.IsLive())
|
||||
return;
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
for (Player player : _host.GetPlayers(true))
|
||||
{
|
||||
if (_main != null || _specificObjectives.containsKey(player))
|
||||
displayObjective(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handleDeregister(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetGame() != _host)
|
||||
return;
|
||||
|
||||
if (event.GetState() != GameState.Dead)
|
||||
return;
|
||||
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
}
|
@ -9,7 +9,6 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||
@ -17,10 +16,12 @@ 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.game.games.minecraftleague.data.TeamTowerBase;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.data.objectives.GearObjective;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.GameVariation;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.TeamAltar;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.WitherMinionManager;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.WitherPathfinder;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.objectives.WitherObjective;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -139,6 +140,8 @@ public class WitherVariation extends GameVariation
|
||||
_wowner = null;
|
||||
_skellyMan.onWitherDeath();
|
||||
UtilTextMiddle.display("", C.cGray + "The Mighty Wither has fallen!");
|
||||
Host.Objective.resetTeamToMainObjective(Host.GetTeam(ChatColor.RED));
|
||||
Host.Objective.resetTeamToMainObjective(Host.GetTeam(ChatColor.AQUA));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -180,9 +183,16 @@ public class WitherVariation extends GameVariation
|
||||
_wither = (Wither)event.getEntity();
|
||||
_wither.setCustomName(team.GetColor() + team.getDisplayName() + "'s Wither");
|
||||
_wither.setCustomNameVisible(true);
|
||||
UtilTextMiddle.display("", team.GetColor() + team.getDisplayName() + " Team has spawned a Wither Boss!", UtilServer.getPlayers());
|
||||
UtilTextMiddle.display("", C.cBlack + team.getDisplayName() + " Team has spawned a Wither Boss!", UtilServer.getPlayers());
|
||||
_pathfinder = new WitherPathfinder(this, _wither, getWaypoints(_altars.get(team).getLocation()), team, enemy, Host.getTowerManager());
|
||||
_skellyMan.onWitherSpawn();
|
||||
Host.Objective.setMainObjective(new GearObjective());
|
||||
Host.Objective.setTeamObjective(team, new WitherObjective("Attack Enemy Towers"));
|
||||
Host.Objective.setTeamObjective(enemy, new WitherObjective("Kill Wither"));
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
Host.Objective.resetPlayerToMainObjective(player);
|
||||
}
|
||||
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
@ -213,7 +223,7 @@ public class WitherVariation extends GameVariation
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
//@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
public void onExplode(EntityExplodeEvent event)
|
||||
{
|
||||
@ -271,7 +281,7 @@ public class WitherVariation extends GameVariation
|
||||
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());
|
||||
//WorldData.World.dropItem(b.getLocation(), new ItemBuilder(b.getType()).setData(b.getData()).build());
|
||||
b.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.WitherVariation;
|
||||
|
||||
@ -40,6 +41,11 @@ public class TeamAltar
|
||||
spawnSoulsand();
|
||||
|
||||
_protected = UtilShapes.getSphereBlocks(center, 7, 7, false);
|
||||
|
||||
Location labelLoc = center.clone().add(0.5, 5, 0.5);
|
||||
String labelStr = team.GetColor() + team.getDisplayName() + "'s Altar";
|
||||
Hologram label = new Hologram(host.Host.getArcadeManager().getHologramManager(), labelLoc, labelStr);
|
||||
label.start();
|
||||
}
|
||||
|
||||
public boolean isInsideAltar(Location location)
|
||||
|
@ -13,7 +13,6 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
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;
|
||||
@ -23,7 +22,10 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.data.MapZone;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.data.objectives.GearObjective;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.WitherVariation;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.objectives.GrabSkullObjective;
|
||||
import nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.objectives.ReturnSkullObjective;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -131,6 +133,7 @@ public class WitherMinionManager implements Listener
|
||||
UtilTextMiddle.display("", C.cGray + "A Wither Skeleton has spawned!");
|
||||
_skellyZone.setCenter(chosen);
|
||||
_skellyZone.setValid(true);
|
||||
_host.Host.Objective.setMainObjective(new GrabSkullObjective());
|
||||
}
|
||||
_selected = -1;
|
||||
_spawned = true;
|
||||
@ -138,13 +141,15 @@ public class WitherMinionManager implements Listener
|
||||
|
||||
public void onWitherDeath()
|
||||
{
|
||||
_lastDied = System.currentTimeMillis() - UtilTime.convert(20, TimeUnit.SECONDS, TimeUnit.MINUTES);
|
||||
_lastDied = System.currentTimeMillis() + UtilTime.convert(2, TimeUnit.MINUTES, TimeUnit.MILLISECONDS);
|
||||
_witherBlocked = false;
|
||||
_host.Host.getTowerManager().toggleAttack();
|
||||
_sbTimer.freezeTime(-1);
|
||||
}
|
||||
|
||||
public void onWitherSpawn()
|
||||
{
|
||||
_host.Host.getTowerManager().toggleAttack();
|
||||
_witherBlocked = true;
|
||||
if (_entity != null)
|
||||
{
|
||||
@ -198,11 +203,25 @@ public class WitherMinionManager implements Listener
|
||||
boolean noUse = _host.Host.getTowerManager().getAmountAlive(_host.Host.GetTeam(ChatColor.RED)) < 1;
|
||||
if (_host.Host.getTowerManager().getAmountAlive(_host.Host.GetTeam(ChatColor.AQUA)) >= 1)
|
||||
noUse = false;
|
||||
if (!_host.WitherSpawned || noUse)
|
||||
if (!_host.WitherSpawned || !noUse)
|
||||
{
|
||||
if (_entity == null)
|
||||
{
|
||||
if (_selected != _lastUsed)
|
||||
{
|
||||
preSpawn();
|
||||
}
|
||||
long end = _lastDied + UtilTime.convert(1, TimeUnit.MINUTES, TimeUnit.MILLISECONDS);
|
||||
end =- System.currentTimeMillis();
|
||||
long secLeft = UtilTime.convert(end, TimeUnit.MILLISECONDS, TimeUnit.SECONDS);
|
||||
if (secLeft <= 3)
|
||||
{
|
||||
if (secLeft > 0)
|
||||
{
|
||||
UtilTextMiddle.display(C.cGold + secLeft + " Seconds", C.cGray + "Until Wither Skeleton Spawn");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +230,7 @@ public class WitherMinionManager implements Listener
|
||||
boolean noUse = _host.Host.getTowerManager().getAmountAlive(_host.Host.GetTeam(ChatColor.RED)) < 1;
|
||||
if (_host.Host.getTowerManager().getAmountAlive(_host.Host.GetTeam(ChatColor.AQUA)) >= 1)
|
||||
noUse = false;
|
||||
if (!_host.WitherSpawned || noUse)
|
||||
if (!_host.WitherSpawned || !noUse)
|
||||
{
|
||||
if (_entity == null)
|
||||
spawn(false);
|
||||
@ -222,12 +241,23 @@ public class WitherMinionManager implements Listener
|
||||
{
|
||||
if (UtilInv.contains(player, Material.SKULL_ITEM, (byte) 1, 1))
|
||||
{
|
||||
UtilTextBottom.display(C.cRed + "Return the Skull to your base!", player);
|
||||
for (Location loc : UtilShapes.getSphereBlocks(player.getLocation(), 3, 3, true))
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.PORTAL, loc, null, 0, 2, ViewDist.MAX);
|
||||
}
|
||||
for (Location loc : UtilShapes.getCircle(player.getLocation(), true, 1))
|
||||
{
|
||||
UtilParticle.PlayParticleToAll(ParticleType.DRIP_LAVA, loc, null, 0, 1, ViewDist.MAX);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_host.Host.Objective.getPlayerObjective(player).equalsIgnoreCase("GRAB_SKULL"))
|
||||
{
|
||||
_host.Host.Objective.resetPlayerToMainObjective(player);
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getInventory().getHelmet() != null)
|
||||
{
|
||||
if (UtilInv.IsItem(player.getInventory().getHelmet(), Material.SKULL_ITEM, (byte) 1))
|
||||
@ -296,6 +326,8 @@ public class WitherMinionManager implements Listener
|
||||
_cb.setType(_changed);
|
||||
_cb = null;
|
||||
_changed = Material.AIR;
|
||||
|
||||
_host.Host.Objective.setMainObjective(new GearObjective());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -319,6 +351,15 @@ public class WitherMinionManager implements Listener
|
||||
if (fin.equalsIgnoreCase(fin1))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "You have the Wither Skull! Return the skull to your base and place it on your Altar to summon the Wither!"));
|
||||
UtilTextMiddle.display("", C.cGray + "You have picked up the Wither Skull!", event.getPlayer());
|
||||
Bukkit.getScheduler().runTaskLater(_host.Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
UtilTextMiddle.display("", C.cGold + "Place the skull on top of your Altar's Soulsand!", event.getPlayer());
|
||||
}
|
||||
}, 20 * 5);
|
||||
_host.Host.Objective.setPlayerObjective(event.getPlayer(), new ReturnSkullObjective());
|
||||
if (!event.getItem().hasMetadata("Dropped"))
|
||||
UtilTextMiddle.display("", _host.Host.GetTeam(event.getPlayer()).GetColor() + _host.Host.GetTeam(event.getPlayer()).getDisplayName() + " has picked up a Wither Skull!", 20, 20 * 5, 20);
|
||||
}
|
||||
@ -342,6 +383,7 @@ public class WitherMinionManager implements Listener
|
||||
if (fin.equalsIgnoreCase(fin1))
|
||||
{
|
||||
event.getItemDrop().setMetadata("Dropped", new FixedMetadataValue(_host.Manager.getPlugin(), true));
|
||||
_host.Host.Objective.resetPlayerToMainObjective(event.getPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
package nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.objectives;
|
||||
|
||||
import nautilus.game.arcade.game.games.minecraftleague.objective.GameObjective;
|
||||
|
||||
public class GrabSkullObjective extends GameObjective
|
||||
{
|
||||
public GrabSkullObjective()
|
||||
{
|
||||
super("GRAB_SKULL", "Collect Wither Skull");
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.objectives;
|
||||
|
||||
import nautilus.game.arcade.game.games.minecraftleague.objective.GameObjective;
|
||||
|
||||
public class ReturnSkullObjective extends GameObjective
|
||||
{
|
||||
public ReturnSkullObjective()
|
||||
{
|
||||
super("RETURN_SKULL", "Return the Skull to your Altar!");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package nautilus.game.arcade.game.games.minecraftleague.variation.wither.data.objectives;
|
||||
|
||||
import nautilus.game.arcade.game.games.minecraftleague.objective.GameObjective;
|
||||
|
||||
public class WitherObjective extends GameObjective
|
||||
{
|
||||
public WitherObjective(String instruction)
|
||||
{
|
||||
super("WITHER_OBJ", instruction);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user