[commands] Revert to original Trigger implementation (#4673)

Trigger was refactored to use BooleanEvent when it was introduced in #4104.
This reverts to the original implementation until edge-based BooleanEvents can be fixed.
This commit is contained in:
Starlight220
2022-11-28 23:48:48 +02:00
committed by GitHub
parent 15561338d5
commit cb38bacfe8
14 changed files with 555 additions and 243 deletions

View File

@@ -16,8 +16,8 @@ class EventLoopTest {
var counterTrue = new AtomicInteger(0);
var counterFalse = new AtomicInteger(0);
var loop = new EventLoop();
loop.bind(() -> true, counterTrue::incrementAndGet);
loop.bind(() -> false, counterFalse::incrementAndGet);
new BooleanEvent(loop, () -> true).ifHigh(counterTrue::incrementAndGet);
new BooleanEvent(loop, () -> false).ifHigh(counterFalse::incrementAndGet);
assertEquals(0, counterTrue.get());
assertEquals(0, counterFalse.get());
@@ -40,7 +40,7 @@ class EventLoopTest {
var loop = new EventLoop();
// first ensure binding works
loop.bind(condition::get, counter::incrementAndGet);
new BooleanEvent(loop, condition::get).ifHigh(counter::incrementAndGet);
condition.set(false);
loop.poll();