2018-08-28 06:13:14 +00:00
|
|
|
package com.seodisparate.TurnBasedMinecraft.common;
|
|
|
|
|
|
|
|
public class BattleUpdater implements Runnable
|
|
|
|
{
|
2018-08-29 06:09:44 +00:00
|
|
|
private BattleManager manager;
|
|
|
|
private boolean isRunning;
|
2018-08-28 06:13:14 +00:00
|
|
|
|
|
|
|
public BattleUpdater(BattleManager manager)
|
|
|
|
{
|
|
|
|
this.manager = manager;
|
2018-08-29 06:09:44 +00:00
|
|
|
isRunning = true;
|
2018-08-28 06:13:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
2018-08-29 06:09:44 +00:00
|
|
|
while(isRunning)
|
2018-08-28 06:13:14 +00:00
|
|
|
{
|
2018-08-29 06:09:44 +00:00
|
|
|
for(Battle e : manager.battleMap.values())
|
|
|
|
{
|
|
|
|
e.update();
|
|
|
|
}
|
|
|
|
try { Thread.sleep(250); } catch (Exception e) { /* ignored */ }
|
2018-08-28 06:13:14 +00:00
|
|
|
}
|
2018-08-29 06:09:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setIsRunning(boolean isRunning)
|
|
|
|
{
|
|
|
|
this.isRunning = isRunning;
|
2018-08-28 06:13:14 +00:00
|
|
|
}
|
|
|
|
}
|