1.16.5 Sending a kick message after kicking a player with ResourcePackStatusEvent

Discussion in 'Spigot Plugin Development' started by SizzleMcGrizzle, Oct 10, 2021.

  1. Hello, I'd like to thank anyone willing to give a response to this thread, I appreciate it much. Anyways, without further ado...

    The problem: I'm attempting to create a force-resourcepack system in which the user is instantly kicked if they have resource packs disabled (aka not prompt or enabled) in the server settings. The issue with this is that, when sending a resourcepack with Player#setResourcePack() (as apposed to putting the url in server.properties), it is called after the AsyncPreLoginEvent, the event in which you can deny a player logging in with a message. Any other time the player is kicked while logging in with a message, the player is sent the "IOException" stacktrace instead of the parameterized message.

    What I've tried: One solution I've found to this IOException message being sent when a player is kicked (I believe it is based on ping that either will be sent, as the player has to actually join the server before they see the message, otherwise it is the exception message) is to delay the kicking of the player with a runnable. While this solution works, I'd prefer if it was instantaneous like it could be using AsyncPreLoginEvent.

    So, does anyone know of a way where I can, upon a player logging in, instantly send a resource pack and if it is either denied or fails to download, instantly kick a player with a message instead of showing the IOException message?

  2. I've taken a look at it before, and I'm surprised it even works to be honest. Their solution is what I tried first and got the IOException message