From 159a6ed37c4993410632cc897f45221ab941daa3 Mon Sep 17 00:00:00 2001 From: games647 Date: Thu, 31 Aug 2023 11:55:39 +0200 Subject: [PATCH] Add JavaDoc snippets and tiny reformats --- .../fastlogin/bukkit/FastLoginBukkit.java | 16 ++++++++++++++++ .../fastlogin/core/hooks/PasswordGenerator.java | 9 +++++++++ .../shared/event/FastLoginAutoLoginEvent.java | 13 ++++++++++++- .../shared/event/FastLoginCancellableEvent.java | 1 + .../shared/event/FastLoginPreLoginEvent.java | 2 ++ .../event/FastLoginPremiumToggleEvent.java | 1 + pom.xml | 2 -- .../fastlogin/velocity/VelocityLoginSource.java | 6 ++++-- 8 files changed, 45 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java index 6b840b69..4102b05c 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java @@ -228,6 +228,22 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin platform dependent player class + */ @FunctionalInterface public interface PasswordGenerator

{ + /** + * Generate a password for a non-registered player + * @param player + * @return daw + */ String getRandomPassword(P player); } diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginAutoLoginEvent.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginAutoLoginEvent.java index 29f2724f..f066280c 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginAutoLoginEvent.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginAutoLoginEvent.java @@ -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(); } diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginCancellableEvent.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginCancellableEvent.java index 0cd23fc1..867eb533 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginCancellableEvent.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginCancellableEvent.java @@ -28,5 +28,6 @@ package com.github.games647.fastlogin.core.shared.event; public interface FastLoginCancellableEvent { boolean isCancelled(); + void setCancelled(boolean cancelled); } diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginPreLoginEvent.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginPreLoginEvent.java index 3180ad97..9f5eb8a8 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginPreLoginEvent.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginPreLoginEvent.java @@ -34,6 +34,8 @@ import com.github.games647.fastlogin.core.storage.StoredProfile; public interface FastLoginPreLoginEvent { String getUsername(); + LoginSource getSource(); + StoredProfile getProfile(); } diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginPremiumToggleEvent.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginPremiumToggleEvent.java index 8b6faed3..6881653e 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginPremiumToggleEvent.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/event/FastLoginPremiumToggleEvent.java @@ -33,6 +33,7 @@ import com.github.games647.fastlogin.core.storage.StoredProfile; public interface FastLoginPremiumToggleEvent { StoredProfile getProfile(); + PremiumToggleReason getReason(); enum PremiumToggleReason { diff --git a/pom.xml b/pom.xml index 7e0cdd1b..2f9ef0f8 100644 --- a/pom.xml +++ b/pom.xml @@ -51,8 +51,6 @@ 8 - ${java.version} - ${java.version} ${java.version} development-2.2.2-SNAPSHOT diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSource.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSource.java index 71df7df2..8825146b 100644 --- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSource.java +++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/VelocityLoginSource.java @@ -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)) + ); } }