fix: fixed a bug where the the timeoutTime is negative

This commit is contained in:
Yannik Bretschneider 2021-06-08 01:39:17 +02:00
parent 7d486df64f
commit 96ce2ebde2

View File

@ -50,7 +50,7 @@ public class TimeoutTimer {
if (player1AlmostTimeout != null) player1AlmostTimeout.cancel(false); if (player1AlmostTimeout != null) player1AlmostTimeout.cancel(false);
player1AlmostTimeout = player1AlmostTimeout =
timer.schedule(() -> { timer.schedule(() -> {
almostTimeoutCallback.accept(participant, almostTimeoutTime - timeoutTime); almostTimeoutCallback.accept(participant, timeoutTime - almostTimeoutTime);
return participant; return participant;
}, this.almostTimeoutTime, TimeUnit.SECONDS); }, this.almostTimeoutTime, TimeUnit.SECONDS);
@ -66,7 +66,7 @@ public class TimeoutTimer {
if (player2AlmostTimeout != null) player2AlmostTimeout.cancel(false); if (player2AlmostTimeout != null) player2AlmostTimeout.cancel(false);
player2AlmostTimeout = player2AlmostTimeout =
timer.schedule(() -> { timer.schedule(() -> {
almostTimeoutCallback.accept(participant, almostTimeoutTime - timeoutTime); almostTimeoutCallback.accept(participant, timeoutTime - almostTimeoutTime);
return participant; return participant;
}, this.almostTimeoutTime, TimeUnit.SECONDS); }, this.almostTimeoutTime, TimeUnit.SECONDS);