Add JavaDoc snippets and tiny reformats

This commit is contained in:
games647
2023-08-31 11:55:39 +02:00
parent b48dfed709
commit 159a6ed37c
8 changed files with 45 additions and 5 deletions

View File

@ -228,6 +228,22 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin<Comman
/**
* Fetches the premium status of an online player.
* {@snippet :
* // Bukkit's players object after successful authentication i.e. PlayerJoinEvent
* // except for proxies like BungeeCord and Velocity where the details are sent delayed (1-2 seconds)
* Player player;
* PremiumStatus status = JavaPlugin.getPlugin(FastLoginBukkit.class).getStatus(player.getUniqueId());
* switch (status) {
* case CRACKED:
* // player is offline
* break;
* case PREMIUM:
* // account is premium and player passed the verification
* break;
* case UNKNOWN:
* // no record about this player
* }
* }
*
* @param onlinePlayer player that is currently online player (play state)
* @return the online status or unknown if an error happened, the player isn't online or BungeeCord doesn't send

View File

@ -25,8 +25,17 @@
*/
package com.github.games647.fastlogin.core.hooks;
/**
* Password generator for your auth plugin.
* @param <P> platform dependent player class
*/
@FunctionalInterface
public interface PasswordGenerator<P> {
/**
* Generate a password for a non-registered player
* @param player
* @return daw
*/
String getRandomPassword(P player);
}

View File

@ -29,9 +29,20 @@ import com.github.games647.fastlogin.core.shared.LoginSession;
import com.github.games647.fastlogin.core.storage.StoredProfile;
/**
* This event fires if the plugin performs an auto login on the platform where the login plugin is.
* This event fires if the plugin performs an auto login on the platform where the login plugin is
*
* {@snippet :
* @EventHandler()
* public void onPlayerLogin(FastLoginAutoLoginEvent loginEvent) {
* StoredProfile profile = loginEvent.getProfile();
* LoginSession session = loginEvent.getSession();
*
* System.out.println("Player: " + session.getUsername() + " is about to be force logged in");
* }
* }
*/
public interface FastLoginAutoLoginEvent extends FastLoginCancellableEvent {
LoginSession getSession();
StoredProfile getProfile();
}

View File

@ -28,5 +28,6 @@ package com.github.games647.fastlogin.core.shared.event;
public interface FastLoginCancellableEvent {
boolean isCancelled();
void setCancelled(boolean cancelled);
}

View File

@ -34,6 +34,8 @@ import com.github.games647.fastlogin.core.storage.StoredProfile;
public interface FastLoginPreLoginEvent {
String getUsername();
LoginSource getSource();
StoredProfile getProfile();
}

View File

@ -33,6 +33,7 @@ import com.github.games647.fastlogin.core.storage.StoredProfile;
public interface FastLoginPremiumToggleEvent {
StoredProfile getProfile();
PremiumToggleReason getReason();
enum PremiumToggleReason {

View File

@ -51,8 +51,6 @@
<!-- Verify Java 8 compatibility while compiling with a newer toolchain
(i.e. check for unavailable methods) -->
<java.version>8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.release>${java.version}</maven.compiler.release>
<floodgate.version>development-2.2.2-SNAPSHOT</floodgate.version>

View File

@ -53,10 +53,12 @@ public class VelocityLoginSource implements LoginSource {
public void kick(String message) {
if (message == null) {
preLoginEvent.setResult(PreLoginEvent.PreLoginComponentResult.denied(
Component.text("Kicked").color(NamedTextColor.WHITE)));
Component.text("Kicked").color(NamedTextColor.WHITE))
);
} else {
preLoginEvent.setResult(PreLoginEvent.PreLoginComponentResult.denied(
LegacyComponentSerializer.legacyAmpersand().deserialize(message)));
LegacyComponentSerializer.legacyAmpersand().deserialize(message))
);
}
}