Added FastLogin Velocity support
This commit is contained in:
parent
4c4550f440
commit
f583d70d1a
@ -20,6 +20,10 @@
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>codemc-snapshots</id>
|
||||
<url>https://repo.codemc.io/repository/maven-snapshots/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -35,6 +39,12 @@
|
||||
<version>3.2.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.games647</groupId>
|
||||
<artifactId>fastlogin.velocity</artifactId>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.glyart.authmevelocity.proxy;
|
||||
|
||||
import com.glyart.authmevelocity.proxy.config.AuthMeConfig;
|
||||
import com.glyart.authmevelocity.proxy.listener.FastLoginListener;
|
||||
import com.glyart.authmevelocity.proxy.listener.ProxyListener;
|
||||
import com.google.inject.Inject;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
@ -34,6 +35,7 @@ public class AuthMeVelocityPlugin {
|
||||
public void onProxyInitialize(ProxyInitializeEvent event) {
|
||||
server.getChannelRegistrar().register(new LegacyChannelIdentifier("authmevelocity:main"), MinecraftChannelIdentifier.create("authmevelocity", "main"));
|
||||
server.getEventManager().register(this, new ProxyListener(this, server));
|
||||
server.getEventManager().register(this, new FastLoginListener(this, server));
|
||||
AuthMeConfig.defaultConfig();
|
||||
logger.info("AuthMeVelocity enabled");
|
||||
logger.info("AuthServers: " + config.getList("authservers"));
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.glyart.authmevelocity.proxy.listener;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.github.games647.fastlogin.velocity.event.VelocityFastLoginAutoLoginEvent;
|
||||
import com.glyart.authmevelocity.proxy.AuthMeVelocityPlugin;
|
||||
import com.velocitypowered.api.event.Subscribe;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
|
||||
public class FastLoginListener {
|
||||
private final AuthMeVelocityPlugin plugin;
|
||||
private final ProxyServer server;
|
||||
public FastLoginListener(AuthMeVelocityPlugin plugin, ProxyServer server){
|
||||
this.plugin = plugin;
|
||||
this.server = server;
|
||||
}
|
||||
@Subscribe
|
||||
public void onAutoLogin(VelocityFastLoginAutoLoginEvent event){
|
||||
Optional<Player> autoLoginPlayer = server.getPlayer(event.getProfile().getName());
|
||||
if(autoLoginPlayer.isPresent()){
|
||||
UUID playerUUID = autoLoginPlayer.get().getUniqueId();
|
||||
if(!plugin.loggedPlayers.contains(playerUUID)){
|
||||
plugin.loggedPlayers.add(playerUUID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -41,11 +41,14 @@ public class ProxyListener {
|
||||
if (!player.isPresent()) return;
|
||||
|
||||
Player loggedPlayer = player.get();
|
||||
plugin.loggedPlayers.add(loggedPlayer.getUniqueId());
|
||||
UUID playerUUID = loggedPlayer.getUniqueId();
|
||||
if (!plugin.loggedPlayers.contains(playerUUID)){
|
||||
plugin.loggedPlayers.add(playerUUID);
|
||||
|
||||
RegisteredServer loginServer = player.get().getCurrentServer().get().getServer();
|
||||
server.getEventManager().fireAndForget(new ProxyLoginEvent(loggedPlayer, loginServer));
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onDisconnect(final DisconnectEvent event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user