Achievements now need 75%+ players at START of game

This commit is contained in:
Chiss 2014-08-27 08:57:11 +10:00
parent d9e1f35985
commit f9ce0d353c
3 changed files with 17 additions and 1 deletions

View File

@ -207,6 +207,8 @@ public abstract class Game implements Listener
public boolean EloRanking = false;
public int EloStart = 1000;
public boolean CanAddStats = true;
public ArrayList<String> GemBoosters = new ArrayList<String>();
private final Set<StatTracker<? extends Game>> _statTrackers = new HashSet<>();

View File

@ -271,6 +271,20 @@ public class GameManager implements Listener
event.GetGame().DeregisterKits();
}
@EventHandler
public void StatEnableDisable(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
int requirement = (int)((double)event.GetGame().Manager.GetPlayerFull() * 0.75d);
event.GetGame().CanAddStats = (double)event.GetGame().GetPlayers(true).size() >= requirement;
if (!event.GetGame().CanAddStats)
event.GetGame().Announce(C.Bold + "Stats/Achievements Disabled. Requires " + requirement + " Players.");
}
@EventHandler
public void StatRegister(GameStateChangeEvent event)
{

View File

@ -21,7 +21,7 @@ public class StatTracker<G extends Game> implements Listener
public boolean canAddStats()
{
return getGame().GetPlayers(false).size() * 4 >= 3 * getGame().Manager.GetPlayerFull();
return getGame().CanAddStats;
}
public void addStat(Player player, String stat, int value, boolean limitTo1, boolean global)