mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2026-02-03 21:55:05 +01:00
Run delayed velocity tasks under our scheduler too
This commit is contained in:
@@ -25,13 +25,13 @@
|
||||
*/
|
||||
package com.github.games647.fastlogin.velocity;
|
||||
|
||||
import com.github.games647.fastlogin.core.AsyncScheduler;
|
||||
import com.github.games647.fastlogin.core.hooks.bedrock.BedrockService;
|
||||
import com.github.games647.fastlogin.core.hooks.bedrock.FloodgateService;
|
||||
import com.github.games647.fastlogin.core.hooks.bedrock.GeyserService;
|
||||
import com.github.games647.fastlogin.core.message.ChangePremiumMessage;
|
||||
import com.github.games647.fastlogin.core.message.ChannelMessage;
|
||||
import com.github.games647.fastlogin.core.message.SuccessMessage;
|
||||
import com.github.games647.fastlogin.core.scheduler.AsyncScheduler;
|
||||
import com.github.games647.fastlogin.core.shared.FastLoginCore;
|
||||
import com.github.games647.fastlogin.core.shared.PlatformPlugin;
|
||||
import com.github.games647.fastlogin.velocity.listener.ConnectListener;
|
||||
|
||||
@@ -53,11 +53,11 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ConnectListener {
|
||||
|
||||
@@ -167,10 +167,9 @@ public class ConnectListener {
|
||||
// In this case it means that the force command (plugin message) is already received and processed while
|
||||
// player is still in the login phase and reported to be offline.
|
||||
Runnable loginTask = new ForceLoginTask(plugin.getCore(), player, server, session);
|
||||
plugin.getProxy().getScheduler()
|
||||
.buildTask(plugin, loginTask)
|
||||
.delay(1L, TimeUnit.SECONDS) // Delay at least one second, otherwise the login command can be missed
|
||||
.schedule();
|
||||
|
||||
// Delay at least one second, otherwise the login command can be missed
|
||||
plugin.getScheduler().runAsyncDelayed(loginTask, Duration.ofSeconds(1));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -35,8 +35,8 @@ import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.time.Duration;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class FloodgateAuthTask
|
||||
extends FloodgateManagement<Player, CommandSource, VelocityLoginSession, FastLoginVelocity> {
|
||||
@@ -62,10 +62,7 @@ public class FloodgateAuthTask
|
||||
// In this case it means that the force command (plugin message) is already received and processed while
|
||||
// player is still in the login phase and reported to be offline.
|
||||
Runnable loginTask = new ForceLoginTask(core.getPlugin().getCore(), player, server, session, forcedOnlineMode);
|
||||
core.getPlugin().getProxy().getScheduler()
|
||||
.buildTask(core.getPlugin(), () -> core.getPlugin().getScheduler().runAsync(loginTask))
|
||||
.delay(1L, TimeUnit.SECONDS) // Delay at least one second, otherwise the login command can be missed
|
||||
.schedule();
|
||||
core.getPlugin().getScheduler().runAsyncDelayed(loginTask, Duration.ofSeconds(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user