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:
@@ -24,6 +24,11 @@
|
|||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
<version>${geyser.version}</version>
|
<version>${geyser.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.geysermc.cumulus</groupId>
|
||||||
|
<artifactId>cumulus</artifactId>
|
||||||
|
<version>${cumulus.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|||||||
@@ -95,12 +95,24 @@ public final class BungeeInjector extends CommonPlatformInjector {
|
|||||||
// we're getting called before the decoder and encoder are added.
|
// we're getting called before the decoder and encoder are added.
|
||||||
// we'll have to wait a while :(
|
// we'll have to wait a while :(
|
||||||
ctx.executor().execute(() -> {
|
ctx.executor().execute(() -> {
|
||||||
|
int tries = 0;
|
||||||
while (ctx.channel().isOpen()) {
|
while (ctx.channel().isOpen()) {
|
||||||
if (ctx.channel().pipeline().get(MinecraftEncoder.class) != null) {
|
if (ctx.channel().pipeline().get(MinecraftEncoder.class) != null) {
|
||||||
logger.debug("found packet encoder :)");
|
logger.debug("found packet encoder :)");
|
||||||
ctx.channel().pipeline().addFirst(new BungeeInjectorInitializer());
|
ctx.channel().pipeline().addFirst(new BungeeInjectorInitializer());
|
||||||
return;
|
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) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user