Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 00:22:51 +01:00
Fix SpongeViaInjector#getServerProtocolVersion()
for Sponge API-10+ (#3337)
Dieser Commit ist enthalten in:
Ursprung
28ba4afc27
Commit
bf825d5ef6
@ -32,7 +32,13 @@ public class SpongeViaInjector extends LegacyViaInjector {
|
|||||||
@Override
|
@Override
|
||||||
public int getServerProtocolVersion() throws ReflectiveOperationException {
|
public int getServerProtocolVersion() throws ReflectiveOperationException {
|
||||||
MinecraftVersion version = Sponge.platform().minecraftVersion();
|
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
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren