Skip to content

Commit

Permalink
Fix missing Responses in TimedEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
qixils committed Oct 13, 2021
1 parent 209a867 commit 40ee15c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>dev.qixils.crowdcontrol</groupId>
<artifactId>java-crowd-control</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>

<name>java-crowd-control</name>
<description>Library for interacting with a crowdcontrol.live server</description>
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/dev/qixils/crowdcontrol/TimedEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,16 @@ public void queue() throws IllegalStateException {
if (startedAt != -1)
throw new IllegalStateException("Effect has already started");

if (!ACTIVE_EFFECTS.containsKey(effect)) {
TimedEffect activeEffect = ACTIVE_EFFECTS.get(effect);

if (activeEffect == null || (activeEffect.isComplete() && (!QUEUED_EFFECTS.containsKey(effect) || QUEUED_EFFECTS.get(effect).isEmpty()))) {
start();
return;
}

Queue<TimedEffect> queue = QUEUED_EFFECTS.computeIfAbsent(effect, $ -> new ConcurrentLinkedQueue<>());
if (!queue.isEmpty())
cc.dispatchResponse(Response.builder().id(id).type(Response.ResultType.QUEUE).build());
queue.add(this);
cc.dispatchResponse(Response.builder().id(id).type(Response.ResultType.QUEUE).build());
}

private void start() {
Expand Down

0 comments on commit 40ee15c

Please sign in to comment.