Ignore all downstream packet errors (#693)

* Ignore all downstream packet errors

Instead of kicking the client off because of an error, we simply display a logger warning and suppress the error.

* If debug mode, print stacktrace
This commit is contained in:
Camotoy 2020-05-30 18:31:20 -04:00 committed by GitHub
parent 64e3204611
commit b8a3009c9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -105,7 +105,7 @@
<dependency>
<groupId>com.github.steveice10</groupId>
<artifactId>packetlib</artifactId>
<version>1.5-SNAPSHOT</version>
<version>1.6-SNAPSHOT</version>
<scope>compile</scope>
<exclusions>
<exclusion>

View File

@ -366,6 +366,14 @@ public class GeyserSession implements CommandSender {
PacketTranslatorRegistry.JAVA_TRANSLATOR.translate(event.getPacket().getClass(), event.getPacket(), GeyserSession.this);
}
}
@Override
public void packetError(PacketErrorEvent event) {
connector.getLogger().warning("Downstream packet error! " + event.getCause().getMessage());
if (connector.getConfig().isDebugMode())
event.getCause().printStackTrace();
event.setSuppress(true);
}
});
downstream.getSession().connect();