SteamWar/MissileWars
Archiviert
13
0

Update1.0 #11

Geschlossen
YoyoNow möchte 11 Commits von Update1.0 nach master mergen
Nur Änderungen aus Commit f09c856b32 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

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