Adding some descriptions.

This commit is contained in:
Sarah 2015-12-11 22:06:23 +01:00
parent ffb75a7832
commit 09e5aed6e7

View File

@ -48,6 +48,9 @@ public abstract class GameTutorial
_players = new HashMap<>();
}
/**
* start the Tutorial (never use this)
*/
final public void start()
{
_hasStarted = true;
@ -55,7 +58,6 @@ public abstract class GameTutorial
for(TutorialPhase phase : _phases)
phase.setTutorial(this);
//Manager.GetGame().PrepareTime = 60000;
Manager.GetChat().Silence(60000, false);
_started = System.currentTimeMillis();
Manager.getPluginManager().callEvent(new GameTutorialStartEvent(this));
@ -73,6 +75,9 @@ public abstract class GameTutorial
_currentPhase.teleport();
}
/**
* Stting next Phase/ending Tutorial
*/
protected void nextPhase(boolean phaseOne)
{
TutorialPhase from = _currentPhase;
@ -81,6 +86,7 @@ public abstract class GameTutorial
if(_currentPhase == null)
{
// has ended
if(!CustomEnding)
{
onEnd();
@ -99,6 +105,7 @@ public abstract class GameTutorial
}
else
{
// setting another Phase, if Tutorial hasn't stopped yet
if(!_hasEnded)
{
Manager.GetChat().Silence(70000, false);
@ -118,12 +125,12 @@ public abstract class GameTutorial
{
for(final Player player : _players.keySet())
{
//VisibilityManager.Instance.setVisibility(player, true, UtilServer.getPlayers());
Manager.runSyncLater(new Runnable()
{
@Override
public void run()
{
// Player visibility/fly mode
for(Player player : Manager.GetGame().GetPlayers(true))
{
for(Player other : Manager.GetGame().GetPlayers(true))
@ -142,17 +149,20 @@ public abstract class GameTutorial
@Override
public void run()
{
// Spawn teleporting
_team.SpawnTeleport();
}
}, 5);
}
}
// setting the right prepare Time after the Tutorial ends
Manager.GetChat().Silence(StartAfterTutorial, false);
Manager.GetGame().PrepareTime = (System.currentTimeMillis() - Manager.GetGame().GetStateTime()) + StartAfterTutorial;
}
protected TutorialPhase getNextPhase()
{
// getting next TutorialPhase
for(TutorialPhase phase : _phases)
{
if(_currentPhase == null && phase.ID() == 1)
@ -171,13 +181,13 @@ public abstract class GameTutorial
{
for(Player player : UtilServer.getPlayers())
{
// setting Players into fly mode and save their Locations
int i = 0;
if(Manager.GetGame().GetTeam(player) == _team)
{
_players.put(player, Manager.GetGame().GetTeam(player).GetSpawns().get(i));
player.setAllowFlight(true);
player.setFlying(true);
// VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers());
i++;
}
}
@ -213,10 +223,16 @@ public abstract class GameTutorial
return _team;
}
/**
* only available if CustomEnding is enabled
* You can end the tutorial with this method
* if you set CutomEnding to true, you have to run this method!
*/
public void end()
{
if(CustomEnding)
{
// Ending
onEnd();
_hasEnded = true;
Thread thread = _currentPhase.getThread();
@ -250,6 +266,7 @@ public abstract class GameTutorial
public int tick()
{
// Fix for Visibility Manager not really working
if(!_hasEnded && hasStarted())
{
for(Player player : UtilServer.getPlayers())