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