Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ public void onMessage(String message) {

byte[] bytes = (value + '\0' + signature)
.getBytes(StandardCharsets.UTF_8);
PluginMessageUtils.sendMessage(session, PluginMessageChannels.SKIN, bytes);
// Wait until the session is actually spawned before sending, otherwise
// the plugin message can land during the proxy's null-connection window
// on initial join and be silently dropped by Velocity.
sendSkinWhenSpawned(geyser, session, bytes, 0);
}
break;
case LOG_MESSAGE:
Expand Down Expand Up @@ -242,6 +245,19 @@ public void uploadSkin(GeyserSession session) {
}
}

private void sendSkinWhenSpawned(GeyserImpl geyser, GeyserSession session, byte[] bytes, int attempt) {
if (session.isClosed() || attempt >= 10) {
return;
}
if (session.isSpawned()) {
PluginMessageUtils.sendMessage(session, PluginMessageChannels.SKIN, bytes);
return;
}
geyser.getScheduledThread().schedule(
() -> sendSkinWhenSpawned(geyser, session, bytes, attempt + 1),
500, TimeUnit.MILLISECONDS);
}

private void reconnectLater(GeyserImpl geyser) {
// we can only reconnect when the thread pool is open
if (geyser.getScheduledThread().isShutdown() || closed) {
Expand Down
Loading