#Quit message not appearing

1 messages · Page 1 of 1 (latest)

cursive briar
#

Quick question, why is it that when I get kicked with a kick message, sometimes I just get Connection Lost: Discnonected instead of the message the server sent?

This is what happens when I join, basically:

[10:39:48] [User Authenticator #10/INFO]: UUID of player IkeVoodoo is 2e4d673c-89d8-4955-93d0-fd3fb2124e67
[10:39:48] [Server thread/INFO]: IkeVoodoo lost connection: You have been eliminated! Remaining time: infinite You will be revived at never
[10:39:49] [Server thread/INFO]: IkeVoodoo left the game.
[10:39:49] [Server thread/WARN]: handleDisconnection() called twice

the image is what I see, but it doesn't always happen

solid night
#

send coode

cursive briar
# solid night send coode
@EventHandler
public void on(PlayerJoinEvent) {
    player.kickPlayer(
            MinecraftColor.replaceColorCodes('&', data.configuration().playerMessage())
                    .replace("{{time_remaining}}", banTime == Long.MAX_VALUE ? "infinite" : TimeFormatter.formatDuration(remainingSeconds))
                    .replace("{{revived_at}}", banTime == Long.MAX_VALUE ? "never" : TimeFormatter.formatDate(
                            LocalDateTime.ofInstant(
                                    Instant.ofEpochMilli(
                                            pardonAt
                                    ),
                                    info == null ? ZoneId.systemDefault() : info.timezone().toZoneId()
                            ),
                            info != null && info.usesBackwardsDate()
                    ))
    );
}

info is a class object that stores some elimination info

solid night
#

pls dont do that

cursive briar
#

wym

solid night
#

are you making a punishments plugin

cursive briar
#

No, it's to handle gamemode eliminations lol

solid night
#

ah

#

do this

cursive briar
#

AsyncPlayerPreLoginEvent#deny?

#

or whatever it was

solid night
#
@EventHandler
public void onLogin(PlayerLoginEvent e) {
  e.setKickMessage(...);
  e.setResult(LoginResult.KICK_OTHER);
}```
cursive briar
#

okay thanks I'll try it

solid night
#

k

cursive briar
#

Ah it's only in the pre login event

#

wait no

#

I'm dumb

copper echo
#

please use the pre login event for this

#

that way players don't get kicked after the world load screen

cursive briar
#

I can't because basically when a player does inherently join some stats have to be reset

#

wait no

#

I'm dumb

#

I'm majorly dumb

#

W thanks @copper echo @solid night