fix version, detect velocity implementation, fix npe, fix detectorservice

This commit is contained in:
creeper123123321 2018-11-12 14:21:48 -02:00
parent 4c07b6d28d
commit 3ef1ac06df
No known key found for this signature in database
GPG Key ID: 0AC57D54786721D1
3 changed files with 13 additions and 9 deletions

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId>
<version>1.6.1-18w43c</version>
<version>1.6.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -87,12 +87,14 @@ public class VelocityPlugin implements ViaPlatform<Player> {
@Override
public String getPlatformName() {
return "Velocity";
String proxyImpl = ProxyServer.class.getPackage().getImplementationTitle();
return (proxyImpl != null) ? proxyImpl : "Velocity";
}
@Override
public String getPlatformVersion() {
return ProxyServer.class.getPackage().getImplementationVersion();
String version = ProxyServer.class.getPackage().getImplementationVersion();
return (version != null) ? version : "Unknown";
}
@Override

View File

@ -27,15 +27,17 @@ public class VelocityViaLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(VersionProvider.class, new VelocityVersionProvider());
// We probably don't need a EntityIdProvider because velocity sends a Join packet on server change
VelocityPlugin.PROXY.getEventManager().register(
plugin,
new UpdateListener());
Via.getPlatform().runRepeatingSync(
new ProtocolDetectorService(),
((VelocityViaConfig) Via.getPlatform().getConf()).getVelocityPingInterval() * 50L);
VelocityPlugin.PROXY.getEventManager().register(plugin, new UpdateListener());
VelocityPlugin.PROXY.getEventManager().register(plugin, new VelocityServerHandler());
VelocityPlugin.PROXY.getEventManager().register(plugin, new MainHandPatch());
VelocityPlugin.PROXY.getEventManager().register(plugin, new ElytraPatch());
int pingInterval = ((VelocityViaConfig) Via.getPlatform().getConf()).getVelocityPingInterval();
if (pingInterval > 0) {
Via.getPlatform().runRepeatingSync(
new ProtocolDetectorService(),
pingInterval * 20L);
}
}
@Override