3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 08:10:09 +01:00

Fix SpongeViaInjector#getServerProtocolVersion() for Sponge API-10+ (#3337)

Dieser Commit ist enthalten in:
Ossi Erkkilä 2023-06-09 12:29:55 +03:00 committet von GitHub
Ursprung 28ba4afc27
Commit bf825d5ef6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -32,7 +32,13 @@ public class SpongeViaInjector extends LegacyViaInjector {
@Override
public int getServerProtocolVersion() throws ReflectiveOperationException {
MinecraftVersion version = Sponge.platform().minecraftVersion();
return (int) version.getClass().getDeclaredMethod("getProtocol").invoke(version);
// 'protocolVersion' method was exposed to the API in a 1.19.4 build and 'getProtocol' no longer exists in the impl.
try {
return (int) version.getClass().getDeclaredMethod("getProtocol").invoke(version);
} catch (NoSuchMethodException e) {
return (int) version.getClass().getDeclaredMethod("protocolVersion").invoke(version);
}
}
@Override