UHC changes

This commit is contained in:
Mini-Chiss 2015-05-11 12:27:43 -05:00
parent 9b0736816b
commit 5ec60d234a
2 changed files with 15 additions and 49 deletions

View File

@ -96,13 +96,10 @@ public class UHC extends TeamGame
private long _hour = 3600000; private long _hour = 3600000;
private long _createTime; private long _createTime;
private long _serverTime; private long _serverTime;
private boolean _joinable = false; private boolean _mapLoaded = false;
private boolean _ended = false;
private boolean xrayDebug = false; private boolean xrayDebug = false;
private long lastInform = 0;
public UHC(ArcadeManager manager) public UHC(ArcadeManager manager)
{ {
super(manager, GameType.UHC, super(manager, GameType.UHC,
@ -1076,28 +1073,6 @@ public class UHC extends TeamGame
return _serverTime + (System.currentTimeMillis() - _createTime); return _serverTime + (System.currentTimeMillis() - _createTime);
} }
@EventHandler
public void returnToHub(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (_joinable)
return;
//Cannot become Joinable within first 10 seconds of creation
if (!UtilTime.elapsed(_createTime, 10000))
{
return;
}
//Become Joinable (first 5 seconds of the hour)
if (getServerTime() % _hour < 5000)
{
_joinable = true;
}
}
@Override @Override
public boolean CanJoinTeam(GameTeam team) public boolean CanJoinTeam(GameTeam team)
{ {
@ -1156,25 +1131,6 @@ public class UHC extends TeamGame
} }
} }
@EventHandler(priority = EventPriority.MONITOR)
public void setEnded(final GameStateChangeEvent event)
{
if (!Manager.IsRewardItems())
return;
if (event.GetState() != GameState.Dead)
return;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
public void run()
{
_ended = true;
}
}, 360);
//Delay 18 Seconds
}
@Override @Override
public double GetKillsGems(Player killer, Player killed, boolean assist) public double GetKillsGems(Player killer, Player killed, boolean assist)
{ {
@ -1245,10 +1201,10 @@ public class UHC extends TeamGame
return ChatColor.YELLOW + "In Progress"; return ChatColor.YELLOW + "In Progress";
} }
//Not Joinable Yet //Not Loaded (but still joinable)
if (!_joinable) if (!_mapLoaded)
{ {
return ChatColor.GOLD + "Open in " + UtilTime.MakeStr(_hour - (getServerTime() % _hour)); return ChatColor.GOLD + "Generating Map...";
} }
return ChatColor.GREEN + "Recruiting"; return ChatColor.GREEN + "Recruiting";
@ -1425,4 +1381,9 @@ public class UHC extends TeamGame
} }
} }
} }
public boolean isMapLoaded()
{
return _mapLoaded;
}
} }

View File

@ -224,7 +224,12 @@ public class GameManager implements Listener
public void StateCountdown(Game game, int timer, boolean force) public void StateCountdown(Game game, int timer, boolean force)
{ {
if (game instanceof UHC)
{
if (((UHC)game).isMapLoaded())
return;
}
//Disabling Cosmetics //Disabling Cosmetics
if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled) if (game.GetCountdown() <= 5 && game.GetCountdown() >= 0 && game.GadgetsDisabled)
{ {