Added project start
This commit is contained in:
parent
5f73e50b2a
commit
d46ac59e10
@ -57,76 +57,74 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
private GameTeam _withers;
|
private GameTeam _withers;
|
||||||
|
|
||||||
private double _witherFactor = 2.5;
|
private double _witherFactor = 2.5;
|
||||||
|
|
||||||
private int _yLimit = 0;
|
private int _yLimit = 0;
|
||||||
|
|
||||||
private long _gameTime = 300000;
|
private long _gameTime = 300000;
|
||||||
|
|
||||||
private HashMap<Player, PlayerCopy> _doubles = new HashMap<Player, PlayerCopy>();
|
private HashMap<Player, PlayerCopy> _doubles = new HashMap<Player, PlayerCopy>();
|
||||||
|
|
||||||
// private int _livesPerPlayer = 3;
|
// private int _livesPerPlayer = 3;
|
||||||
// private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
// private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||||
|
|
||||||
private HashSet<BlockData> _blocks = new HashSet<BlockData>();
|
private HashSet<BlockData> _blocks = new HashSet<BlockData>();
|
||||||
|
|
||||||
public WitherGame(ArcadeManager manager)
|
public WitherGame(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
super(manager, GameType.WitherAssault,
|
super(manager, GameType.WitherAssault,
|
||||||
|
|
||||||
new Kit[]
|
new Kit[]
|
||||||
{
|
{
|
||||||
new KitHumanArcher(manager),
|
new KitHumanArcher(manager), new NullKit(manager),
|
||||||
//new KitHumanBuilder(manager),
|
new NullKit(manager), new NullKit(manager),
|
||||||
//new KitHumanRunner(manager),
|
|
||||||
new NullKit(manager),
|
|
||||||
new NullKit(manager),
|
|
||||||
new NullKit(manager),
|
|
||||||
new KitWitherMinion(manager),
|
new KitWitherMinion(manager),
|
||||||
//new KitWitherWeb(manager),
|
},
|
||||||
//new KitWitherWeb(manager),
|
|
||||||
},
|
|
||||||
|
|
||||||
new String[]
|
new String[]
|
||||||
{
|
{
|
||||||
|
|
||||||
C.cGreen + "Humans" + C.cWhite + " Run and hide from the Withers",
|
C.cGreen + "Humans" + C.cWhite
|
||||||
|
+ " Run and hide from the Withers",
|
||||||
C.cGreen + "Humans" + C.cWhite + " Revive your dead allies!",
|
C.cGreen + "Humans" + C.cWhite + " Revive your dead allies!",
|
||||||
C.cGreen + "Humans" + C.cWhite + " Win by surviving for 5 minutes",
|
C.cGreen + "Humans" + C.cWhite
|
||||||
|
+ " Win by surviving for 5 minutes",
|
||||||
" ",
|
" ",
|
||||||
C.cRed + "Withers" + C.cWhite + " Moves very slowly when near ground",
|
C.cRed + "Withers" + C.cWhite
|
||||||
C.cRed + "Withers" + C.cWhite + " Kill all the Humans within 5 Minutes",
|
+ " Moves very slowly when near ground",
|
||||||
});
|
C.cRed + "Withers" + C.cWhite
|
||||||
|
+ " Kill all the Humans within 5 Minutes",
|
||||||
|
});
|
||||||
|
|
||||||
this.DeathOut = true;
|
this.DeathOut = true;
|
||||||
this.DamageTeamSelf = false;
|
this.DamageTeamSelf = false;
|
||||||
this.DamageSelf = false;
|
this.DamageSelf = false;
|
||||||
this.DeathSpectateSecs = 4;
|
this.DeathSpectateSecs = 4;
|
||||||
this.HungerSet = 20;
|
this.HungerSet = 20;
|
||||||
this.WorldBoundaryKill = false;
|
this.WorldBoundaryKill = false;
|
||||||
|
|
||||||
this.CompassEnabled = true;
|
this.CompassEnabled = true;
|
||||||
this.CompassGiveItem = false;
|
this.CompassGiveItem = false;
|
||||||
|
|
||||||
this.KitRegisterState = GameState.Prepare;
|
this.KitRegisterState = GameState.Prepare;
|
||||||
|
|
||||||
this.TeamArmor = true;
|
this.TeamArmor = true;
|
||||||
this.TeamArmorHotbar = false;
|
this.TeamArmorHotbar = false;
|
||||||
|
|
||||||
_help = new String[]
|
_help = new String[]
|
||||||
{
|
{
|
||||||
C.cRed + C.Bold + "This game is still under development!",
|
C.cRed + C.Bold + "This game is still under development!",
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ParseData()
|
public void ParseData()
|
||||||
{
|
{
|
||||||
_yLimit = WorldData.GetDataLocs("RED").get(0).getBlockY();
|
_yLimit = WorldData.GetDataLocs("RED").get(0).getBlockY();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void teamSetup(GameStateChangeEvent event)
|
public void teamSetup(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetState() != GameState.Recruit)
|
if (event.GetState() != GameState.Recruit)
|
||||||
return;
|
return;
|
||||||
@ -140,7 +138,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
_withers = team;
|
_withers = team;
|
||||||
_withers.SetName("Withers");
|
_withers.SetName("Withers");
|
||||||
_withers.SetColor(ChatColor.RED);
|
_withers.SetColor(ChatColor.RED);
|
||||||
|
|
||||||
if (!kit.GetName().contains("Wither"))
|
if (!kit.GetName().contains("Wither"))
|
||||||
team.GetRestrictedKits().add(kit);
|
team.GetRestrictedKits().add(kit);
|
||||||
}
|
}
|
||||||
@ -149,7 +147,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
_runners = team;
|
_runners = team;
|
||||||
_runners.SetName("Humans");
|
_runners.SetName("Humans");
|
||||||
_runners.SetColor(ChatColor.GREEN);
|
_runners.SetColor(ChatColor.GREEN);
|
||||||
|
|
||||||
if (kit.GetName().contains("Wither"))
|
if (kit.GetName().contains("Wither"))
|
||||||
team.GetRestrictedKits().add(kit);
|
team.GetRestrictedKits().add(kit);
|
||||||
}
|
}
|
||||||
@ -166,95 +164,106 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.FAST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Not Enough Players
|
// Not Enough Players
|
||||||
if (_runners.GetPlayers(true).size() < 2)
|
if (_runners.GetPlayers(true).size() < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Enough Withers
|
// Enough Withers
|
||||||
if (_withers.GetPlayers(true).size() * _witherFactor >= _runners.GetPlayers(true).size())
|
if (_withers.GetPlayers(true).size() * _witherFactor >= _runners
|
||||||
|
.GetPlayers(true).size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
Player player = UtilAlg.Random(_runners.GetPlayers(true));
|
Player player = UtilAlg.Random(_runners.GetPlayers(true));
|
||||||
setWither(player, true);
|
setWither(player, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWither(Player player, boolean forced)
|
public void setWither(Player player, boolean forced)
|
||||||
{
|
{
|
||||||
// _lives.remove(player);
|
// _lives.remove(player);
|
||||||
|
|
||||||
SetPlayerTeam(player, _withers, true);
|
SetPlayerTeam(player, _withers, true);
|
||||||
|
|
||||||
//Kit
|
// Kit
|
||||||
Kit newKit = GetKits()[4];
|
Kit newKit = GetKits()[4];
|
||||||
|
|
||||||
SetKit(player, newKit, false);
|
SetKit(player, newKit, false);
|
||||||
newKit.ApplyKit(player);
|
newKit.ApplyKit(player);
|
||||||
|
|
||||||
player.teleport(_withers.GetSpawn());
|
player.teleport(_withers.GetSpawn());
|
||||||
|
|
||||||
if (forced)
|
if (forced)
|
||||||
{
|
{
|
||||||
AddGems(player, 10, "Forced Wither", false, false);
|
AddGems(player, 10, "Forced Wither", false, false);
|
||||||
|
|
||||||
Announce(F.main("Game", F.elem(_withers.GetColor() + player.getName()) + " has become a " +
|
Announce(F.main(
|
||||||
F.elem(_withers.GetColor() + newKit.GetName()) + "."));
|
"Game",
|
||||||
|
F.elem(_withers.GetColor() + player.getName())
|
||||||
|
+ " has become a "
|
||||||
|
+ F.elem(_withers.GetColor() + newKit.GetName())
|
||||||
|
+ "."));
|
||||||
|
|
||||||
player.getWorld().strikeLightningEffect(player.getLocation());
|
player.getWorld().strikeLightningEffect(player.getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
// @EventHandler
|
||||||
// public void playerLoseLife(final PlayerDeathOutEvent event)
|
// public void playerLoseLife(final PlayerDeathOutEvent event)
|
||||||
// {
|
// {
|
||||||
// Player player = event.GetPlayer();
|
// Player player = event.GetPlayer();
|
||||||
//
|
//
|
||||||
// if (_lives.containsKey(player))
|
// if (_lives.containsKey(player))
|
||||||
// {
|
// {
|
||||||
// int lives = _lives.get(player);
|
// int lives = _lives.get(player);
|
||||||
//
|
//
|
||||||
// if (lives <= 1)
|
// if (lives <= 1)
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// _lives.put(player, lives - 1);
|
// _lives.put(player, lives - 1);
|
||||||
//
|
//
|
||||||
// UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + C.Bold + lives + " Lives Remaining") + "."));
|
// UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen +
|
||||||
//
|
// C.Bold + lives + " Lives Remaining") + "."));
|
||||||
// event.setCancelled(true);
|
//
|
||||||
// }
|
// event.setCancelled(true);
|
||||||
// }
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void gameStart(GameStateChangeEvent event)
|
public void gameStart(GameStateChangeEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetState() != GameState.Live)
|
if (event.GetState() != GameState.Live)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UtilTextMiddle.display(C.cGreen + "Humans Hiding", "15 Seconds until Assault", 10, 80, 10);
|
UtilTextMiddle.display(C.cGreen + "Humans Hiding",
|
||||||
|
"15 Seconds until Assault", 10, 80, 10);
|
||||||
|
|
||||||
for (Player player : _withers.GetPlayers(true))
|
for (Player player : _withers.GetPlayers(true))
|
||||||
{
|
{
|
||||||
Manager.GetCondition().Factory().Blind("Game Start", player, null, 15, 0, false, false, false);
|
Manager.GetCondition()
|
||||||
|
.Factory()
|
||||||
|
.Blind("Game Start", player, null, 15, 0, false, false,
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
// @EventHandler
|
||||||
// public void playerLivesDisplay(PlayerKitGiveEvent event)
|
// public void playerLivesDisplay(PlayerKitGiveEvent event)
|
||||||
// {
|
// {
|
||||||
// if (!_runners.HasPlayer(event.GetPlayer()))
|
// if (!_runners.HasPlayer(event.GetPlayer()))
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// //Player Lives
|
// //Player Lives
|
||||||
// if (!_lives.containsKey(event.GetPlayer()))
|
// if (!_lives.containsKey(event.GetPlayer()))
|
||||||
// _lives.put(event.GetPlayer(), _livesPerPlayer);
|
// _lives.put(event.GetPlayer(), _livesPerPlayer);
|
||||||
//
|
//
|
||||||
// int lives = _lives.get(event.GetPlayer());
|
// int lives = _lives.get(event.GetPlayer());
|
||||||
//
|
//
|
||||||
// if (lives <= 0)
|
// if (lives <= 0)
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// event.GetPlayer().getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives, C.cGreen + C.Bold + lives + " Lives Remaining"));
|
// event.GetPlayer().getInventory().setItem(8,
|
||||||
// }
|
// ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives,
|
||||||
|
// C.cGreen + C.Bold + lives + " Lives Remaining"));
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void EndCheck()
|
public void EndCheck()
|
||||||
@ -262,23 +271,23 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Players Quit
|
// Players Quit
|
||||||
if (GetPlayers(true).size() < 2)
|
if (GetPlayers(true).size() < 2)
|
||||||
{
|
{
|
||||||
SetState(GameState.End);
|
SetState(GameState.End);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameTeam winner = null;
|
GameTeam winner = null;
|
||||||
|
|
||||||
//Wither Win
|
// Wither Win
|
||||||
if (UtilTime.elapsed(this.GetStateTime(), _gameTime))
|
if (UtilTime.elapsed(this.GetStateTime(), _gameTime))
|
||||||
winner = _runners;
|
winner = _runners;
|
||||||
|
|
||||||
//Runner Win
|
// Runner Win
|
||||||
if (_runners.GetPlayers(true).isEmpty())
|
if (_runners.GetPlayers(true).isEmpty())
|
||||||
winner = _withers;
|
winner = _withers;
|
||||||
|
|
||||||
//Set Win
|
// Set Win
|
||||||
if (winner != null)
|
if (winner != null)
|
||||||
{
|
{
|
||||||
AnnounceEnd(winner);
|
AnnounceEnd(winner);
|
||||||
@ -296,7 +305,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
AddGems(player, 10, "Participation", false, false);
|
AddGems(player, 10, "Participation", false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//End
|
// End
|
||||||
SetState(GameState.End);
|
SetState(GameState.End);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -307,33 +316,40 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
{
|
{
|
||||||
if (!InProgress())
|
if (!InProgress())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getType() != UpdateType.FAST)
|
if (event.getType() != UpdateType.FAST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// int lives = 0;
|
|
||||||
// for (int i : _lives.values())
|
|
||||||
// lives += i;
|
|
||||||
|
|
||||||
//Wipe Last
|
// int lives = 0;
|
||||||
|
// for (int i : _lives.values())
|
||||||
|
// lives += i;
|
||||||
|
|
||||||
|
// Wipe Last
|
||||||
Scoreboard.Reset();
|
Scoreboard.Reset();
|
||||||
|
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
Scoreboard.Write(_runners.GetColor() + C.Bold + _runners.GetName());
|
Scoreboard.Write(_runners.GetColor() + C.Bold + _runners.GetName());
|
||||||
Scoreboard.Write(_runners.GetColor() + "" + _runners.GetPlayers(true).size() + " Players");
|
Scoreboard.Write(_runners.GetColor() + ""
|
||||||
|
+ _runners.GetPlayers(true).size() + " Players");
|
||||||
|
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
Scoreboard.Write(_withers.GetColor() + C.Bold + _withers.GetName());
|
Scoreboard.Write(_withers.GetColor() + C.Bold + _withers.GetName());
|
||||||
Scoreboard.Write(_withers.GetColor() + "" + _withers.GetPlayers(true).size() + " Players");
|
Scoreboard.Write(_withers.GetColor() + ""
|
||||||
|
+ _withers.GetPlayers(true).size() + " Players");
|
||||||
// Scoreboard.WriteBlank();
|
|
||||||
// Scoreboard.Write(C.cYellow + C.Bold + "Humans Alive");
|
// Scoreboard.WriteBlank();
|
||||||
// Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer));
|
// Scoreboard.Write(C.cYellow + C.Bold + "Humans Alive");
|
||||||
|
// Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer));
|
||||||
|
|
||||||
Scoreboard.WriteBlank();
|
Scoreboard.WriteBlank();
|
||||||
Scoreboard.Write(C.cYellow + C.Bold + "Time Left");
|
Scoreboard.Write(C.cYellow + C.Bold + "Time Left");
|
||||||
Scoreboard.Write(UtilTime.MakeStr(Math.max(0, _gameTime - (System.currentTimeMillis() - this.GetStateTime())), 1));
|
Scoreboard.Write(UtilTime.MakeStr(
|
||||||
|
Math.max(
|
||||||
|
0,
|
||||||
|
_gameTime
|
||||||
|
- (System.currentTimeMillis() - this
|
||||||
|
.GetStateTime())), 1));
|
||||||
|
|
||||||
Scoreboard.Draw();
|
Scoreboard.Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +361,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
|
|
||||||
return _runners;
|
return _runners;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean CanJoinTeam(GameTeam team)
|
public boolean CanJoinTeam(GameTeam team)
|
||||||
{
|
{
|
||||||
@ -353,42 +369,42 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
{
|
{
|
||||||
return team.GetSize() < getRequiredWithers();
|
return team.GetSize() < getRequiredWithers();
|
||||||
}
|
}
|
||||||
|
|
||||||
return team.GetSize() < GetPlayers(true).size() - getRequiredWithers();
|
return team.GetSize() < GetPlayers(true).size() - getRequiredWithers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRequiredWithers()
|
public int getRequiredWithers()
|
||||||
{
|
{
|
||||||
return (int)(GetPlayers(true).size()/_witherFactor);
|
return (int) (GetPlayers(true).size() / _witherFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void witherMovement(UpdateEvent event)
|
public void witherMovement(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.getType() != UpdateType.FASTER)
|
if (event.getType() != UpdateType.FASTER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : _withers.GetPlayers(true))
|
for (Player player : _withers.GetPlayers(true))
|
||||||
{
|
{
|
||||||
ArrayList<Location> collisions = new ArrayList<Location>();
|
ArrayList<Location> collisions = new ArrayList<Location>();
|
||||||
|
|
||||||
//Fly Speed
|
// Fly Speed
|
||||||
double speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006;
|
double speed = 0.09 - (_yLimit - player.getLocation().getY()) * 0.006;
|
||||||
|
|
||||||
if (speed > 0.16)
|
if (speed > 0.16)
|
||||||
speed = 0.16;
|
speed = 0.16;
|
||||||
|
|
||||||
if (speed < 0.016)
|
if (speed < 0.016)
|
||||||
speed = 0.016;
|
speed = 0.016;
|
||||||
|
|
||||||
player.setFlySpeed((float)speed);
|
player.setFlySpeed((float) speed);
|
||||||
|
|
||||||
|
// Bump
|
||||||
//Bump
|
for (Block block : UtilBlock.getInRadius(
|
||||||
for (Block block : UtilBlock.getInRadius(player.getLocation().add(0, 0.5, 0), 1.5d).keySet())
|
player.getLocation().add(0, 0.5, 0), 1.5d).keySet())
|
||||||
{
|
{
|
||||||
if (!UtilBlock.airFoliage(block))
|
if (!UtilBlock.airFoliage(block))
|
||||||
{
|
{
|
||||||
@ -396,15 +412,17 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector vec = UtilAlg.getAverageBump(player.getLocation(), collisions);
|
Vector vec = UtilAlg.getAverageBump(player.getLocation(),
|
||||||
|
collisions);
|
||||||
|
|
||||||
if (vec == null)
|
if (vec == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true);
|
UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true);
|
||||||
|
|
||||||
// if (player.getLocation().getY() < _yLimit + 6)
|
// if (player.getLocation().getY() < _yLimit + 6)
|
||||||
// UtilAction.velocity(player, new Vector(0, 1, 0), 0.6, false, 0, 0, 10, true);
|
// UtilAction.velocity(player, new Vector(0, 1, 0), 0.6, false, 0,
|
||||||
|
// 0, 10, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,139 +430,153 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
public void addBlocks(Set<Block> blocks)
|
public void addBlocks(Set<Block> blocks)
|
||||||
{
|
{
|
||||||
Iterator<Block> blockIter = blocks.iterator();
|
Iterator<Block> blockIter = blocks.iterator();
|
||||||
|
|
||||||
while (blockIter.hasNext())
|
while (blockIter.hasNext())
|
||||||
{
|
{
|
||||||
Block block = blockIter.next();
|
Block block = blockIter.next();
|
||||||
|
|
||||||
if (block.getType() == Material.BEDROCK || block.getType() == Material.IRON_BLOCK)
|
if (block.getType() == Material.BEDROCK
|
||||||
|
|| block.getType() == Material.IRON_BLOCK)
|
||||||
blockIter.remove();
|
blockIter.remove();
|
||||||
|
|
||||||
else if (!isInsideMap(block.getLocation()))
|
else if (!isInsideMap(block.getLocation()))
|
||||||
blockIter.remove();
|
blockIter.remove();
|
||||||
|
|
||||||
// else if (UtilAlg.inBoundingBox(block.getLocation(), _safeA, _safeB) || UtilAlg.inBoundingBox(block.getLocation(), _spawnA, _spawnB))
|
// else if (UtilAlg.inBoundingBox(block.getLocation(), _safeA,
|
||||||
// blockIter.remove();
|
// _safeB) || UtilAlg.inBoundingBox(block.getLocation(), _spawnA,
|
||||||
|
// _spawnB))
|
||||||
|
// blockIter.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Block block : blocks)
|
for (Block block : blocks)
|
||||||
_blocks.add(new BlockData(block));
|
_blocks.add(new BlockData(block));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void restoreBlock(Location loc, double radius)
|
public void restoreBlock(Location loc, double radius)
|
||||||
{
|
{
|
||||||
Iterator<BlockData> dataIt = _blocks.iterator();
|
Iterator<BlockData> dataIt = _blocks.iterator();
|
||||||
|
|
||||||
while (dataIt.hasNext())
|
while (dataIt.hasNext())
|
||||||
{
|
{
|
||||||
BlockData data = dataIt.next();
|
BlockData data = dataIt.next();
|
||||||
|
|
||||||
double dist = UtilMath.offset(loc, data.Block.getLocation().add(0.5, 0.5, 0.5));
|
double dist = UtilMath.offset(loc,
|
||||||
|
data.Block.getLocation().add(0.5, 0.5, 0.5));
|
||||||
|
|
||||||
if (dist < radius)
|
if (dist < radius)
|
||||||
{
|
{
|
||||||
Manager.GetBlockRestore().Add(data.Block, 0, (byte)0, data.Material.getId(), data.Data, (long) (6000 * (dist/radius)));
|
Manager.GetBlockRestore().Add(data.Block, 0, (byte) 0,
|
||||||
|
data.Material.getId(), data.Data,
|
||||||
|
(long) (6000 * (dist / radius)));
|
||||||
dataIt.remove();
|
dataIt.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler
|
// @EventHandler
|
||||||
// public void cleanLives(PlayerQuitEvent event)
|
// public void cleanLives(PlayerQuitEvent event)
|
||||||
// {
|
// {
|
||||||
// _lives.remove(event.getPlayer());
|
// _lives.remove(event.getPlayer());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// @EventHandler
|
// @EventHandler
|
||||||
// public void livesUpdate(UpdateEvent event)
|
// public void livesUpdate(UpdateEvent event)
|
||||||
// {
|
// {
|
||||||
// if (!IsLive())
|
// if (!IsLive())
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// if (event.getType() != UpdateType.FASTER)
|
// if (event.getType() != UpdateType.FASTER)
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// Iterator<Player> playerIter = _lives.keySet().iterator();
|
// Iterator<Player> playerIter = _lives.keySet().iterator();
|
||||||
//
|
//
|
||||||
// while (playerIter.hasNext())
|
// while (playerIter.hasNext())
|
||||||
// {
|
// {
|
||||||
// Player player = playerIter.next();
|
// Player player = playerIter.next();
|
||||||
//
|
//
|
||||||
// if (!player.isOnline() || !_runners.HasPlayer(player))
|
// if (!player.isOnline() || !_runners.HasPlayer(player))
|
||||||
// playerIter.remove();
|
// playerIter.remove();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void arrowDamage(CustomDamageEvent event)
|
public void arrowDamage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.GetProjectile() == null)
|
if (event.GetProjectile() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.AddMult(GetName(), "Arrow Mod", 0.75, false);
|
event.AddMult(GetName(), "Arrow Mod", 0.75, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void damageOut(CustomDamageEvent event)
|
public void damageOut(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.IsCancelled())
|
if (event.IsCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.GetDamageePlayer() == null)
|
if (event.GetDamageePlayer() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event.GetDamage() < event.GetDamageePlayer().getHealth())
|
if (event.GetDamage() < event.GetDamageePlayer().getHealth())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.SetCancelled("Fake Death");
|
event.SetCancelled("Fake Death");
|
||||||
|
|
||||||
event.GetDamageePlayer().playEffect(EntityEffect.HURT);
|
event.GetDamageePlayer().playEffect(EntityEffect.HURT);
|
||||||
|
|
||||||
playerOut(event.GetDamageePlayer());
|
playerOut(event.GetDamageePlayer());
|
||||||
|
|
||||||
if (event.GetDamagerPlayer(true) != null)
|
if (event.GetDamagerPlayer(true) != null)
|
||||||
{
|
{
|
||||||
AddGems(event.GetDamagerPlayer(true), 2, "Humans Stunned", true, true);
|
AddGems(event.GetDamagerPlayer(true), 2, "Humans Stunned", true,
|
||||||
|
true);
|
||||||
Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen + event.GetDamageePlayer().getName() + C.cGray + " was killed by " + C.cRed + event.GetDamagerPlayer(true).getName() + C.cGray + ".");
|
|
||||||
|
Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen
|
||||||
|
+ event.GetDamageePlayer().getName() + C.cGray
|
||||||
|
+ " was killed by " + C.cRed
|
||||||
|
+ event.GetDamagerPlayer(true).getName() + C.cGray + ".");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen + event.GetDamageePlayer().getName() + C.cGray + " was killed.");
|
Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen
|
||||||
|
+ event.GetDamageePlayer().getName() + C.cGray
|
||||||
|
+ " was killed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playerOut(Player player)
|
public void playerOut(Player player)
|
||||||
{
|
{
|
||||||
//State
|
// State
|
||||||
SetPlayerState(player, PlayerState.OUT);
|
SetPlayerState(player, PlayerState.OUT);
|
||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
|
|
||||||
player.setFlySpeed(0.1f);
|
player.setFlySpeed(0.1f);
|
||||||
|
|
||||||
//Conditions
|
// Conditions
|
||||||
Manager.GetCondition().Factory().Blind("Hit", player, player, 1.5, 0, false, false, false);
|
Manager.GetCondition().Factory()
|
||||||
Manager.GetCondition().Factory().Cloak("Hit", player, player, 9999, false, false);
|
.Blind("Hit", player, player, 1.5, 0, false, false, false);
|
||||||
|
Manager.GetCondition().Factory()
|
||||||
|
.Cloak("Hit", player, player, 9999, false, false);
|
||||||
|
|
||||||
//Settings
|
// Settings
|
||||||
player.setAllowFlight(true);
|
player.setAllowFlight(true);
|
||||||
player.setFlying(true);
|
player.setFlying(true);
|
||||||
((CraftPlayer)player).getHandle().spectating = true;
|
((CraftPlayer) player).getHandle().spectating = true;
|
||||||
((CraftPlayer)player).getHandle().k = false;
|
((CraftPlayer) player).getHandle().k = false;
|
||||||
|
|
||||||
player.setVelocity(new Vector(0,1.2,0));
|
player.setVelocity(new Vector(0, 1.2, 0));
|
||||||
|
|
||||||
_doubles.put(player, new PlayerCopy(this, player, ChatColor.YELLOW));
|
_doubles.put(player, new PlayerCopy(this, player, ChatColor.YELLOW));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playerIn(final Player player, final LivingEntity copy)
|
public void playerIn(final Player player, final LivingEntity copy)
|
||||||
{
|
{
|
||||||
//State
|
// State
|
||||||
SetPlayerState(player, PlayerState.IN);
|
SetPlayerState(player, PlayerState.IN);
|
||||||
player.setHealth(20);
|
player.setHealth(20);
|
||||||
|
|
||||||
//Teleport
|
// Teleport
|
||||||
if (copy != null)
|
if (copy != null)
|
||||||
{
|
{
|
||||||
Location loc = player.getLocation();
|
Location loc = player.getLocation();
|
||||||
@ -554,43 +586,49 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
player.teleport(loc);
|
player.teleport(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Settings
|
// Settings
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
player.setFlying(false);
|
player.setFlying(false);
|
||||||
((CraftPlayer)player).getHandle().spectating = false;
|
((CraftPlayer) player).getHandle().spectating = false;
|
||||||
((CraftPlayer)player).getHandle().k = true;
|
((CraftPlayer) player).getHandle().k = true;
|
||||||
|
|
||||||
//Items
|
// Items
|
||||||
player.getInventory().remove(Material.WATCH);
|
player.getInventory().remove(Material.WATCH);
|
||||||
player.getInventory().remove(Material.COMPASS);
|
player.getInventory().remove(Material.COMPASS);
|
||||||
|
|
||||||
//Inform
|
// Inform
|
||||||
UtilPlayer.message(player, F.main("Game", "You have been revived!"));
|
UtilPlayer.message(player, F.main("Game", "You have been revived!"));
|
||||||
|
|
||||||
//Delayed Visibility
|
// Delayed Visibility
|
||||||
if (copy != null)
|
if (copy != null)
|
||||||
{
|
{
|
||||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
|
UtilServer
|
||||||
{
|
.getServer()
|
||||||
public void run()
|
.getScheduler()
|
||||||
{
|
.scheduleSyncDelayedTask(Manager.getPlugin(),
|
||||||
//Remove Invis
|
new Runnable()
|
||||||
if (IsAlive(player))
|
{
|
||||||
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null);
|
public void run()
|
||||||
|
{
|
||||||
|
// Remove Invis
|
||||||
|
if (IsAlive(player))
|
||||||
|
Manager.GetCondition().EndCondition(
|
||||||
|
player, ConditionType.CLOAK,
|
||||||
|
null);
|
||||||
|
|
||||||
//Remove Copy
|
// Remove Copy
|
||||||
copy.remove();
|
copy.remove();
|
||||||
}
|
}
|
||||||
}, 4);
|
}, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void revive(ProjectileHitEvent event)
|
public void revive(ProjectileHitEvent event)
|
||||||
{
|
{
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(event.getEntity() instanceof ThrownPotion))
|
if (!(event.getEntity() instanceof ThrownPotion))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -600,12 +638,13 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
if (!(event.getEntity().getShooter() instanceof Player))
|
if (!(event.getEntity().getShooter() instanceof Player))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player thrower = (Player)event.getEntity().getShooter();
|
Player thrower = (Player) event.getEntity().getShooter();
|
||||||
|
|
||||||
GameTeam throwerTeam = GetTeam(thrower);
|
GameTeam throwerTeam = GetTeam(thrower);
|
||||||
if (throwerTeam == null) return;
|
if (throwerTeam == null)
|
||||||
|
return;
|
||||||
|
|
||||||
//Revive
|
// Revive
|
||||||
Iterator<PlayerCopy> copyIterator = _doubles.values().iterator();
|
Iterator<PlayerCopy> copyIterator = _doubles.values().iterator();
|
||||||
while (copyIterator.hasNext())
|
while (copyIterator.hasNext())
|
||||||
{
|
{
|
||||||
@ -615,7 +654,8 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
if (otherTeam == null || !otherTeam.equals(throwerTeam))
|
if (otherTeam == null || !otherTeam.equals(throwerTeam))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (UtilMath.offset(copy.GetEntity().getLocation().add(0,1,0), event.getEntity().getLocation()) > 3)
|
if (UtilMath.offset(copy.GetEntity().getLocation().add(0, 1, 0),
|
||||||
|
event.getEntity().getLocation()) > 3)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
playerIn(copy.GetPlayer(), copy.GetEntity());
|
playerIn(copy.GetPlayer(), copy.GetEntity());
|
||||||
@ -624,30 +664,31 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
AddGems(thrower, 3, "Revived Ally", true, true);
|
AddGems(thrower, 3, "Revived Ally", true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Revive
|
// Revive
|
||||||
for (Player player : GetPlayers(true))
|
for (Player player : GetPlayers(true))
|
||||||
{
|
{
|
||||||
GameTeam otherTeam = GetTeam(player);
|
GameTeam otherTeam = GetTeam(player);
|
||||||
if (otherTeam == null || !otherTeam.equals(throwerTeam))
|
if (otherTeam == null || !otherTeam.equals(throwerTeam))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (UtilMath.offset(player.getLocation().add(0,1,0), event.getEntity().getLocation()) > 3)
|
if (UtilMath.offset(player.getLocation().add(0, 1, 0), event
|
||||||
|
.getEntity().getLocation()) > 3)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
playerIn(player, null);
|
playerIn(player, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void removePotionEffect(UpdateEvent event)
|
public void removePotionEffect(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.TICK)
|
if (event.getType() != UpdateType.TICK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : GetPlayers(true))
|
for (Player player : GetPlayers(true))
|
||||||
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
|
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void skeletonDamage(CustomDamageEvent event)
|
public void skeletonDamage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
@ -660,7 +701,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void skeletonCombust(EntityCombustEvent event)
|
public void skeletonCombust(EntityCombustEvent event)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user