mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 02:37:34 +02:00
- Fix Passky hook
- Implement debug logs to Passky
This commit is contained in:
@ -25,31 +25,38 @@
|
|||||||
*/
|
*/
|
||||||
package com.github.games647.fastlogin.bukkit.hook;
|
package com.github.games647.fastlogin.bukkit.hook;
|
||||||
|
|
||||||
|
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
|
||||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||||
import com.rabbitcomapny.Passky;
|
import com.rabbitcomapny.api.*;
|
||||||
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;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PasskyHook implements AuthPlugin<Player> {
|
public class PasskyHook implements AuthPlugin<Player> {
|
||||||
|
|
||||||
private final Passky plugin;
|
private final FastLoginBukkit plugin;
|
||||||
|
|
||||||
public PasskyHook(Passky plugin) {
|
public PasskyHook(FastLoginBukkit plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean forceLogin(Player player) {
|
public boolean forceLogin(Player player) {
|
||||||
LoginResult result = PasskyAPI.forceLogin(new Identifier(player), true);
|
LoginResult result = PasskyAPI.forceLogin(new Identifier(player), true);
|
||||||
|
|
||||||
|
if (!result.success && result.status == LoginStatus.ALREADY_LOGGED_IN) {
|
||||||
|
plugin.getLog().debug("Player {} already logged in via Passky", player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
return result.success;
|
return result.success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean forceRegister(Player player, String password) {
|
public boolean forceRegister(Player player, String password) {
|
||||||
RegisterResult result = PasskyAPI.forceRegister(new Identifier(player), password, true);
|
RegisterResult result = PasskyAPI.forceRegister(new Identifier(player), password, true);
|
||||||
|
|
||||||
|
if (!result.success) {
|
||||||
|
plugin.getLog().debug("Failed to register {} via Passky: {}", player.getName(), result.status);
|
||||||
|
}
|
||||||
|
|
||||||
return result.success;
|
return result.success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user