mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-29 18:27:36 +02:00
Reformat
This commit is contained in:
@ -47,10 +47,7 @@ import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
|
||||
import com.velocitypowered.api.proxy.server.RegisteredServer;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -62,6 +59,10 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
||||
//TODO: Support for floodgate
|
||||
@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"})
|
||||
@ -94,10 +95,10 @@ public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
|
||||
return;
|
||||
}
|
||||
|
||||
server.getChannelRegistrar().register(MinecraftChannelIdentifier.create(getName(), ChangePremiumMessage.CHANGE_CHANNEL));
|
||||
server.getChannelRegistrar().register(MinecraftChannelIdentifier.create(getName(), SuccessMessage.SUCCESS_CHANNEL));
|
||||
server.getEventManager().register(this, new ConnectListener(this, core.getRateLimiter()));
|
||||
server.getEventManager().register(this, new PluginMessageListener(this));
|
||||
server.getChannelRegistrar().register(MinecraftChannelIdentifier.create(getName(), ChangePremiumMessage.CHANGE_CHANNEL));
|
||||
server.getChannelRegistrar().register(MinecraftChannelIdentifier.create(getName(), SuccessMessage.SUCCESS_CHANNEL));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@ -184,8 +185,7 @@ public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
|
||||
if (shouldGenerate) {
|
||||
proxyId = UUID.randomUUID();
|
||||
try {
|
||||
Files.write(idFile, Collections.singletonList(proxyId.toString()),
|
||||
StandardCharsets.UTF_8, StandardOpenOption.CREATE);
|
||||
Files.write(idFile, Collections.singletonList(proxyId.toString()), StandardOpenOption.CREATE);
|
||||
} catch (IOException e) {
|
||||
logger.error("Unable to save proxy id to '{}'", idFile.toAbsolutePath());
|
||||
logger.error("Detailed exception:", e);
|
||||
|
@ -31,9 +31,11 @@ import com.github.games647.fastlogin.core.shared.LoginSession;
|
||||
public class VelocityLoginSession extends LoginSession {
|
||||
private boolean alreadySaved;
|
||||
private boolean alreadyLogged;
|
||||
|
||||
public VelocityLoginSession(String requestUsername, boolean registered, StoredProfile profile) {
|
||||
super(requestUsername, registered, profile);
|
||||
}
|
||||
|
||||
public synchronized void setRegistered(boolean registered) {
|
||||
this.registered = registered;
|
||||
}
|
||||
|
@ -28,16 +28,17 @@ package com.github.games647.fastlogin.velocity;
|
||||
import com.github.games647.fastlogin.core.shared.LoginSource;
|
||||
import com.velocitypowered.api.event.connection.PreLoginEvent;
|
||||
import com.velocitypowered.api.proxy.InboundConnection;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
public class VelocityLoginSource implements LoginSource {
|
||||
|
||||
private InboundConnection connection;
|
||||
private PreLoginEvent preLoginEvent;
|
||||
private final InboundConnection connection;
|
||||
private final PreLoginEvent preLoginEvent;
|
||||
|
||||
public VelocityLoginSource(InboundConnection connection, PreLoginEvent preLoginEvent) {
|
||||
this.connection = connection;
|
||||
|
@ -32,7 +32,8 @@ import com.velocitypowered.api.event.ResultedEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class VelocityFastLoginAutoLoginEvent implements FastLoginAutoLoginEvent, ResultedEvent<ResultedEvent.GenericResult> {
|
||||
public class VelocityFastLoginAutoLoginEvent
|
||||
implements FastLoginAutoLoginEvent, ResultedEvent<ResultedEvent.GenericResult> {
|
||||
|
||||
private final LoginSession session;
|
||||
private final StoredProfile profile;
|
||||
|
@ -59,11 +59,12 @@ public class ConnectListener {
|
||||
this.rateLimiter = rateLimiter;
|
||||
}
|
||||
|
||||
@Subscribe()
|
||||
@Subscribe
|
||||
public void onPreLogin(PreLoginEvent preLoginEvent, Continuation continuation) {
|
||||
if (!preLoginEvent.getResult().isAllowed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
InboundConnection connection = preLoginEvent.getConnection();
|
||||
if (!rateLimiter.tryAcquire()) {
|
||||
plugin.getLog().warn("Simple Anti-Bot join limit - Ignoring {}", connection);
|
||||
@ -105,9 +106,10 @@ public class ConnectListener {
|
||||
private List<GameProfile.Property> removeSkin(List<GameProfile.Property> oldProperties) {
|
||||
List<GameProfile.Property> newProperties = new ArrayList<>(oldProperties.size() - 1);
|
||||
for (GameProfile.Property property : oldProperties) {
|
||||
if (!property.getName().equals("textures"))
|
||||
if (!"textures".equals(property.getName()))
|
||||
newProperties.add(property);
|
||||
}
|
||||
|
||||
return newProperties;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user