timer fixes.

This commit is contained in:
Sarah 2015-12-06 22:41:04 +01:00
parent 64f8ee7280
commit 10d26ca32b
2 changed files with 24 additions and 1 deletions

View File

@ -54,7 +54,7 @@ public abstract class GameTutorial
for(TutorialPhase phase : _phases)
phase.setTutorial(this);
Manager.GetGame().PrepareTime = 60000;
//Manager.GetGame().PrepareTime = 60000;
Manager.GetChat().Silence(60000, false);
_started = System.currentTimeMillis();
Manager.getPluginManager().callEvent(new GameTutorialStartEvent(this));
@ -213,6 +213,11 @@ public abstract class GameTutorial
return _tick;
}
public TutorialPhase[] getPhases()
{
return _phases;
}
public long getTutorialStart()
{
return _started;

View File

@ -36,6 +36,8 @@ import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.uhc.UHC;
import nautilus.game.arcade.gametutorial.GameTutorial;
import nautilus.game.arcade.gametutorial.TutorialPhase;
import nautilus.game.arcade.gametutorial.TutorialText;
import org.bukkit.ChatColor;
import org.bukkit.Color;
@ -147,14 +149,25 @@ public class GameManager implements Listener
if(player.getWorld() == Manager.GetLobby().GetSpawn().getWorld())
return true;
}
long prepTime = 0;
for(GameTeam team : game.GetTeamList())
{
long timeUsage = 0;
if(team.getTutorial() != null)
{
if(!team.getTutorial().hasStarted())
{
team.getTutorial().setTeam(team);
team.getTutorial().start();
timeUsage = team.getTutorial().StartAfterTutorial;
timeUsage = timeUsage + (team.getTutorial().TimeBetweenPhase * team.getTutorial().getPhases().length);
for(TutorialPhase phase : team.getTutorial().getPhases())
{
for(TutorialText text : phase.getText())
{
timeUsage = timeUsage + (text.getStayTime() * 50);
}
}
}
if(!team.getTutorial().hasEnded())
{
@ -168,7 +181,12 @@ public class GameManager implements Listener
finished = true;
}
}
if(prepTime <= timeUsage)
prepTime = timeUsage;
}
if(prepTime > 0)
Manager.GetGame().PrepareTime = prepTime;
if(!finished)
return true;
}