mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 01:55:47 +01:00
Fix SpongeViaInjector#getServerProtocolVersion()
for Sponge API-10+ (#3337)
This commit is contained in:
parent
28ba4afc27
commit
bf825d5ef6
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user