fix: delay 5 seconds before thinking that the server is vanilla (this is confirmed to still work on actual vanilla servers and on kaboom too)

5 seconds because the server sends out the commands packet a bit later after login, but it seems like the player left packet (which is used to detect vanish) is sent before that
This commit is contained in:
ChomeNS
2025-06-08 11:51:48 +07:00
parent ef3298e3f8
commit 32f93f247e
3 changed files with 6 additions and 3 deletions

View File

@@ -1 +1 @@
3447
3450

View File

@@ -75,7 +75,7 @@ public class Bot extends SessionAdapter {
public int connectAttempts = 0;
public boolean loggedIn = false;
public long loginTime;
public long loginTime = System.currentTimeMillis();
public final ExecutorService executorService = Main.EXECUTOR_SERVICE;
public final ScheduledExecutorService executor = Main.EXECUTOR;

View File

@@ -368,7 +368,10 @@ public class PlayersPlugin implements Listener {
if (target == null) return;
if (!bot.serverFeatures.hasNamespaces || target.profile.getName().isEmpty() /* LoL empty string username lazy fix */) {
if (
(System.currentTimeMillis() - bot.loginTime > 5 * 1000 && !bot.serverFeatures.hasNamespaces)
|| target.profile.getName().isEmpty() // LoL empty string username lazy fix
) {
final boolean removed = list.remove(target);
if (removed) {