removed all auth hooks stuff

This commit is contained in:
mohammed jasem alaajel 2021-06-15 02:30:29 +04:00
parent 01afa29709
commit 80af642a40
3 changed files with 866 additions and 0 deletions

View File

@ -0,0 +1,68 @@
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 stop
}
@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);
}
- }
+ } */
+ // LimeLogin stop
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,535 @@
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 stop
}
@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 stop
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 stop
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 stop
public RateLimiter getRateLimiter() {
return rateLimiter;
}
+ // LimeLogin start
+ /*
public void setAuthPluginHook(AuthPlugin<P> authPlugin) {
this.authPlugin = authPlugin;
}
+ */
+ // LimeLogin stop
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 stop
- }
- } 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 stop
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);
}
+ // LimeLogin stop
+
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
// LimeLogin stop
- 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 stop
--
2.32.0.windows.1