Remove all Auth plugins hooks #2

Merged
ham1255 merged 15 commits from dev/authRemoval into main 2021-06-16 17:18:33 +00:00
Showing only changes of commit 01afa29709 - Show all commits

View File

@ -1,6 +1,6 @@
From 8d20670f827b3ff5ba81e967c5e60f97f29b14bf Mon Sep 17 00:00:00 2001 From d545aec339fe904999ead07c9222f0310f4c5812 Mon Sep 17 00:00:00 2001
From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com> From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com>
Date: Mon, 14 Jun 2021 21:12:13 +0400 Date: Wed, 16 Jun 2021 20:58:08 +0400
Subject: [PATCH] preparing for first patch Subject: [PATCH] preparing for first patch
@ -14587,10 +14587,10 @@ index 46321d3..0000000
-} -}
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java
deleted file mode 100644 deleted file mode 100644
index 02cf086..0000000 index 74d4220..0000000
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java
+++ /dev/null +++ /dev/null
@@ -1,305 +0,0 @@ @@ -1,306 +0,0 @@
-/* -/*
- * SPDX-License-Identifier: MIT - * SPDX-License-Identifier: MIT
- * - *
@ -14849,6 +14849,7 @@ index 02cf086..0000000
- * <ul> - * <ul>
- * <li>allowFloodgateNameConflict - * <li>allowFloodgateNameConflict
- * <li>autoLoginFloodgate - * <li>autoLoginFloodgate
- * <li>autoRegisterFloodgate
- * </ul> - * </ul>
- * </p> - * </p>
- * - *
@ -14857,7 +14858,7 @@ index 02cf086..0000000
- */ - */
- private boolean isValidFloodgateConfigString(String key) { - private boolean isValidFloodgateConfigString(String key) {
- String value = core.getConfig().get(key).toString().toLowerCase(); - String value = core.getConfig().get(key).toString().toLowerCase();
- if (!value.equals("true") && !value.equals("linked") && !value.equals("false")) { - if (!value.equals("true") && !value.equals("linked") && !value.equals("false") && !value.equals("no-conflict")) {
- logger.error("Invalid value detected for {} in FastLogin/config.yml.", key); - logger.error("Invalid value detected for {} in FastLogin/config.yml.", key);
- return false; - return false;
- } - }
@ -17289,10 +17290,10 @@ index 042950b..0000000
-} -}
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java
deleted file mode 100644 deleted file mode 100644
index e126637..0000000 index 10239f0..0000000
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java
+++ /dev/null +++ /dev/null
@@ -1,287 +0,0 @@ @@ -1,295 +0,0 @@
-/* -/*
- * SPDX-License-Identifier: MIT - * SPDX-License-Identifier: MIT
- * - *
@ -17334,10 +17335,7 @@ index e126637..0000000
-import com.github.games647.craftapi.resolver.MojangResolver; -import com.github.games647.craftapi.resolver.MojangResolver;
-import com.github.games647.fastlogin.bukkit.BukkitLoginSession; -import com.github.games647.fastlogin.bukkit.BukkitLoginSession;
-import com.github.games647.fastlogin.bukkit.FastLoginBukkit; -import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
-import org.bukkit.entity.Player;
- -
-import javax.crypto.Cipher;
-import javax.crypto.SecretKey;
-import java.io.IOException; -import java.io.IOException;
-import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method; -import java.lang.reflect.Method;
@ -17351,11 +17349,23 @@ index e126637..0000000
-import java.util.Optional; -import java.util.Optional;
-import java.util.UUID; -import java.util.UUID;
- -
-import javax.crypto.Cipher;
-import javax.crypto.SecretKey;
-
-import org.bukkit.entity.Player;
-
-import static com.comphenix.protocol.PacketType.Login.Client.START; -import static com.comphenix.protocol.PacketType.Login.Client.START;
-import static com.comphenix.protocol.PacketType.Login.Server.DISCONNECT; -import static com.comphenix.protocol.PacketType.Login.Server.DISCONNECT;
- -
-public class VerifyResponseTask implements Runnable { -public class VerifyResponseTask implements Runnable {
- -
- private static final String ENCRYPTION_CLASS_NAME = "MinecraftEncryption";
- private static final Class<?> ENCRYPTION_CLASS;
-
- static {
- ENCRYPTION_CLASS = MinecraftReflection.getMinecraftClass("util." + ENCRYPTION_CLASS_NAME, ENCRYPTION_CLASS_NAME);
- }
-
- private final FastLoginBukkit plugin; - private final FastLoginBukkit plugin;
- private final PacketEvent packetEvent; - private final PacketEvent packetEvent;
- private final KeyPair serverKey; - private final KeyPair serverKey;
@ -17509,8 +17519,7 @@ index e126637..0000000
- .getMethodByParameters("a", Cipher.class, Cipher.class); - .getMethodByParameters("a", Cipher.class, Cipher.class);
- -
- // Get the needed Cipher helper method (used to generate ciphers from login key) - // Get the needed Cipher helper method (used to generate ciphers from login key)
- Class<?> encryptionClass = MinecraftReflection.getMinecraftClass("MinecraftEncryption"); - cipherMethod = FuzzyReflection.fromClass(ENCRYPTION_CLASS)
- cipherMethod = FuzzyReflection.fromClass(encryptionClass)
- .getMethodByParameters("a", int.class, Key.class); - .getMethodByParameters("a", int.class, Key.class);
- } - }
- } - }
@ -17922,10 +17931,10 @@ index c5dcc9c..0000000
-} -}
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/FloodgateAuthTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/FloodgateAuthTask.java diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/FloodgateAuthTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/FloodgateAuthTask.java
deleted file mode 100644 deleted file mode 100644
index 45c74a7..0000000 index 2900256..0000000
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/FloodgateAuthTask.java --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/FloodgateAuthTask.java
+++ /dev/null +++ /dev/null
@@ -1,96 +0,0 @@ @@ -1,127 +0,0 @@
-/* -/*
- * SPDX-License-Identifier: MIT - * SPDX-License-Identifier: MIT
- * - *
@ -17953,10 +17962,15 @@ index 45c74a7..0000000
- */ - */
-package com.github.games647.fastlogin.bukkit.task; -package com.github.games647.fastlogin.bukkit.task;
- -
-import java.io.IOException;
-import java.util.Optional;
-
-import org.bukkit.Bukkit; -import org.bukkit.Bukkit;
-import org.bukkit.entity.Player; -import org.bukkit.entity.Player;
-import org.geysermc.floodgate.api.player.FloodgatePlayer; -import org.geysermc.floodgate.api.player.FloodgatePlayer;
- -
-import com.github.games647.craftapi.model.Profile;
-import com.github.games647.craftapi.resolver.RateLimitException;
-import com.github.games647.fastlogin.bukkit.BukkitLoginSession; -import com.github.games647.fastlogin.bukkit.BukkitLoginSession;
-import com.github.games647.fastlogin.bukkit.FastLoginBukkit; -import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
-import com.github.games647.fastlogin.core.StoredProfile; -import com.github.games647.fastlogin.core.StoredProfile;
@ -17982,11 +17996,11 @@ index 45c74a7..0000000
- -
- // check if the Bedrock player is linked to a Java account - // check if the Bedrock player is linked to a Java account
- boolean isLinked = floodgatePlayer.getLinkedPlayer() != null; - boolean isLinked = floodgatePlayer.getLinkedPlayer() != null;
-
- AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook(); - AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook();
- -
- String autoLoginFloodgate = plugin.getCore().getConfig().get("autoLoginFloodgate").toString().toLowerCase(); - String autoLoginFloodgate = plugin.getCore().getConfig().get("autoLoginFloodgate").toString().toLowerCase();
- boolean autoRegisterFloodgate = plugin.getCore().getConfig().getBoolean("autoRegisterFloodgate"); - String autoRegisterFloodgate = plugin.getCore().getConfig().get("autoRegisterFloodgate").toString().toLowerCase();
- String allowNameConflict = plugin.getCore().getConfig().get("allowFloodgateNameConflict").toString().toLowerCase();
- -
- boolean isRegistered; - boolean isRegistered;
- try { - try {
@ -17998,7 +18012,33 @@ index 45c74a7..0000000
- return; - return;
- } - }
- -
- if (!isRegistered && !autoRegisterFloodgate) { - //decide if checks should be made for conflicting Java player names
- if (!isLinked //linked players have the same name as their Java profile
- // if allowNameConflict is 'false' or 'linked' and the player had a conflicting
- // name, than they would have been kicked in FloodgateHook#checkNameConflict
- && allowNameConflict.equals("true") &&
- (
- autoLoginFloodgate.equals("no-conflict")
- || !isRegistered && autoRegisterFloodgate.equals("no-conflict"))
- ) {
- // check for conflicting Premium Java name
- Optional<Profile> premiumUUID = Optional.empty();
- try {
- premiumUUID = plugin.getCore().getResolver().findProfile(player.getName());
- } catch (IOException | RateLimitException e) {
- plugin.getLog().error(
- "Could not check wether Floodgate Player {}'s name conflits a premium Java player's name.",
- player.getName());
- return;
- }
-
- //stop execution if player's name is conflicting
- if (premiumUUID.isPresent()) {
- return;
- }
- }
-
- if (!isRegistered && autoRegisterFloodgate.equals("false")) {
- plugin.getLog().info( - plugin.getLog().info(
- "Auto registration is disabled for Floodgate players in config.yml"); - "Auto registration is disabled for Floodgate players in config.yml");
- return; - return;