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);
}
}
Aggregations