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.
*
* <p>
* This session is invalid if the player disconnects or the login was successful
*/
public class BukkitLoginSession extends LoginSession {
@ -76,7 +76,7 @@ public class BukkitLoginSession extends LoginSession {
/**
* Gets the verify-token the server sent to the client.
*
* <p>
* Empty if it's a BungeeCord connection
*
* @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.
*
* <p>
* 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.
*/

View File

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

View File

@ -178,7 +178,8 @@ class EncryptionUtilTest {
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
// sha1 := Sha1()
// 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.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.time.Instant;
@ -58,7 +59,7 @@ public class ResourceLoader {
) {
PemObject pemObject = pemReader.readPemObject();
byte[] content = pemObject.getContent();
PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(content);
KeySpec privateKeySpec = new PKCS8EncodedKeySpec(content);
KeyFactory factory = KeyFactory.getInstance("RSA");
return (RSAPrivateKey) factory.generatePrivate(privateKeySpec);
@ -88,7 +89,7 @@ public class ResourceLoader {
) {
PemObject pemObject = pemReader.readPemObject();
byte[] content = pemObject.getContent();
X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(content);
KeySpec pubKeySpec = new X509EncodedKeySpec(content);
KeyFactory factory = KeyFactory.getInstance("RSA");
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 java.nio.file.Path;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ThreadFactory;
@ -128,7 +128,7 @@ public class FastLoginBungee extends Plugin implements PlatformPlugin<CommandSen
private void registerHook() {
try {
List<Class<? extends AuthPlugin<ProxiedPlayer>>> hooks = Arrays.asList(
List<Class<? extends AuthPlugin<ProxiedPlayer>>> hooks = Collections.singletonList(
BungeeAuthHook.class
);

View File

@ -36,9 +36,9 @@ import net.md_5.bungee.api.connection.ProxiedPlayer;
/**
* GitHub:
* <a href="https://github.com/vik1395/BungeeAuth-Minecraft">...</a>
*
* <p>
* Project page:
*
* <p>
* Spigot:
* <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
* 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.resolver.MojangResolver;

View File

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

View File

@ -48,4 +48,12 @@ public class NamespaceKey {
public static String getCombined(String namespace, String key) {
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.http.RotatingProxySelector;
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.Action;
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.DefaultPasswordGenerator;
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.SQLStorage;
import com.github.games647.fastlogin.core.storage.SQLiteStorage;

View File

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

View File

@ -85,7 +85,7 @@ public class MySQLStorage extends SQLStorage {
// default false - available in newer versions caches the statements server-side
config.addDataSourceProperty("useServerPrepStmts", true);
// 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
// https://forums.mysql.com/read.php?39,626495,626512
config.addDataSourceProperty("useLocalSessionState", true);

View File

@ -281,7 +281,7 @@ database: '{pluginDir}/FastLogin.db'
# MySQL/MariaDB
# 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'
#host: '127.0.0.1'
#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.proxy.Player;
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.MinecraftChannelIdentifier;
import com.velocitypowered.api.proxy.server.RegisteredServer;
import java.io.IOException;
import java.net.InetSocketAddress;
@ -159,7 +159,7 @@ public class FastLoginVelocity implements PlatformPlugin<CommandSource> {
return server;
}
public void sendPluginMessage(RegisteredServer server, ChannelMessage message) {
public void sendPluginMessage(ChannelMessageSink server, ChannelMessage message) {
if (server != null) {
ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput();
message.writeTo(dataOutput);

View File

@ -48,7 +48,7 @@ public class ForceLoginTask
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;
public ForceLoginTask(FastLoginCore<Player, CommandSource, FastLoginVelocity> core,