feat: Implement Javadocs tasks

This commit is contained in:
Adrian3d04 2022-08-14 02:22:18 +00:00
parent 1e7ae82bb7
commit 9737d0a449
12 changed files with 96 additions and 65 deletions

View File

@ -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))
publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.group as String
artifactId = project.name
version = project.version as String
from(components["java"])
}
}
}

View File

@ -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
* <p>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;
}

View File

@ -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;

View File

@ -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))
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<MavenPublication>("maven") {
groupId = project.group as String
artifactId = project.name
version = project.version as String
from(components["java"])
}
}
}

View File

@ -13,7 +13,6 @@ import org.jetbrains.annotations.NotNull;
* Here you have the ability to deny the event.
*/
public final class PreSendOnLoginEvent implements ResultedEvent<ServerResult> {
private ServerResult result;
private final Player player;
private final RegisteredServer actualserver;
@ -34,7 +33,7 @@ public final class PreSendOnLoginEvent implements ResultedEvent<ServerResult> {
* 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<ServerResult> {
* 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<ServerResult> {
/**
* Set the result of the event
* @param newresult the new result
* @param newResult the new result
*/
@Override
public void setResult(@NotNull ServerResult newResult) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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;
}

View File

@ -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;