SteamWar/SpigotCore
Archiviert
13
0

Force tinyprotocol injection
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2022-03-05 20:38:48 +01:00
Ursprung bedf79a4ad
Commit 705aafca3a

Datei anzeigen

@ -92,15 +92,18 @@ public class TinyProtocol {
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerLogin(PlayerLoginEvent e) {
if (closed)
return;
Channel channel = getChannel(e.getPlayer());
// Don't inject players that have been explicitly uninjected
if (!uninjectedChannels.contains(channel)) {
injectPlayer(e.getPlayer());
}
injectPlayerOnLogin(
e.getPlayer(),
() -> Bukkit.getScheduler().runTask(plugin, () -> injectPlayerOnLogin(
e.getPlayer(),
() -> Bukkit.getScheduler().runTaskLater(plugin, () -> injectPlayerOnLogin(
e.getPlayer(),
() -> {
//Give up
}
), 1)
))
);
}
@EventHandler
@ -130,6 +133,23 @@ public class TinyProtocol {
}
}
private void injectPlayerOnLogin(Player player, Runnable errorHandler) {
if (closed)
return;
try {
Channel channel = getChannel(player);
// Don't inject players that have been explicitly uninjected
if (!uninjectedChannels.contains(channel)) {
injectPlayer(player);
}
} catch (NullPointerException ex) {
Bukkit.getLogger().log(Level.WARNING, player.getName() + " without playerConnection, retrying");
errorHandler.run();
}
}
private void createServerChannelHandler() {
// Handle connected channels
endInitProtocol = new ChannelInitializer<Channel>() {