Add support for Passky login plugin (#1289)

This commit is contained in:
Alex (TuxCoding)
2025-05-20 11:19:54 +02:00
committed by GitHub
4 changed files with 71 additions and 1 deletions

View File

@ -348,6 +348,14 @@
</exclusions>
</dependency>
<dependency>
<groupId>com.github.zigazajc007</groupId>
<artifactId>Passky</artifactId>
<version>v3.0.0</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<!--No maven repository :(-->
<dependency>
<groupId>de.st_ddt.crazy</groupId>

View File

@ -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<Player> {
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));
}
}

View File

@ -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<Class<? extends AuthPlugin<Player>>> hooks = Arrays.asList(AuthMeHook.class,
CrazyLoginHook.class, LogItHook.class, LoginSecurityHook.class, UltraAuthHook.class,
XAuthHook.class);
XAuthHook.class, PasskyHook.class);
for (Class<? extends AuthPlugin<Player>> clazz : hooks) {
String pluginName = clazz.getSimpleName();

View File

@ -30,6 +30,7 @@ softdepend:
- LogIt
- UltraAuth
- xAuth
- Passky
commands:
${project.parent.name}: