forked from TuxCoding/FastLogin
Some code formatting and cleanup
This commit is contained in:
@ -49,13 +49,13 @@ import com.velocitypowered.api.proxy.server.RegisteredServer;
|
|||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.StandardOpenOption;
|
import java.nio.file.StandardOpenOption;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -65,14 +65,16 @@ import java.util.concurrent.ConcurrentMap;
|
|||||||
@Plugin(id = PomData.NAME, name = PomData.DISPLAY_NAME, description = PomData.DESCRIPTION, url = PomData.URL,
|
@Plugin(id = PomData.NAME, name = PomData.DISPLAY_NAME, description = PomData.DESCRIPTION, url = PomData.URL,
|
||||||
version = PomData.VERSION, authors = {"games647", "https://github.com/games647/FastLogin/graphs/contributors"})
|
version = PomData.VERSION, authors = {"games647", "https://github.com/games647/FastLogin/graphs/contributors"})
|
||||||
public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
|
public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
|
||||||
|
|
||||||
private final ProxyServer server;
|
private final ProxyServer server;
|
||||||
private final Path dataDirectory;
|
private final Path dataDirectory;
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
private FastLoginCore<Player, CommandSource, FastLoginVelocity> core;
|
|
||||||
private final ConcurrentMap<InetSocketAddress, VelocityLoginSession> session = new MapMaker().weakKeys().makeMap();
|
private final ConcurrentMap<InetSocketAddress, VelocityLoginSession> session = new MapMaker().weakKeys().makeMap();
|
||||||
|
private final String PROXY_ID_fILE = "proxyId.txt";
|
||||||
|
|
||||||
|
private FastLoginCore<Player, CommandSource, FastLoginVelocity> core;
|
||||||
private AsyncScheduler scheduler;
|
private AsyncScheduler scheduler;
|
||||||
private UUID proxyId;
|
private UUID proxyId;
|
||||||
private final String PROXY_ID_fILE = "proxyId.txt";
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public FastLoginVelocity(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory) {
|
public FastLoginVelocity(ProxyServer server, Logger logger, @DataDirectory Path dataDirectory) {
|
||||||
@ -115,7 +117,6 @@ public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
|
|||||||
@Override
|
@Override
|
||||||
public void sendMessage(CommandSource receiver, String message) {
|
public void sendMessage(CommandSource receiver, String message) {
|
||||||
receiver.sendMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(message));
|
receiver.sendMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(message));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -132,7 +133,7 @@ public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
|
|||||||
return core;
|
return core;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConcurrentMap<InetSocketAddress, VelocityLoginSession> getSession() {
|
public ConcurrentMap<InetSocketAddress, VelocityLoginSession> getSession() {
|
||||||
return session;
|
return session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +51,6 @@ public class VelocityLoginSource implements LoginSource {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void kick(String message) {
|
public void kick(String message) {
|
||||||
|
|
||||||
|
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
preLoginEvent.setResult(PreLoginEvent.PreLoginComponentResult.denied(
|
preLoginEvent.setResult(PreLoginEvent.PreLoginComponentResult.denied(
|
||||||
Component.text("Kicked").color(NamedTextColor.WHITE)));
|
Component.text("Kicked").color(NamedTextColor.WHITE)));
|
||||||
|
@ -71,7 +71,6 @@ public class ConnectListener {
|
|||||||
String username = preLoginEvent.getUsername();
|
String username = preLoginEvent.getUsername();
|
||||||
plugin.getLog().info("Incoming login request for {} from {}", username, connection.getRemoteAddress());
|
plugin.getLog().info("Incoming login request for {} from {}", username, connection.getRemoteAddress());
|
||||||
|
|
||||||
|
|
||||||
Runnable asyncPremiumCheck = new AsyncPremiumCheck(plugin, connection, username, continuation, preLoginEvent);
|
Runnable asyncPremiumCheck = new AsyncPremiumCheck(plugin, connection, username, continuation, preLoginEvent);
|
||||||
plugin.getScheduler().runAsync(asyncPremiumCheck);
|
plugin.getScheduler().runAsync(asyncPremiumCheck);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,6 @@ public class PluginMessageListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void onSuccessMessage(Player forPlayer) {
|
private void onSuccessMessage(Player forPlayer) {
|
||||||
|
|
||||||
if (forPlayer.isOnlineMode()){
|
if (forPlayer.isOnlineMode()){
|
||||||
//bukkit module successfully received and force logged in the user
|
//bukkit module successfully received and force logged in the user
|
||||||
//update only on success to prevent corrupt data
|
//update only on success to prevent corrupt data
|
||||||
|
Reference in New Issue
Block a user