Remove all Auth plugins hooks #2

Merged
ham1255 merged 15 commits from dev/authRemoval into main 2021-06-16 17:18:33 +00:00
6 changed files with 1021 additions and 27 deletions

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 {
@ -17997,13 +18011,39 @@ index 45c74a7..0000000
- player.getName()); - player.getName());
- 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;
- } - }
- -
- // logging in from bedrock for a second time threw an error with UUID - // logging in from bedrock for a second time threw an error with UUID
- StoredProfile profile = plugin.getCore().getStorage().loadProfile(player.getName()); - StoredProfile profile = plugin.getCore().getStorage().loadProfile(player.getName());
- if (profile == null) { - if (profile == null) {
@ -18011,7 +18051,7 @@ index 45c74a7..0000000
- } - }
- -
- BukkitLoginSession session = new BukkitLoginSession(player.getName(), isRegistered, profile); - BukkitLoginSession session = new BukkitLoginSession(player.getName(), isRegistered, profile);
- -
- // enable auto login based on the value of 'autoLoginFloodgate' in config.yml - // enable auto login based on the value of 'autoLoginFloodgate' in config.yml
- session.setVerified(autoLoginFloodgate.equals("true") - session.setVerified(autoLoginFloodgate.equals("true")
- || (autoLoginFloodgate.equals("linked") && isLinked)); - || (autoLoginFloodgate.equals("linked") && isLinked));

View File

@ -82,7 +82,7 @@ index 8a81b14..db8f269 100644
+ } + }
+ } + }
+ //end of Govindas code + //end of Govindas code
+ // LimeLogin stop + // LimeLogin end
} }
private void setOfflineId(InitialHandler connection, String username) { private void setOfflineId(InitialHandler connection, String username) {
@ -156,7 +156,7 @@ index 94500cb..b304559 100644
+ if (!playerProfile.getName().contains("-")) { playerProfile.setPremium(true); } + if (!playerProfile.getName().contains("-")) { playerProfile.setPremium(true); }
+ //end of Govindas code + //end of Govindas code
+ +
+ // LimeLogin stop + // LimeLogin end
playerProfile.getSaveLock().lock(); playerProfile.getSaveLock().lock();
try { try {
if (playerProfile.isSaved()) { if (playerProfile.isSaved()) {
@ -170,7 +170,7 @@ index 94500cb..b304559 100644
+ if (!playerProfile.getName().contains("-")) { playerProfile.setPremium(true); } + if (!playerProfile.getName().contains("-")) { playerProfile.setPremium(true); }
+ //end of Govindas code + //end of Govindas code
+ +
+ // LimeLogin stop + // LimeLogin end
try (PreparedStatement saveStmt = con.prepareStatement(INSERT_PROFILE, RETURN_GENERATED_KEYS)) { try (PreparedStatement saveStmt = con.prepareStatement(INSERT_PROFILE, RETURN_GENERATED_KEYS)) {
saveStmt.setString(1, uuid); saveStmt.setString(1, uuid);
@ -189,7 +189,7 @@ index 7efb157..b417e64 100644
+ //storage.save(playerProfile); + //storage.save(playerProfile);
+ //end of Govindas comment + //end of Govindas comment
+ +
+ // LimeLogin stop + // LimeLogin end
} }
} catch (Exception ex) { } catch (Exception ex) {
core.getPlugin().getLog().warn("ERROR ON FORCE LOGIN of {}", getName(player), ex); core.getPlugin().getLog().warn("ERROR ON FORCE LOGIN of {}", getName(player), ex);
@ -240,11 +240,11 @@ index ec129a8..5490673 100644
+ //if (core.getConfig().get("autoRegister", false) && (authHook == null || !authHook.isRegistered(username))) { + //if (core.getConfig().get("autoRegister", false) && (authHook == null || !authHook.isRegistered(username))) {
+ //end of Govindas comment + //end of Govindas comment
+ +
+ // LimeLogin stop + // LimeLogin end
+ if (core.getConfig().get("autoRegister", false) && (authHook == null)) { + if (core.getConfig().get("autoRegister", false) && (authHook == null)) {
+ // LimeLogin start + // LimeLogin start
+ requestPremiumLogin(source, profile, username, false); //Comment: always use false to fix an error XD + requestPremiumLogin(source, profile, username, false); //Comment: always use false to fix an error XD
+ // LimeLogin stop + // LimeLogin end
return true; return true;
} }
@ -289,7 +289,7 @@ index 0000000..007083e
+ this.cancelled = cancelled; + this.cancelled = cancelled;
+ } + }
+} +}
+// LimeLogin stop +// LimeLogin end
\ No newline at end of file \ No newline at end of file
diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml
index ecb1c44..477c026 100644 index ecb1c44..477c026 100644

View File

@ -0,0 +1,55 @@
From c9c01ec47ebcf745765f9c086083315fb791e170 Mon Sep 17 00:00:00 2001
From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com>
Date: Wed, 16 Jun 2021 18:43:32 +0400
Subject: [PATCH] renamed class GovindasPreSecondAttemptEvent to
LimePreLoginSecondAttemptEvent
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
index 3f05090..099df66 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
@@ -34,7 +34,7 @@ import com.github.games647.fastlogin.core.shared.event.FastLoginPreLoginEvent;
import java.util.Optional;
-import com.github.games647.fastlogin.core.shared.event.GovindasPreSecondAttemptEvent;
+import com.github.games647.fastlogin.core.shared.event.LimePreLoginSecondAttemptEvent;
import net.md_5.bungee.api.ProxyServer;
import org.geysermc.floodgate.api.player.FloodgatePlayer;
@@ -83,7 +83,7 @@ public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
} else {
if (core.getPendingLogin().remove(ip + username) != null && config.get("secondAttemptCracked", false)) {
// LimeLogin start
- GovindasPreSecondAttemptEvent event = new GovindasPreSecondAttemptEvent(ip, username);
+ LimePreLoginSecondAttemptEvent event = new LimePreLoginSecondAttemptEvent(ip, username);
ProxyServer.getInstance().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
core.getPlugin().getLog().info("Second attempt login -> cracked {}", username);
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/GovindasPreSecondAttemptEvent.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/LimePreLoginSecondAttemptEvent.java
similarity index 78%
rename from core/src/main/java/com/github/games647/fastlogin/core/shared/event/GovindasPreSecondAttemptEvent.java
rename to core/src/main/java/com/github/games647/fastlogin/core/shared/event/LimePreLoginSecondAttemptEvent.java
index 5ac3cc9..1f9807d 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/GovindasPreSecondAttemptEvent.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/LimePreLoginSecondAttemptEvent.java
@@ -4,13 +4,13 @@ package com.github.games647.fastlogin.core.shared.event;
import net.md_5.bungee.api.plugin.Cancellable;
import net.md_5.bungee.api.plugin.Event;
-public class GovindasPreSecondAttemptEvent extends Event implements Cancellable {
+public class LimePreLoginSecondAttemptEvent extends Event implements Cancellable {
private final String ip;
private final String username;
private boolean cancelled;
- public GovindasPreSecondAttemptEvent(String ip, String username) {
+ public LimePreLoginSecondAttemptEvent(String ip, String username) {
this.ip = ip;
this.username = username;
}
--
2.32.0.windows.1

View File

@ -0,0 +1,74 @@
From d85a4cd57426f484fa46c9149dd9ace7ebc77170 Mon Sep 17 00:00:00 2001
From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com>
Date: Tue, 15 Jun 2021 02:09:53 +0400
Subject: [PATCH] removed hooks and commented them out
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
index e26b271..25f1ac2 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
@@ -25,9 +25,6 @@
*/
package com.github.games647.fastlogin.bungee;
-import com.github.games647.fastlogin.bungee.hook.BungeeAuthHook;
-import com.github.games647.fastlogin.bungee.hook.BungeeCordAuthenticatorBungeeHook;
-import com.github.games647.fastlogin.bungee.hook.SodionAuthHook;
import com.github.games647.fastlogin.bungee.listener.ConnectListener;
import com.github.games647.fastlogin.bungee.listener.PluginMessageListener;
import com.github.games647.fastlogin.core.AsyncScheduler;
@@ -50,7 +47,6 @@ import java.util.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ThreadFactory;
-import net.md_5.bungee.BungeeServerInfo;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.PendingConnection;
@@ -102,8 +98,9 @@ public class FastLoginBungee extends Plugin implements PlatformPlugin<CommandSen
//this is required to listen to incoming messages from the server
getProxy().registerChannel(NamespaceKey.getCombined(getName(), ChangePremiumMessage.CHANGE_CHANNEL));
getProxy().registerChannel(NamespaceKey.getCombined(getName(), SuccessMessage.SUCCESS_CHANNEL));
-
- registerHook();
+ // LimeLogin start
+ //registerHook();
+ // LimeLogin end
}
@Override
@@ -121,10 +118,11 @@ public class FastLoginBungee extends Plugin implements PlatformPlugin<CommandSen
return session;
}
+ // LimeLogin start
+ /* Author: Ham1255 !!! removed unwanted auth hooks now! !!!
private void registerHook() {
- try {
- List<Class<? extends AuthPlugin<ProxiedPlayer>>> hooks = Arrays.asList(
- BungeeAuthHook.class, BungeeCordAuthenticatorBungeeHook.class, SodionAuthHook.class);
+ try {
+ List<Class<? extends AuthPlugin<ProxiedPlayer>>> hooks = Arrays.asList();
for (Class<? extends AuthPlugin<ProxiedPlayer>> clazz : hooks) {
String pluginName = clazz.getSimpleName();
@@ -141,7 +139,8 @@ public class FastLoginBungee extends Plugin implements PlatformPlugin<CommandSen
} catch (ReflectiveOperationException ex) {
logger.error("Couldn't load the auth hook class", ex);
}
<<<<<<< HEAD
+ }
=======
- }
+ } */
>>>>>>> 654e137 (related to main)
+ // LimeLogin end
public void sendPluginMessage(Server server, ChannelMessage message) {
if (server != null) {
--
2.32.0.windows.1

View File

@ -0,0 +1,263 @@
From 151180bd97484b1dfc4342c73d0a73dc33669a2f Mon Sep 17 00:00:00 2001
From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com>
Date: Tue, 15 Jun 2021 02:10:12 +0400
Subject: [PATCH] deleted unwanted classes
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/BungeeAuthHook.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/BungeeAuthHook.java
deleted file mode 100644
index abddb17..0000000
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/BungeeAuthHook.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015-2021 <Your name and contributors>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package com.github.games647.fastlogin.bungee.hook;
-
-import com.github.games647.fastlogin.bungee.FastLoginBungee;
-import com.github.games647.fastlogin.core.hooks.AuthPlugin;
-
-import me.vik1395.BungeeAuth.Main;
-import me.vik1395.BungeeAuthAPI.RequestHandler;
-
-import net.md_5.bungee.api.connection.ProxiedPlayer;
-
-/**
- * GitHub: https://github.com/vik1395/BungeeAuth-Minecraft
- *
- * Project page:
- *
- * Spigot: https://www.spigotmc.org/resources/bungeeauth.493/
- */
-public class BungeeAuthHook implements AuthPlugin<ProxiedPlayer> {
-
- private final RequestHandler requestHandler = new RequestHandler();
-
- public BungeeAuthHook(FastLoginBungee plugin) {
- }
-
- @Override
- public boolean forceLogin(ProxiedPlayer player) {
- String playerName = player.getName();
- return Main.plonline.contains(playerName) || requestHandler.forceLogin(playerName);
- }
-
- @Override
- public boolean isRegistered(String playerName) {
- return requestHandler.isRegistered(playerName);
- }
-
- @Override
- public boolean forceRegister(ProxiedPlayer player, String password) {
- return requestHandler.forceRegister(player, password);
- }
-}
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/BungeeCordAuthenticatorBungeeHook.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/BungeeCordAuthenticatorBungeeHook.java
deleted file mode 100644
index beb56d9..0000000
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/BungeeCordAuthenticatorBungeeHook.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015-2021 <Your name and contributors>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package com.github.games647.fastlogin.bungee.hook;
-
-import java.sql.SQLException;
-
-import com.github.games647.fastlogin.bungee.FastLoginBungee;
-import com.github.games647.fastlogin.core.hooks.AuthPlugin;
-
-import de.xxschrandxx.bca.bungee.BungeeCordAuthenticatorBungee;
-import de.xxschrandxx.bca.bungee.api.BungeeCordAuthenticatorBungeeAPI;
-
-import net.md_5.bungee.api.connection.ProxiedPlayer;
-
-/**
- * GitHub:
- * https://github.com/xXSchrandXx/SpigotPlugins/tree/master/BungeeCordAuthenticator
- *
- * Project page:
- *
- * Spigot: https://www.spigotmc.org/resources/bungeecordauthenticator.87669/
- */
-public class BungeeCordAuthenticatorBungeeHook implements AuthPlugin<ProxiedPlayer> {
-
- public final BungeeCordAuthenticatorBungeeAPI api;
-
- public BungeeCordAuthenticatorBungeeHook(FastLoginBungee plugin) {
- api = ((BungeeCordAuthenticatorBungee) plugin.getProxy().getPluginManager()
- .getPlugin("BungeeCordAuthenticatorBungee")).getAPI();
- plugin.getLog().info("BungeeCordAuthenticatorHook | Hooked successful!");
- }
-
- @Override
- public boolean forceLogin(ProxiedPlayer player) {
- if (api.isAuthenticated(player)) {
- return true;
- } else {
- try {
- api.setAuthenticated(player);
- }
- catch (SQLException e) {
- e.printStackTrace();
- return false;
- }
- return true;
- }
- }
-
- @Override
- public boolean isRegistered(String playerName) {
- try {
- return api.getSQL().checkPlayerEntry(playerName);
- }
- catch (SQLException e) {
- e.printStackTrace();
- return false;
- }
- }
-
- @Override
- public boolean forceRegister(ProxiedPlayer player, String password) {
- try {
- return api.createPlayerEntry(player, password);
- }
- catch (SQLException e) {
- e.printStackTrace();
- return false;
- }
- }
-}
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/SodionAuthHook.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/SodionAuthHook.java
deleted file mode 100644
index c12f2b0..0000000
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/SodionAuthHook.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015-2021 <Your name and contributors>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package com.github.games647.fastlogin.bungee.hook;
-
-import com.github.games647.fastlogin.bungee.FastLoginBungee;
-import com.github.games647.fastlogin.core.hooks.AuthPlugin;
-import net.md_5.bungee.api.connection.ProxiedPlayer;
-import red.mohist.sodionauth.bungee.implementation.BungeePlayer;
-import red.mohist.sodionauth.core.SodionAuthApi;
-import red.mohist.sodionauth.core.exception.AuthenticatedException;
-
-/**
- * GitHub: https://github.com/Mohist-Community/SodionAuth
- * <p>
- * Project page: https://gitea.e-loli.com/SodionAuth/SodionAuth
- * <p>
- * Bukkit: Unknown
- * <p>
- * Spigot: https://www.spigotmc.org/resources/sodionauth.76944/
- */
-public class SodionAuthHook implements AuthPlugin<ProxiedPlayer> {
-
- private final FastLoginBungee plugin;
-
- public SodionAuthHook(FastLoginBungee plugin) {
- this.plugin = plugin;
- }
-
- @Override
- public boolean forceLogin(ProxiedPlayer player) {
- try {
- SodionAuthApi.login(new BungeePlayer(player));
- } catch (AuthenticatedException e) {
- plugin.getLog().warn(ALREADY_AUTHENTICATED, player);
- return false;
- }
- return true;
- }
-
- @Override
- public boolean forceRegister(ProxiedPlayer player, String password) {
- try{
- return SodionAuthApi.register(new BungeePlayer(player), password);
- } catch (UnsupportedOperationException e){
- plugin.getLog().warn("Currently SodionAuth is not accepting forceRegister, " +
- "It may be caused by unsupported AuthBackend");
- return false;
- }
- }
-
- @Override
- public boolean isRegistered(String playerName) {
- return SodionAuthApi.isRegistered(playerName);
- }
-}
--
2.32.0.windows.1

View File

@ -0,0 +1,562 @@
From 4975802f5fcea2ef9cfa06df8b9a0939961ff935 Mon Sep 17 00:00:00 2001
From: mohammed jasem alaajel <34905970+ham1255@users.noreply.github.com>
Date: Tue, 15 Jun 2021 02:28:50 +0400
Subject: [PATCH] Removing all Auth related stuff
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
index 25f1ac2..ec6f74a 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java
@@ -29,7 +29,6 @@ import com.github.games647.fastlogin.bungee.listener.ConnectListener;
import com.github.games647.fastlogin.bungee.listener.PluginMessageListener;
import com.github.games647.fastlogin.core.AsyncScheduler;
import com.github.games647.fastlogin.core.CommonUtil;
-import com.github.games647.fastlogin.core.hooks.AuthPlugin;
import com.github.games647.fastlogin.core.message.ChangePremiumMessage;
import com.github.games647.fastlogin.core.message.ChannelMessage;
import com.github.games647.fastlogin.core.message.NamespaceKey;
@@ -42,8 +41,6 @@ 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.List;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ThreadFactory;
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
index db8f269..07df30a 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java
@@ -32,7 +32,6 @@ import com.github.games647.fastlogin.bungee.hook.floodgate.FloodgateHook;
import com.github.games647.fastlogin.bungee.hook.floodgate.FloodgateV1Hook;
import com.github.games647.fastlogin.bungee.hook.floodgate.FloodgateV2Hook;
import com.github.games647.fastlogin.bungee.task.AsyncPremiumCheck;
-import com.github.games647.fastlogin.bungee.task.ForceLoginTask;
import com.github.games647.fastlogin.core.RateLimiter;
import com.github.games647.fastlogin.core.StoredProfile;
import com.github.games647.fastlogin.core.shared.LoginSession;
@@ -249,8 +248,12 @@ public class ConnectListener implements Listener {
// delay sending force command, because Paper will process the login event asynchronously
// In this case it means that the force command (plugin message) is already received and processed while
// player is still in the login phase and reported to be offline.
- Runnable loginTask = new ForceLoginTask(plugin.getCore(), player, server, session);
- plugin.getScheduler().runAsync(loginTask);
+
+ // LimeLogin start
+ //Disabled...
+ //Runnable loginTask = new ForceLoginTask(plugin.getCore(), player, server, session);
+ //plugin.getScheduler().runAsync(loginTask);
+ // LimeLogin end
}
@EventHandler
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/task/AsyncPremiumCheck.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/task/AsyncPremiumCheck.java
index 410b1e4..0136f09 100644
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/task/AsyncPremiumCheck.java
+++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/task/AsyncPremiumCheck.java
@@ -49,8 +49,9 @@ public class AsyncPremiumCheck extends JoinManagement<ProxiedPlayer, CommandSend
public AsyncPremiumCheck(FastLoginBungee plugin, PreLoginEvent preLoginEvent, PendingConnection connection,
String username) {
- super(plugin.getCore(), plugin.getCore().getAuthPluginHook());
-
+ // LimeLogin start
+ super(plugin.getCore());
+ // LimeLogin end
<<<<<<< HEAD
=======
>>>>>>> 654e137 (related to main)
this.plugin = plugin;
this.preLoginEvent = preLoginEvent;
this.connection = connection;
diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/task/ForceLoginTask.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/task/ForceLoginTask.java
deleted file mode 100644
index 0a7f862..0000000
--- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/task/ForceLoginTask.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015-2021 <Your name and contributors>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package com.github.games647.fastlogin.bungee.task;
-
-import com.github.games647.fastlogin.bungee.BungeeLoginSession;
-import com.github.games647.fastlogin.bungee.FastLoginBungee;
-import com.github.games647.fastlogin.bungee.event.BungeeFastLoginAutoLoginEvent;
-import com.github.games647.fastlogin.core.StoredProfile;
-import com.github.games647.fastlogin.core.message.ChannelMessage;
-import com.github.games647.fastlogin.core.message.LoginActionMessage;
-import com.github.games647.fastlogin.core.message.LoginActionMessage.Type;
-import com.github.games647.fastlogin.core.shared.FastLoginCore;
-import com.github.games647.fastlogin.core.shared.ForceLoginManagement;
-import com.github.games647.fastlogin.core.shared.LoginSession;
-import com.github.games647.fastlogin.core.shared.event.FastLoginAutoLoginEvent;
-
-import java.util.UUID;
-
-import net.md_5.bungee.api.CommandSender;
-import net.md_5.bungee.api.ProxyServer;
-import net.md_5.bungee.api.connection.ProxiedPlayer;
-import net.md_5.bungee.api.connection.Server;
-
-public class ForceLoginTask
- extends ForceLoginManagement<ProxiedPlayer, CommandSender, BungeeLoginSession, FastLoginBungee> {
-
- private final Server server;
-
- public ForceLoginTask(FastLoginCore<ProxiedPlayer, CommandSender, FastLoginBungee> core,
- ProxiedPlayer player, Server server, BungeeLoginSession session) {
- super(core, player, session);
-
- this.server = server;
- }
-
- @Override
- public void run() {
- if (session == null) {
- return;
- }
-
- super.run();
-
- if (!isOnlineMode()) {
- session.setAlreadySaved(true);
- }
- }
-
- @Override
- public boolean forceLogin(ProxiedPlayer player) {
- if (session.isAlreadyLogged()) {
- return true;
- }
-
- session.setAlreadyLogged(true);
- return super.forceLogin(player);
- }
-
- @Override
- public FastLoginAutoLoginEvent callFastLoginAutoLoginEvent(LoginSession session, StoredProfile profile) {
- return core.getPlugin().getProxy().getPluginManager()
- .callEvent(new BungeeFastLoginAutoLoginEvent(session, profile));
- }
-
- @Override
- public boolean forceRegister(ProxiedPlayer player) {
- return session.isAlreadyLogged() || super.forceRegister(player);
- }
-
- @Override
- public void onForceActionSuccess(LoginSession session) {
- //sub channel name
- Type type = Type.LOGIN;
- if (session.needsRegistration()) {
- type = Type.REGISTER;
- }
-
- UUID proxyId = UUID.fromString(ProxyServer.getInstance().getConfig().getUuid());
- ChannelMessage loginMessage = new LoginActionMessage(type, player.getName(), proxyId);
-
- core.getPlugin().sendPluginMessage(server, loginMessage);
- }
-
- @Override
- public String getName(ProxiedPlayer player) {
- return player.getName();
- }
-
- @Override
- public boolean isOnline(ProxiedPlayer player) {
- return player.isConnected();
- }
-
- @Override
- public boolean isOnlineMode() {
- return player.getPendingConnection().isOnlineMode();
- }
-}
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/hooks/AuthPlugin.java b/core/src/main/java/com/github/games647/fastlogin/core/hooks/AuthPlugin.java
deleted file mode 100644
index 1a614ba..0000000
--- a/core/src/main/java/com/github/games647/fastlogin/core/hooks/AuthPlugin.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015-2021 <Your name and contributors>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package com.github.games647.fastlogin.core.hooks;
-
-/**
- * Represents a supporting authentication plugin in BungeeCord and Bukkit/Spigot/... servers
- *
- * @param <P> either {@link org.bukkit.entity.Player} for Bukkit or {@link net.md_5.bungee.api.connection.ProxiedPlayer}
- * for BungeeCord
- */
-public interface AuthPlugin<P> {
-
- String ALREADY_AUTHENTICATED = "Player {} is already authenticated. Cancelling force login.";
-
- /**
- * Login the premium (paid account) player after the player joined successfully the server.
- *
- * <strong>This operation will be performed async while the player successfully
- * joined the server.</strong>
- *
- * @param player the player that needs to be logged in
- * @return if the operation was successful
- */
- boolean forceLogin(P player);
-
- /**
- * Forces a register in order to protect the paid account.
- *
- * <strong>This operation will be performed async while the player successfully
- * joined the server.</strong>
- *
- * After a successful registration the player should be logged
- * in too.
- *
- * The method will be called only for premium accounts.
- * So it's recommended to set additionally premium property
- * if possible.
- *
- * Background: If we don't register an account, cracked players
- * could steal the unregistered account from the paid
- * player account
- *
- * @param player the premium account
- * @param password a strong random generated password
- * @return if the operation was successful
- */
- boolean forceRegister(P player, String password);
-
- /**
- * Checks whether an account exists for this player name.
- *
- * 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.
- *
- * This operation will be performed async while the player is
- * connecting.
- *
- * @param playerName player name
- * @return if the player has an account
- * @throws Exception if an error occurred
- */
- boolean isRegistered(String playerName) throws Exception;
-}
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java
index ec3f924..90c9add 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java
@@ -30,7 +30,6 @@ import com.github.games647.craftapi.resolver.http.RotatingProxySelector;
import com.github.games647.fastlogin.core.AuthStorage;
import com.github.games647.fastlogin.core.CommonUtil;
import com.github.games647.fastlogin.core.RateLimiter;
-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.google.common.net.HostAndPort;
@@ -85,8 +84,9 @@ public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
private AuthStorage storage;
private RateLimiter rateLimiter;
private PasswordGenerator<P> passwordGenerator = new DefaultPasswordGenerator<>();
- private AuthPlugin<P> authPlugin;
-
+ // LimeLogin start
+ //private AuthPlugin<P> authPlugin;
+ // LimeLogin end
<<<<<<< HEAD
=======
>>>>>>> 654e137 (related to main)
public FastLoginCore(T plugin) {
this.plugin = plugin;
}
@@ -251,17 +251,25 @@ public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
return pendingConfirms;
}
+ // LimeLogin start
+ /*
public AuthPlugin<P> getAuthPluginHook() {
return authPlugin;
}
+ */
+ // LimeLogin end
<<<<<<< HEAD
=======
>>>>>>> 654e137 (related to main)
public RateLimiter getRateLimiter() {
return rateLimiter;
}
+ // LimeLogin start
+ /*
public void setAuthPluginHook(AuthPlugin<P> authPlugin) {
this.authPlugin = authPlugin;
}
+ */
+ // LimeLogin end
public void saveDefaultFile(String fileName) {
Path dataFolder = plugin.getPluginFolder();
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/ForceLoginManagement.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/ForceLoginManagement.java
deleted file mode 100644
index b417e64..0000000
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/ForceLoginManagement.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * SPDX-License-Identifier: MIT
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015-2021 <Your name and contributors>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package com.github.games647.fastlogin.core.shared;
-
-import com.github.games647.fastlogin.core.AuthStorage;
-import com.github.games647.fastlogin.core.StoredProfile;
-import com.github.games647.fastlogin.core.hooks.AuthPlugin;
-import com.github.games647.fastlogin.core.shared.event.FastLoginAutoLoginEvent;
-
-public abstract class ForceLoginManagement<P extends C, C, L extends LoginSession, T extends PlatformPlugin<C>>
- implements Runnable {
-
- protected final FastLoginCore<P, C, T> core;
- protected final P player;
- protected final L session;
-
- public ForceLoginManagement(FastLoginCore<P, C, T> core, P player, L session) {
- this.core = core;
- this.player = player;
- this.session = session;
- }
-
- @Override
- public void run() {
- if (!isOnline(player)) {
- core.getPlugin().getLog().info("Player {} disconnected", player);
- return;
- }
-
- if (session == null) {
- core.getPlugin().getLog().info("No valid session found for {}", player);
- return;
- }
-
- AuthStorage storage = core.getStorage();
- StoredProfile playerProfile = session.getProfile();
- try {
- if (isOnlineMode()) {
- //premium player
- AuthPlugin<P> authPlugin = core.getAuthPluginHook();
- if (authPlugin == null) {
- //maybe only bungeecord plugin
- onForceActionSuccess(session);
- } else {
- boolean success = true;
- String playerName = getName(player);
- if (core.getConfig().get("autoLogin", true)) {
- if (session.needsRegistration()
- || (core.getConfig().get("auto-register-unknown", false)
- && !authPlugin.isRegistered(playerName))) {
- success = forceRegister(player);
- } else if (!callFastLoginAutoLoginEvent(session, playerProfile).isCancelled()) {
- success = forceLogin(player);
- }
- }
-
- if (success) {
- //update only on success to prevent corrupt data
- if (playerProfile != null) {
- playerProfile.setId(session.getUuid());
- playerProfile.setPremium(true);
- storage.save(playerProfile);
- }
-
- onForceActionSuccess(session);
- }
- }
- } else if (playerProfile != null) {
- //cracked player
- playerProfile.setId(null);
- playerProfile.setPremium(false);
- // LimeLogin start
-
- //Govindas comment - don't save cracked player profiles, I found it to be useless
- //storage.save(playerProfile);
- //end of Govindas comment
-
- // LimeLogin end
- }
- } catch (Exception ex) {
- core.getPlugin().getLog().warn("ERROR ON FORCE LOGIN of {}", getName(player), ex);
- }
- }
-
- public boolean forceRegister(P player) {
- core.getPlugin().getLog().info("Register player {}", getName(player));
-
- String generatedPassword = core.getPasswordGenerator().getRandomPassword(player);
- boolean success = core.getAuthPluginHook().forceRegister(player, generatedPassword);
-
- String message = core.getMessage("auto-register");
- if (success && message != null) {
- message = message.replace("%password", generatedPassword);
- core.getPlugin().sendMessage(player, message);
- }
-
- return success;
- }
-
- public boolean forceLogin(P player) {
- core.getPlugin().getLog().info("Logging player {} in", getName(player));
-
- boolean success = core.getAuthPluginHook().forceLogin(player);
- if (success) {
- core.sendLocaleMessage("auto-login", player);
- }
-
- return success;
- }
-
- public abstract FastLoginAutoLoginEvent callFastLoginAutoLoginEvent(LoginSession session, StoredProfile profile);
-
- public abstract void onForceActionSuccess(LoginSession session);
-
- public abstract String getName(P player);
-
- public abstract boolean isOnline(P player);
-
- public abstract boolean isOnlineMode();
-}
diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
index 5490673..dabe324 100644
--- a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
+++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java
@@ -28,7 +28,6 @@ package com.github.games647.fastlogin.core.shared;
import com.github.games647.craftapi.model.Profile;
import com.github.games647.craftapi.resolver.RateLimitException;
import com.github.games647.fastlogin.core.StoredProfile;
-import com.github.games647.fastlogin.core.hooks.AuthPlugin;
import com.github.games647.fastlogin.core.hooks.FloodgateHook;
import com.github.games647.fastlogin.core.shared.event.FastLoginPreLoginEvent;
@@ -43,14 +42,18 @@ import net.md_5.bungee.config.Configuration;
public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
protected final FastLoginCore<P, C, ?> core;
- protected final AuthPlugin<P> authHook;
+ // LimeLogin start
+ //protected final AuthPlugin<P> authHook;
+ // LimeLogin end
private final FloodgateHook<P, C, ?> floodgateHook;
- public JoinManagement(FastLoginCore<P, C, ?> core, AuthPlugin<P> authHook) {
+ // LimeLogin start
+ public JoinManagement(FastLoginCore<P, C, ?> core) {
this.core = core;
- this.authHook = authHook;
this.floodgateHook = new FloodgateHook<>(core);
}
<<<<<<< HEAD
=======
>>>>>>> 654e137 (related to main)
+ // LimeLogin end
+
public void onLogin(String username, S source) {
core.getPlugin().getLog().info("Handling player {}", username);
@@ -130,7 +133,7 @@ public abstract class JoinManagement<P extends C, C, S extends LoginSource> {
//end of Govindas comment
<<<<<<< HEAD
// LimeLogin end
=======
// LimeLogin end
>>>>>>> 654e137 (related to main)
- if (core.getConfig().get("autoRegister", false) && (authHook == null)) {
+ if (core.getConfig().get("autoRegister", false)) {
// LimeLogin start
requestPremiumLogin(source, profile, username, false); //Comment: always use false to fix an error XD
// LimeLogin end
<<<<<<< HEAD
=======
>>>>>>> 654e137 (related to main)
--
2.32.0.windows.1