Merge pull request 'Force tinyprotocol injection' (#177) from forceInjection into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #177 Reviewed-by: Chaoscaot <chaoscaot444@gmail.com>
Dieser Commit ist enthalten in:
Commit
3b6be14958
@ -92,15 +92,18 @@ public class TinyProtocol {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onPlayerLogin(PlayerLoginEvent e) {
|
public void onPlayerLogin(PlayerLoginEvent e) {
|
||||||
if (closed)
|
injectPlayerOnLogin(
|
||||||
return;
|
e.getPlayer(),
|
||||||
|
() -> Bukkit.getScheduler().runTask(plugin, () -> injectPlayerOnLogin(
|
||||||
Channel channel = getChannel(e.getPlayer());
|
e.getPlayer(),
|
||||||
|
() -> Bukkit.getScheduler().runTaskLater(plugin, () -> injectPlayerOnLogin(
|
||||||
// Don't inject players that have been explicitly uninjected
|
e.getPlayer(),
|
||||||
if (!uninjectedChannels.contains(channel)) {
|
() -> {
|
||||||
injectPlayer(e.getPlayer());
|
//Give up
|
||||||
}
|
}
|
||||||
|
), 1)
|
||||||
|
))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@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() {
|
private void createServerChannelHandler() {
|
||||||
// Handle connected channels
|
// Handle connected channels
|
||||||
endInitProtocol = new ChannelInitializer<Channel>() {
|
endInitProtocol = new ChannelInitializer<Channel>() {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren