Force the ball to drop if the carrier is AFK

This commit is contained in:
AlexTheCoder 2016-06-27 21:07:44 -04:00
parent 5b32eb4815
commit beeddfedd4
1 changed files with 16 additions and 0 deletions

View File

@ -67,6 +67,7 @@ public class Basketball extends TeamGame
private boolean _frozen = false;
private long _lastDribbleAnim = 0;
private long _lastDribbleMove = 0;
private HashMap<GameTeam, Block> _hoops = new HashMap<>();
private ScoringManager _score;
@ -243,6 +244,7 @@ public class Basketball extends TeamGame
private void catchBall(Player player)
{
_lastDribbleMove = System.currentTimeMillis();
_dribbling = player;
for (int i = 0; i < 8; i++)
{
@ -279,6 +281,7 @@ public class Basketball extends TeamGame
public void stealBall(Player to, Player from)
{
Recharge.Instance.use(to, "ThrowBall", 1500, false, false, false);
_lastDribbleMove = System.currentTimeMillis();
_dribbling = to;
for (int i = 0; i < 8; i++)
{
@ -349,6 +352,7 @@ public class Basketball extends TeamGame
teleport.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(teleport, WorldData.GetCustomLocs(DataLoc.CENTER_COURT.getKey()).get(0))));
carrier.teleport(teleport);
_lastDribbleMove = System.currentTimeMillis();
_dribbling = carrier;
for (int i = 0; i < 8; i++)
{
@ -616,6 +620,14 @@ public class Basketball extends TeamGame
}
dribble();
if (_dribbling != null)
{
if (UtilTime.elapsed(_lastDribbleMove, 15000))
{
throwBall(_dribbling, false);
}
}
}
if (event.getType() == UpdateType.FASTER)
@ -653,6 +665,10 @@ public class Basketball extends TeamGame
event.getPlayer().setVelocity(bounce.normalize());
event.getPlayer().sendMessage(F.main("Game", "You aren't allowed to go out of bounds!"));
}
if (_dribbling != null && event.getPlayer().getEntityId() == _dribbling.getEntityId())
{
_lastDribbleMove = System.currentTimeMillis();
}
}
@EventHandler