diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 03065f26..fcef5991 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -348,6 +348,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}: