Typo fixes

This commit is contained in:
games647
2023-04-11 10:36:42 +02:00
parent c12a88966c
commit e5d61101ae
17 changed files with 39 additions and 29 deletions

View File

@ -36,7 +36,7 @@ import org.jetbrains.annotations.Nullable;
/** /**
* Represents a client connecting to the server. * Represents a client connecting to the server.
* * <p>
* This session is invalid if the player disconnects or the login was successful * This session is invalid if the player disconnects or the login was successful
*/ */
public class BukkitLoginSession extends LoginSession { public class BukkitLoginSession extends LoginSession {
@ -76,7 +76,7 @@ public class BukkitLoginSession extends LoginSession {
/** /**
* Gets the verify-token the server sent to the client. * Gets the verify-token the server sent to the client.
* * <p>
* Empty if it's a BungeeCord connection * Empty if it's a BungeeCord connection
* *
* @return verify token from the server * @return verify token from the server

View File

@ -45,7 +45,7 @@ import org.jetbrains.annotations.NotNull;
/** /**
* Responsible for receiving messages from a BungeeCord instance. * Responsible for receiving messages from a BungeeCord instance.
* * <p>
* This class also receives the plugin message from the bungeecord version of this plugin in order to get notified if * This class also receives the plugin message from the bungeecord version of this plugin in order to get notified if
* the connection is in online mode. * the connection is in online mode.
*/ */

View File

@ -223,7 +223,7 @@ public class ProtocolLibListener extends PacketAdapter {
plugin.removeSession(player.getAddress()); plugin.removeSession(player.getAddress());
PacketContainer packet = packetEvent.getPacket(); PacketContainer packet = packetEvent.getPacket();
Optional<ClientPublicKey> clientKey = Optional.empty(); Optional<ClientPublicKey> clientKey;
if (new MinecraftVersion(1, 19, 3).atOrAbove()) { if (new MinecraftVersion(1, 19, 3).atOrAbove()) {
// public key sent separate // public key sent separate
clientKey = Optional.empty(); clientKey = Optional.empty();

View File

@ -178,7 +178,8 @@ class EncryptionUtilTest {
assertEquals(EncryptionUtil.getServerIdHashString(serverId, sharedSecret, serverPK), sessionHash); assertEquals(EncryptionUtil.getServerIdHashString(serverId, sharedSecret, serverPK), sessionHash);
} }
private static String getServerHash(CharSequence serverId, SecretKey sharedSecret, PublicKey serverPK) { private static String getServerHash(@SuppressWarnings("SameParameterValue") CharSequence serverId,
SecretKey sharedSecret, PublicKey serverPK) {
// https://wiki.vg/Protocol_Encryption#Client // https://wiki.vg/Protocol_Encryption#Client
// sha1 := Sha1() // sha1 := Sha1()
// sha1.update(ASCII encoding of the server id string from Encryption Request) // sha1.update(ASCII encoding of the server id string from Encryption Request)

View File

@ -40,6 +40,7 @@ import java.security.NoSuchAlgorithmException;
import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey; import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException; import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec; import java.security.spec.X509EncodedKeySpec;
import java.time.Instant; import java.time.Instant;
@ -58,7 +59,7 @@ public class ResourceLoader {
) { ) {
PemObject pemObject = pemReader.readPemObject(); PemObject pemObject = pemReader.readPemObject();
byte[] content = pemObject.getContent(); byte[] content = pemObject.getContent();
PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(content); KeySpec privateKeySpec = new PKCS8EncodedKeySpec(content);
KeyFactory factory = KeyFactory.getInstance("RSA"); KeyFactory factory = KeyFactory.getInstance("RSA");
return (RSAPrivateKey) factory.generatePrivate(privateKeySpec); return (RSAPrivateKey) factory.generatePrivate(privateKeySpec);
@ -88,7 +89,7 @@ public class ResourceLoader {
) { ) {
PemObject pemObject = pemReader.readPemObject(); PemObject pemObject = pemReader.readPemObject();
byte[] content = pemObject.getContent(); byte[] content = pemObject.getContent();
X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(content); KeySpec pubKeySpec = new X509EncodedKeySpec(content);
KeyFactory factory = KeyFactory.getInstance("RSA"); KeyFactory factory = KeyFactory.getInstance("RSA");
return (RSAPublicKey) factory.generatePublic(pubKeySpec); return (RSAPublicKey) factory.generatePublic(pubKeySpec);

View File

@ -46,7 +46,7 @@ import com.google.common.io.ByteStreams;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Arrays; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
@ -128,7 +128,7 @@ public class FastLoginBungee extends Plugin implements PlatformPlugin<CommandSen
private void registerHook() { private void registerHook() {
try { try {
List<Class<? extends AuthPlugin<ProxiedPlayer>>> hooks = Arrays.asList( List<Class<? extends AuthPlugin<ProxiedPlayer>>> hooks = Collections.singletonList(
BungeeAuthHook.class BungeeAuthHook.class
); );

View File

@ -36,9 +36,9 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
/** /**
* GitHub: * GitHub:
* <a href="https://github.com/vik1395/BungeeAuth-Minecraft">...</a> * <a href="https://github.com/vik1395/BungeeAuth-Minecraft">...</a>
* * <p>
* Project page: * Project page:
* * <p>
* Spigot: * Spigot:
* <a href="https://www.spigotmc.org/resources/bungeeauth.493/">...</a> * <a href="https://www.spigotmc.org/resources/bungeeauth.493/">...</a>
*/ */

View File

@ -23,7 +23,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
package com.github.games647.fastlogin.core.mojang; package com.github.games647.fastlogin.core;
import com.github.games647.craftapi.model.auth.Verification; import com.github.games647.craftapi.model.auth.Verification;
import com.github.games647.craftapi.resolver.MojangResolver; import com.github.games647.craftapi.resolver.MojangResolver;

View File

@ -57,6 +57,6 @@ public class AntiBotService {
Block, Block,
Continue; Continue
} }
} }

View File

@ -37,7 +37,7 @@ public interface AuthPlugin<P> {
/** /**
* Login the premium (paid account) player after the player joined successfully the server. * Login the premium (paid account) player after the player joined successfully the server.
* * <p>
* <strong>This operation will be performed async while the player successfully * <strong>This operation will be performed async while the player successfully
* joined the server.</strong> * joined the server.</strong>
* *
@ -48,17 +48,17 @@ public interface AuthPlugin<P> {
/** /**
* Forces a register in order to protect the paid account. * Forces a register in order to protect the paid account.
* * <p>
* <strong>This operation will be performed async while the player successfully * <strong>This operation will be performed async while the player successfully
* joined the server.</strong> * joined the server.</strong>
* * <p>
* After a successful registration the player should be logged * After a successful registration the player should be logged
* in too. * in too.
* * <p>
* The method will be called only for premium accounts. * The method will be called only for premium accounts.
* So it's recommended to set additionally premium property * So it's recommended to set additionally premium property
* if possible. * if possible.
* * <p>
* Background: If we don't register an account, cracked players * Background: If we don't register an account, cracked players
* could steal the unregistered account from the paid * could steal the unregistered account from the paid
* player account * player account
@ -71,11 +71,11 @@ public interface AuthPlugin<P> {
/** /**
* Checks whether an account exists for this player name. * Checks whether an account exists for this player name.
* * <p>
* This check should check if a cracked player account exists, * This check should check if a cracked player account exists,
* so we can be sure the premium player doesn't steal the account * so we can be sure the premium player doesn't steal the account
* of that player. * of that player.
* * <p>
* This operation will be performed async while the player is * This operation will be performed async while the player is
* connecting. * connecting.
* *

View File

@ -48,4 +48,12 @@ public class NamespaceKey {
public static String getCombined(String namespace, String key) { public static String getCombined(String namespace, String key) {
return new NamespaceKey(namespace, key).combined; return new NamespaceKey(namespace, key).combined;
} }
public String getNamespace() {
return namespace;
}
public String getKey() {
return key;
}
} }

View File

@ -28,6 +28,7 @@ package com.github.games647.fastlogin.core.shared;
import com.github.games647.craftapi.resolver.MojangResolver; import com.github.games647.craftapi.resolver.MojangResolver;
import com.github.games647.craftapi.resolver.http.RotatingProxySelector; import com.github.games647.craftapi.resolver.http.RotatingProxySelector;
import com.github.games647.fastlogin.core.CommonUtil; import com.github.games647.fastlogin.core.CommonUtil;
import com.github.games647.fastlogin.core.ProxyAgnosticMojangResolver;
import com.github.games647.fastlogin.core.antibot.AntiBotService; import com.github.games647.fastlogin.core.antibot.AntiBotService;
import com.github.games647.fastlogin.core.antibot.AntiBotService.Action; import com.github.games647.fastlogin.core.antibot.AntiBotService.Action;
import com.github.games647.fastlogin.core.antibot.RateLimiter; import com.github.games647.fastlogin.core.antibot.RateLimiter;
@ -35,7 +36,6 @@ import com.github.games647.fastlogin.core.antibot.TickingRateLimiter;
import com.github.games647.fastlogin.core.hooks.AuthPlugin; import com.github.games647.fastlogin.core.hooks.AuthPlugin;
import com.github.games647.fastlogin.core.hooks.DefaultPasswordGenerator; import com.github.games647.fastlogin.core.hooks.DefaultPasswordGenerator;
import com.github.games647.fastlogin.core.hooks.PasswordGenerator; import com.github.games647.fastlogin.core.hooks.PasswordGenerator;
import com.github.games647.fastlogin.core.mojang.ProxyAgnosticMojangResolver;
import com.github.games647.fastlogin.core.storage.MySQLStorage; import com.github.games647.fastlogin.core.storage.MySQLStorage;
import com.github.games647.fastlogin.core.storage.SQLStorage; import com.github.games647.fastlogin.core.storage.SQLStorage;
import com.github.games647.fastlogin.core.storage.SQLiteStorage; import com.github.games647.fastlogin.core.storage.SQLiteStorage;

View File

@ -91,10 +91,10 @@ public abstract class LoginSession {
@Override @Override
public String toString() { public String toString() {
return new StringJoiner(", ", LoginSession.class.getSimpleName() + "[", "]") return new StringJoiner(", ", LoginSession.class.getSimpleName() + '[', "]")
.add("profile=" + profile) .add("profile=" + profile)
.add("requestUsername='" + requestUsername + "'") .add("requestUsername='" + requestUsername + '\'')
.add("username='" + username + "'") .add("username='" + username + '\'')
.add("uuid=" + uuid) .add("uuid=" + uuid)
.add("registered=" + registered) .add("registered=" + registered)
.toString(); .toString();

View File

@ -85,7 +85,7 @@ public class MySQLStorage extends SQLStorage {
// default false - available in newer versions caches the statements server-side // default false - available in newer versions caches the statements server-side
config.addDataSourceProperty("useServerPrepStmts", true); config.addDataSourceProperty("useServerPrepStmts", true);
// default false - prefer use of local values for autocommit and // default false - prefer use of local values for autocommit and
// transaction isolation (alwaysSendSetIsolation) should only be enabled if always use the set* methods // transaction isolation (alwaysSendSetIsolation) should only be enabled if we always use the set* methods
// instead of raw SQL // instead of raw SQL
// https://forums.mysql.com/read.php?39,626495,626512 // https://forums.mysql.com/read.php?39,626495,626512
config.addDataSourceProperty("useLocalSessionState", true); config.addDataSourceProperty("useLocalSessionState", true);

View File

@ -281,7 +281,7 @@ database: '{pluginDir}/FastLogin.db'
# MySQL/MariaDB # MySQL/MariaDB
# If you want to enable it, uncomment only the lines below; this not this line. # If you want to enable it, uncomment only the lines below; this not this line.
# If on velocity use 'mariadb' as driver # If on velocity use 'mariadb' as the driver
#driver: 'mysql' #driver: 'mysql'
#host: '127.0.0.1' #host: '127.0.0.1'
#port: 3306 #port: 3306

View File

@ -46,9 +46,9 @@ import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.plugin.annotation.DataDirectory; import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import com.velocitypowered.api.proxy.messages.ChannelMessageSink;
import com.velocitypowered.api.proxy.messages.ChannelRegistrar; import com.velocitypowered.api.proxy.messages.ChannelRegistrar;
import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
@ -159,7 +159,7 @@ public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
return server; return server;
} }
public void sendPluginMessage(RegisteredServer server, ChannelMessage message) { public void sendPluginMessage(ChannelMessageSink server, ChannelMessage message) {
if (server != null) { if (server != null) {
ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput(); ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
message.writeTo(dataOutput); message.writeTo(dataOutput);

View File

@ -48,7 +48,7 @@ public class ForceLoginTask
private final RegisteredServer server; private final RegisteredServer server;
//treat player as if they had a premium account, even when they don't used to do auto login for Floodgate //treat player as if they had a premium account, even when they don't use to do auto login for Floodgate
private final boolean forcedOnlineMode; private final boolean forcedOnlineMode;
public ForceLoginTask(FastLoginCore<Player, CommandSource, FastLoginVelocity> core, public ForceLoginTask(FastLoginCore<Player, CommandSource, FastLoginVelocity> core,