From 7bf613c8b49874b930eaec460db77f3312bb7e89 Mon Sep 17 00:00:00 2001 From: Ziga Date: Thu, 24 Apr 2025 20:55:03 +0200 Subject: [PATCH 1/2] Add support for Passky login plugin --- bukkit/pom.xml | 14 +++++ .../fastlogin/bukkit/hook/PasskyHook.java | 60 +++++++++++++++++++ .../bukkit/task/DelayedAuthHook.java | 3 +- bukkit/src/main/resources/plugin.yml | 1 + 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hook/PasskyHook.java diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 03065f26..43f1bb8f 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -137,6 +137,12 @@ + + + jitpack.io + https://jitpack.io + + placeholderapi @@ -348,6 +354,14 @@ + + com.github.zigazajc007 + Passky + v3.0.0 + provided + true + + de.st_ddt.crazy diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hook/PasskyHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hook/PasskyHook.java new file mode 100644 index 00000000..f0c9a406 --- /dev/null +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hook/PasskyHook.java @@ -0,0 +1,60 @@ +/* + * SPDX-License-Identifier: MIT + * + * The MIT License (MIT) + * + * Copyright (c) 2015-2024 games647 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.bukkit.hook; + +import com.github.games647.fastlogin.core.hooks.AuthPlugin; +import com.rabbitcomapny.Passky; +import com.rabbitcomapny.api.Identifier; +import com.rabbitcomapny.api.LoginResult; +import com.rabbitcomapny.api.PasskyAPI; +import com.rabbitcomapny.api.RegisterResult; +import org.bukkit.entity.Player; + +public class PasskyHook implements AuthPlugin { + + private final Passky plugin; + + public PasskyHook(Passky plugin) { + this.plugin = plugin; + } + + @Override + public boolean forceLogin(Player player) { + LoginResult result = PasskyAPI.forceLogin(new Identifier(player), true); + return result.success; + } + + @Override + public boolean forceRegister(Player player, String password) { + RegisterResult result = PasskyAPI.forceRegister(new Identifier(player), password, true); + return result.success; + } + + @Override + public boolean isRegistered(String playerName) throws Exception { + return PasskyAPI.isRegistered(new Identifier(playerName)); + } +} diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/DelayedAuthHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/DelayedAuthHook.java index 510fa614..90372e1e 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/DelayedAuthHook.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/task/DelayedAuthHook.java @@ -32,6 +32,7 @@ import com.github.games647.fastlogin.bukkit.hook.LogItHook; import com.github.games647.fastlogin.bukkit.hook.LoginSecurityHook; import com.github.games647.fastlogin.bukkit.hook.UltraAuthHook; import com.github.games647.fastlogin.bukkit.hook.XAuthHook; +import com.github.games647.fastlogin.bukkit.hook.PasskyHook; import com.github.games647.fastlogin.core.hooks.AuthPlugin; import org.bukkit.Bukkit; import org.bukkit.entity.Player; @@ -94,7 +95,7 @@ public class DelayedAuthHook implements Runnable { try { List>> hooks = Arrays.asList(AuthMeHook.class, CrazyLoginHook.class, LogItHook.class, LoginSecurityHook.class, UltraAuthHook.class, - XAuthHook.class); + XAuthHook.class, PasskyHook.class); for (Class> clazz : hooks) { String pluginName = clazz.getSimpleName(); diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index 4144766b..c6d810a3 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -30,6 +30,7 @@ softdepend: - LogIt - UltraAuth - xAuth + - Passky commands: ${project.parent.name}: From e1ba698f28f395e383327cd7649de05c8c49e4d4 Mon Sep 17 00:00:00 2001 From: Ziga Date: Thu, 24 Apr 2025 21:01:11 +0200 Subject: [PATCH 2/2] Remove duplicated repository --- bukkit/pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 43f1bb8f..fcef5991 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -137,12 +137,6 @@ - - - jitpack.io - https://jitpack.io - - placeholderapi