From 9737d0a44942a93cef91e6fa55b85c701f0ffc09 Mon Sep 17 00:00:00 2001 From: Adrian3d04 Date: Sun, 14 Aug 2022 02:22:18 +0000 Subject: [PATCH] feat: Implement Javadocs tasks --- api/paper/build.gradle.kts | 25 +++++++++++- .../api/paper/event/PreSendLoginEvent.java | 12 ++++++ api/paper/src/main/java/module-info.java | 2 + api/velocity/build.gradle.kts | 38 ++++++++++++++++--- .../velocity/event/PreSendOnLoginEvent.java | 7 ++-- .../event/ProxyForcedUnregisterEvent.java | 13 +------ .../api/velocity/event/ProxyLoginEvent.java | 12 +----- .../api/velocity/event/ProxyLogoutEvent.java | 13 +------ .../velocity/event/ProxyRegisterEvent.java | 13 +------ .../velocity/event/ProxyUnregisterEvent.java | 13 +------ .../api/velocity/event/ServerResult.java | 11 ++++++ api/velocity/src/main/java/module-info.java | 2 + 12 files changed, 96 insertions(+), 65 deletions(-) diff --git a/api/paper/build.gradle.kts b/api/paper/build.gradle.kts index 6c6e1b1..d15f043 100644 --- a/api/paper/build.gradle.kts +++ b/api/paper/build.gradle.kts @@ -1,11 +1,34 @@ +plugins { + `maven-publish` +} + +java { + withSourcesJar() + withJavadocJar() + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) +} + dependencies { compileOnly("io.papermc.paper:paper-api:1.19.1-R0.1-SNAPSHOT") } tasks { compileJava { + options.encoding = Charsets.UTF_8.name() options.release.set(17) } + javadoc { + options.encoding = Charsets.UTF_8.name() + } } -java.toolchain.languageVersion.set(JavaLanguageVersion.of(17)) \ No newline at end of file +publishing { + publications { + create("maven") { + groupId = project.group as String + artifactId = project.name + version = project.version as String + from(components["java"]) + } + } +} diff --git a/api/paper/src/main/java/me/adrianed/authmevelocity/api/paper/event/PreSendLoginEvent.java b/api/paper/src/main/java/me/adrianed/authmevelocity/api/paper/event/PreSendLoginEvent.java index 431b96f..44a8a2a 100644 --- a/api/paper/src/main/java/me/adrianed/authmevelocity/api/paper/event/PreSendLoginEvent.java +++ b/api/paper/src/main/java/me/adrianed/authmevelocity/api/paper/event/PreSendLoginEvent.java @@ -7,10 +7,18 @@ import org.bukkit.event.HandlerList; import org.bukkit.event.player.PlayerEvent; import org.jetbrains.annotations.NotNull; +/** + * Event executed before a player is sent to another server after being logged in + *

Here you have the possibility to cancel the player's sending +*/ public class PreSendLoginEvent extends PlayerEvent implements Cancellable { private static final HandlerList HANDLERS = new HandlerList(); private boolean isCancelled = false; + /** + * Creates a new PreSendLoginEvent + * @param player the player to be sended + */ public PreSendLoginEvent(@NotNull Player player) { super(player, !Bukkit.isPrimaryThread()); } @@ -30,6 +38,10 @@ public class PreSendLoginEvent extends PlayerEvent implements Cancellable { return HANDLERS; } + /** + * Obtain the handlerlist of this event + * @return the handlerlist + */ public static HandlerList getHandlerList() { return HANDLERS; } diff --git a/api/paper/src/main/java/module-info.java b/api/paper/src/main/java/module-info.java index 64b7e65..3c01847 100644 --- a/api/paper/src/main/java/module-info.java +++ b/api/paper/src/main/java/module-info.java @@ -1,3 +1,5 @@ +/**AuthMeVelocity Paper API Module */ +@SuppressWarnings({"requires-automatic", "requires-transitive-automatic"}) module me.adrianed.authmevelocity.api.paper { requires static transitive org.bukkit; requires static org.jetbrains.annotations; diff --git a/api/velocity/build.gradle.kts b/api/velocity/build.gradle.kts index 4776056..1844d31 100644 --- a/api/velocity/build.gradle.kts +++ b/api/velocity/build.gradle.kts @@ -1,11 +1,39 @@ +plugins { + `maven-publish` +} + dependencies { compileOnly("com.velocitypowered:velocity-api:3.1.2-SNAPSHOT") } -tasks.compileJava { - options.encoding = Charsets.UTF_8.name() - - options.release.set(17) +java { + withSourcesJar() + withJavadocJar() + toolchain.languageVersion.set(JavaLanguageVersion.of(17)) } -java.toolchain.languageVersion.set(JavaLanguageVersion.of(17)) \ No newline at end of file +tasks { + compileJava { + options.encoding = Charsets.UTF_8.name() + + options.release.set(17) + } + javadoc { + options.encoding = Charsets.UTF_8.name() + (options as StandardJavadocDocletOptions).links( + "https://jd.adventure.kyori.net/api/4.10.0/", + "https://jd.adventure.kyori.net/text-minimessage/4.11.0/" + ) + } +} + +publishing { + publications { + create("maven") { + groupId = project.group as String + artifactId = project.name + version = project.version as String + from(components["java"]) + } + } +} \ No newline at end of file diff --git a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/PreSendOnLoginEvent.java b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/PreSendOnLoginEvent.java index 8bf6381..7c0c0b7 100644 --- a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/PreSendOnLoginEvent.java +++ b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/PreSendOnLoginEvent.java @@ -13,7 +13,6 @@ import org.jetbrains.annotations.NotNull; * Here you have the ability to deny the event. */ public final class PreSendOnLoginEvent implements ResultedEvent { - private ServerResult result; private final Player player; private final RegisteredServer actualserver; @@ -34,7 +33,7 @@ public final class PreSendOnLoginEvent implements ResultedEvent { * Obtain the logged player * @return the player */ - public @NotNull Player getPlayer(){ + public @NotNull Player player(){ return this.player; } @@ -42,7 +41,7 @@ public final class PreSendOnLoginEvent implements ResultedEvent { * Obtain the server on which the player is located * @return the actual server of the player */ - public @NotNull RegisteredServer getActualServer(){ + public @NotNull RegisteredServer actualServer(){ return this.actualserver; } @@ -56,7 +55,7 @@ public final class PreSendOnLoginEvent implements ResultedEvent { /** * Set the result of the event - * @param newresult the new result + * @param newResult the new result */ @Override public void setResult(@NotNull ServerResult newResult) { diff --git a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyForcedUnregisterEvent.java b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyForcedUnregisterEvent.java index 81301fb..2294e9f 100644 --- a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyForcedUnregisterEvent.java +++ b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyForcedUnregisterEvent.java @@ -4,14 +4,5 @@ import com.velocitypowered.api.proxy.Player; import org.jetbrains.annotations.Nullable; -public class ProxyForcedUnregisterEvent { - private final Player player; - - public ProxyForcedUnregisterEvent(@Nullable Player player){ - this.player = player; - } - - public @Nullable Player getPlayer(){ - return this.player; - } -} +/**Event executed in case a player is forced unregister by a server operator*/ +public record ProxyForcedUnregisterEvent(@Nullable Player player) {} diff --git a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyLoginEvent.java b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyLoginEvent.java index 6ed50ca..c107eae 100644 --- a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyLoginEvent.java +++ b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyLoginEvent.java @@ -7,14 +7,4 @@ import org.jetbrains.annotations.NotNull; /** * Event executed in case the player is successfully logged in */ -public final class ProxyLoginEvent { - private final Player player; - - public ProxyLoginEvent(@NotNull Player player){ - this.player = player; - } - - public @NotNull Player getPlayer(){ - return this.player; - } -} +public record ProxyLoginEvent(@NotNull Player player) {} diff --git a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyLogoutEvent.java b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyLogoutEvent.java index 7c4ff23..0c7a97e 100644 --- a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyLogoutEvent.java +++ b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyLogoutEvent.java @@ -4,14 +4,5 @@ import com.velocitypowered.api.proxy.Player; import org.jetbrains.annotations.NotNull; -public final class ProxyLogoutEvent { - private final Player player; - - public ProxyLogoutEvent(@NotNull Player player){ - this.player = player; - } - - public @NotNull Player getPlayer(){ - return this.player; - } -} +/**Event executed in case the player has logout from the network */ +public record ProxyLogoutEvent(@NotNull Player player) {} diff --git a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyRegisterEvent.java b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyRegisterEvent.java index 9d0899e..ae5d007 100644 --- a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyRegisterEvent.java +++ b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyRegisterEvent.java @@ -4,14 +4,5 @@ import com.velocitypowered.api.proxy.Player; import org.jetbrains.annotations.NotNull; -public final class ProxyRegisterEvent { - private final Player player; - - public ProxyRegisterEvent(@NotNull Player player){ - this.player = player; - } - - public @NotNull Player getPlayer(){ - return this.player; - } -} +/**Event executed in case the player has register itself*/ +public record ProxyRegisterEvent(@NotNull Player player) {} diff --git a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyUnregisterEvent.java b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyUnregisterEvent.java index 4510ac6..acbdab0 100644 --- a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyUnregisterEvent.java +++ b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ProxyUnregisterEvent.java @@ -4,14 +4,5 @@ import com.velocitypowered.api.proxy.Player; import org.jetbrains.annotations.NotNull; -public class ProxyUnregisterEvent { - private final Player player; - - public ProxyUnregisterEvent(@NotNull Player player){ - this.player = player; - } - - public @NotNull Player getPlayer(){ - return this.player; - } -} +/**Event executed in case the player has unregister itself*/ +public record ProxyUnregisterEvent(@NotNull Player player) {} diff --git a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ServerResult.java b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ServerResult.java index 7b4537b..b9f7d16 100644 --- a/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ServerResult.java +++ b/api/velocity/src/main/java/me/adrianed/authmevelocity/api/velocity/event/ServerResult.java @@ -3,6 +3,7 @@ package me.adrianed.authmevelocity.api.velocity.event; import com.velocitypowered.api.event.ResultedEvent.Result; import com.velocitypowered.api.proxy.server.RegisteredServer; +/**A result that produces a resulting server */ public record ServerResult(boolean result, RegisteredServer server) implements Result { private static final ServerResult DENIED = new ServerResult(false, null); @@ -11,10 +12,20 @@ public record ServerResult(boolean result, RegisteredServer server) implements R return result; } + /** + * Allowed ServerResult + * @param server the resulted server + * @return A ServerResult with allowed result and custom server result + */ public static final ServerResult allowed(RegisteredServer server) { return new ServerResult(true, server); } + /** + * Denied ServerResult + * + * @return A ServerResult with denied result and null server + */ public static final ServerResult denied() { return DENIED; } diff --git a/api/velocity/src/main/java/module-info.java b/api/velocity/src/main/java/module-info.java index a2a1150..864806e 100644 --- a/api/velocity/src/main/java/module-info.java +++ b/api/velocity/src/main/java/module-info.java @@ -1,3 +1,5 @@ +/**AuthMeVelocity Velocity API Module */ +@SuppressWarnings({"requires-automatic", "requires-transitive-automatic"}) module me.adrianed.authmevelocity.api.velocity { requires static transitive com.velocitypowered.api; requires static org.jetbrains.annotations;