Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 08:30:09 +01:00
Apply required changes for ViaAprilFools (#4033)
1. Allow the version provider to get the client version sent through the handshake packet 2. Allow platform to override provider instead
Dieser Commit ist enthalten in:
Ursprung
1476adb281
Commit
3906b47654
@ -69,11 +69,11 @@ public class BaseProtocol extends AbstractProtocol<BaseClientboundPacket, BaseCl
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProtocolInfo info = wrapper.user().getProtocolInfo();
|
ProtocolInfo info = wrapper.user().getProtocolInfo();
|
||||||
|
info.setProtocolVersion(ProtocolVersion.getProtocol(protocolVersion));
|
||||||
|
|
||||||
ProtocolVersion clientVersion = versionProvider.getClientProtocol(wrapper.user());
|
ProtocolVersion clientVersion = versionProvider.getClientProtocol(wrapper.user());
|
||||||
if (clientVersion != null) {
|
if (clientVersion != null) {
|
||||||
info.setProtocolVersion(clientVersion);
|
info.setProtocolVersion(clientVersion);
|
||||||
} else {
|
|
||||||
info.setProtocolVersion(ProtocolVersion.getProtocol(protocolVersion));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Choose the pipe
|
// Choose the pipe
|
||||||
|
@ -21,8 +21,10 @@ import com.velocitypowered.api.plugin.PluginContainer;
|
|||||||
import com.viaversion.viaversion.VelocityPlugin;
|
import com.viaversion.viaversion.VelocityPlugin;
|
||||||
import com.viaversion.viaversion.api.Via;
|
import com.viaversion.viaversion.api.Via;
|
||||||
import com.viaversion.viaversion.api.platform.ViaPlatformLoader;
|
import com.viaversion.viaversion.api.platform.ViaPlatformLoader;
|
||||||
|
import com.viaversion.viaversion.api.platform.providers.ViaProviders;
|
||||||
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
|
||||||
import com.viaversion.viaversion.api.protocol.version.VersionProvider;
|
import com.viaversion.viaversion.api.protocol.version.VersionProvider;
|
||||||
|
import com.viaversion.viaversion.protocol.version.BaseVersionProvider;
|
||||||
import com.viaversion.viaversion.protocols.v1_8to1_9.provider.BossBarProvider;
|
import com.viaversion.viaversion.protocols.v1_8to1_9.provider.BossBarProvider;
|
||||||
import com.viaversion.viaversion.velocity.listeners.UpdateListener;
|
import com.viaversion.viaversion.velocity.listeners.UpdateListener;
|
||||||
import com.viaversion.viaversion.velocity.providers.VelocityBossBarProvider;
|
import com.viaversion.viaversion.velocity.providers.VelocityBossBarProvider;
|
||||||
@ -35,12 +37,17 @@ public class VelocityViaLoader implements ViaPlatformLoader {
|
|||||||
Object plugin = VelocityPlugin.PROXY.getPluginManager()
|
Object plugin = VelocityPlugin.PROXY.getPluginManager()
|
||||||
.getPlugin("viaversion").flatMap(PluginContainer::getInstance).get();
|
.getPlugin("viaversion").flatMap(PluginContainer::getInstance).get();
|
||||||
|
|
||||||
|
final ViaProviders providers = Via.getManager().getProviders();
|
||||||
|
|
||||||
final ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion();
|
final ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion();
|
||||||
if (protocolVersion.olderThan(ProtocolVersion.v1_9)) {
|
if (protocolVersion.olderThan(ProtocolVersion.v1_9)) {
|
||||||
Via.getManager().getProviders().use(BossBarProvider.class, new VelocityBossBarProvider());
|
providers.use(BossBarProvider.class, new VelocityBossBarProvider());
|
||||||
}
|
}
|
||||||
|
|
||||||
Via.getManager().getProviders().use(VersionProvider.class, new VelocityVersionProvider());
|
// Allow platforms to override the version provider
|
||||||
|
if (providers.get(VersionProvider.class) instanceof BaseVersionProvider) {
|
||||||
|
providers.use(VersionProvider.class, new VelocityVersionProvider());
|
||||||
|
}
|
||||||
// We probably don't need a EntityIdProvider because velocity sends a Join packet on server change
|
// We probably don't need a EntityIdProvider because velocity sends a Join packet on server change
|
||||||
// We don't need main hand patch because Join Game packet makes client send hand data again
|
// We don't need main hand patch because Join Game packet makes client send hand data again
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren