1
0
mirror of https://github.com/GeyserMC/Floodgate.git synced 2025-12-19 14:59:20 +00:00

Limit Bungee injection tries. Explicitly define cumulus in the api pom

This commit is contained in:
Tim203
2021-04-11 19:43:41 +02:00
parent fcd433d2e1
commit d844216e80
2 changed files with 17 additions and 0 deletions

View File

@@ -24,6 +24,11 @@
<artifactId>common</artifactId>
<version>${geyser.version}</version>
</dependency>
<dependency>
<groupId>org.geysermc.cumulus</groupId>
<artifactId>cumulus</artifactId>
<version>${cumulus.version}</version>
</dependency>
</dependencies>
<repositories>

View File

@@ -95,12 +95,24 @@ public final class BungeeInjector extends CommonPlatformInjector {
// we're getting called before the decoder and encoder are added.
// we'll have to wait a while :(
ctx.executor().execute(() -> {
int tries = 0;
while (ctx.channel().isOpen()) {
if (ctx.channel().pipeline().get(MinecraftEncoder.class) != null) {
logger.debug("found packet encoder :)");
ctx.channel().pipeline().addFirst(new BungeeInjectorInitializer());
return;
}
// half a second should be more than enough
if (++tries > 25) {
logger.debug("Failed to inject " + ctx.channel().pipeline());
return;
}
try {
Thread.sleep(20);
} catch (InterruptedException ignored) {
}
}
});
}