Search in sources :

Example 1 with ProtocolDetectorService

use of com.viaversion.viaversion.velocity.service.ProtocolDetectorService in project ViaVersion by ViaVersion.

the class VelocityViaLoader method load.

@Override
public void load() {
    Object plugin = VelocityPlugin.PROXY.getPluginManager().getPlugin("viaversion").flatMap(PluginContainer::getInstance).get();
    if (Via.getAPI().getServerVersion().lowestSupportedVersion() < ProtocolVersion.v1_9.getVersion()) {
        Via.getManager().getProviders().use(MovementTransmitterProvider.class, new VelocityMovementTransmitter());
        Via.getManager().getProviders().use(BossBarProvider.class, new VelocityBossBarProvider());
    }
    Via.getManager().getProviders().use(VersionProvider.class, new VelocityVersionProvider());
    // 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
    VelocityPlugin.PROXY.getEventManager().register(plugin, new UpdateListener());
    int pingInterval = ((VelocityViaConfig) Via.getPlatform().getConf()).getVelocityPingInterval();
    if (pingInterval > 0) {
        Via.getPlatform().runRepeatingSync(new ProtocolDetectorService(), pingInterval * 20L);
    }
}
Also used : VelocityBossBarProvider(com.viaversion.viaversion.velocity.providers.VelocityBossBarProvider) VelocityMovementTransmitter(com.viaversion.viaversion.velocity.providers.VelocityMovementTransmitter) ProtocolDetectorService(com.viaversion.viaversion.velocity.service.ProtocolDetectorService) VelocityVersionProvider(com.viaversion.viaversion.velocity.providers.VelocityVersionProvider) UpdateListener(com.viaversion.viaversion.velocity.listeners.UpdateListener)

Aggregations

UpdateListener (com.viaversion.viaversion.velocity.listeners.UpdateListener)1 VelocityBossBarProvider (com.viaversion.viaversion.velocity.providers.VelocityBossBarProvider)1 VelocityMovementTransmitter (com.viaversion.viaversion.velocity.providers.VelocityMovementTransmitter)1 VelocityVersionProvider (com.viaversion.viaversion.velocity.providers.VelocityVersionProvider)1 ProtocolDetectorService (com.viaversion.viaversion.velocity.service.ProtocolDetectorService)1