From 323394d2b50d6df5bab1b483a337f045e908300d Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Wed, 22 Mar 2023 11:10:04 -0400 Subject: [PATCH] Clean up jar file classes a bit --- bootstrap/fabric/build.gradle.kts | 16 ++++++++++++++++ bootstrap/spigot/build.gradle.kts | 1 + .../geyser.shadow-conventions.gradle.kts | 5 +++++ .../geyser/session/GeyserSession.java | 19 ++++++++++++++++--- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/bootstrap/fabric/build.gradle.kts b/bootstrap/fabric/build.gradle.kts index 890f5d656..af9c4547d 100644 --- a/bootstrap/fabric/build.gradle.kts +++ b/bootstrap/fabric/build.gradle.kts @@ -66,6 +66,22 @@ tasks { relocate("org.yaml", "org.geysermc.relocate.yaml") // https://github.com/CardboardPowered/cardboard/issues/139 relocate("com.fasterxml.jackson", "org.geysermc.relocate.jackson") relocate("net.kyori", "org.geysermc.relocate.kyori") + + dependencies { + // Exclude everything EXCEPT KQueue and some DNS stuff required for HAProxyc + exclude(dependency("io.netty:netty-transport-classes-epoll:.*")) + exclude(dependency("io.netty:netty-transport-native-epoll:.*")) + exclude(dependency("io.netty:netty-transport-native-unix-common:.*")) + exclude(dependency("io.netty:netty-transport-native-kqueue:.*")) + exclude(dependency("io.netty:netty-handler:.*")) + exclude(dependency("io.netty:netty-common:.*")) + exclude(dependency("io.netty:netty-buffer:.*")) + exclude(dependency("io.netty:netty-resolver:.*")) + exclude(dependency("io.netty:netty-transport:.*")) + exclude(dependency("io.netty:netty-codec:.*")) + exclude(dependency("io.netty:netty-resolver-dns:.*")) + exclude(dependency("io.netty:netty-resolver-dns-native-macos:.*")) + } } remapJar { diff --git a/bootstrap/spigot/build.gradle.kts b/bootstrap/spigot/build.gradle.kts index b5ef4e69e..da4e5af33 100644 --- a/bootstrap/spigot/build.gradle.kts +++ b/bootstrap/spigot/build.gradle.kts @@ -44,6 +44,7 @@ tasks.withType { // We cannot shade Netty, or else native libraries will not load // Needed because older Spigot builds do not provide the haproxy module + exclude(dependency("io.netty:netty-transport-classes-epoll:.*")) exclude(dependency("io.netty:netty-transport-native-epoll:.*")) exclude(dependency("io.netty:netty-transport-native-unix-common:.*")) exclude(dependency("io.netty:netty-transport-native-kqueue:.*")) diff --git a/build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts b/build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts index 395beb104..dde85c33a 100644 --- a/build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/geyser.shadow-conventions.gradle.kts @@ -24,6 +24,11 @@ tasks { exclude(dependency(string)) } } + + sJar.dependencies { + exclude(dependency("org.checkerframework:checker-qual:.*")) + exclude(dependency("org.jetbrains:annotations:.*")) + } } } named("build") { diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index d76cc4b97..e245d0f56 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -732,7 +732,11 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { return; } - connectDownstream(); + try { + connectDownstream(); + } catch (Throwable t) { + t.printStackTrace(); + } }); } @@ -776,7 +780,11 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { return; } - connectDownstream(); + try { + connectDownstream(); + } catch (Throwable t) { + t.printStackTrace(); + } }); } @@ -850,7 +858,12 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { selectedProfile, service.getAccessToken() ); - connectDownstream(); + try { + connectDownstream(); + } catch (Throwable t) { + t.printStackTrace(); + return false; + } // Save our refresh token for later use geyser.saveRefreshToken(bedrockUsername(), service.getRefreshToken());