Skip to content

Commit

Permalink
SecTransferCookieRetrieve - delay event in section to make sure kick …
Browse files Browse the repository at this point in the history
…effect works
  • Loading branch information
ShaneBeee committed Dec 29, 2024
1 parent 07ca112 commit 8177883
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import ch.njol.skript.doc.Examples;
import ch.njol.skript.doc.Name;
import ch.njol.skript.doc.Since;
import ch.njol.skript.effects.Delay;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.Section;
import ch.njol.skript.lang.SkriptParser.ParseResult;
Expand Down Expand Up @@ -48,7 +49,7 @@ public class SecTransferCookieRetrieve extends Section {

static {
Skript.registerSection(SecTransferCookieRetrieve.class,
"retrieve cookie with key %namespacedkey/string% from %player%");
"retrieve cookie with key %namespacedkey/string% [from %player%]");
}

private Expression<?> key;
Expand Down Expand Up @@ -91,6 +92,7 @@ public boolean init(Expression<?>[] exprs, int matchedPattern, Kleenean isDelaye
if (key == null) return next;

player.retrieveCookie(key).thenAccept(bytes -> {
Delay.addDelayedEvent(event); // Delay event to make sure kick effect still works
String cookie = new String(bytes);
ExprTransferCookie.setLastTransferCookie(cookie);
walkNext(localVars, event, first, next);
Expand Down

0 comments on commit 8177883

Please sign in to comment.