12
0

Fix MissileWars.getFightTime

Dieser Commit ist enthalten in:
jojo 2020-09-20 13:18:20 +02:00
Ursprung 25ae5ce352
Commit f09c856b32

Datei anzeigen

@ -45,7 +45,7 @@ public class MissileWars extends JavaPlugin {
public void onLoad() {
plugin = this;
fightState = FightState.WAITING;
startTime = System.currentTimeMillis();
startTime = -1;
}
@Override
@ -87,6 +87,7 @@ public class MissileWars extends JavaPlugin {
if (fightState != FightState.WAITING) // anti dual-call
return;
fightState = FightState.FIGHTING;
startTime = System.currentTimeMillis();
StateDependent.setupState(fightState);
startTime = System.currentTimeMillis();
@ -147,6 +148,7 @@ public class MissileWars extends JavaPlugin {
* @return seconds since start
*/
public static int getFightTime() {
return Math.floorDiv((int) (System.currentTimeMillis() - startTime), 60);
if (startTime == -1) return -1;
return (int)((System.currentTimeMillis() - startTime) / 1000);
}
}