diff --git a/kencommandapi-bukkit/build.gradle.kts b/kencommandapi-bukkit/build.gradle.kts index 59ba338..722ada8 100644 --- a/kencommandapi-bukkit/build.gradle.kts +++ b/kencommandapi-bukkit/build.gradle.kts @@ -3,25 +3,44 @@ val scrowToken = providers.gradleProperty("scrowMavenToken") plugins { id("java") + id("java-library") id("maven-publish") id("io.freefair.lombok") version "9.2.0" } group = "de.kentoj" -version = "unspecified" +version = "1.0.0" + +fun scrowRepo(handler: RepositoryHandler) = handler.maven { + name = "scrow" + url = uri("http://forge.kentoj.de/api/packages/scrow/maven") + isAllowInsecureProtocol = true + + credentials(HttpHeaderCredentials::class) { + name = "Authorization" + value = "token $scrowToken" + } + + authentication { + create("header") + } +} repositories { mavenCentral() maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") { name = "spigotmc-repo" } + scrowRepo(this) } dependencies { - // https://mvnrepository.com/artifact/org.jetbrains/annotations +// https://mvnrepository.com/artifact/org.jetbrains/annotations implementation("org.jetbrains:annotations:26.0.2-1") - implementation(project(":kencommandapi-core")) + api("de.kentoj:kencommandapi-core:1.0.0") + + api("org.spigotmc:spigot-api:1.21.11-R0.1-SNAPSHOT") implementation("org.spigotmc:spigot-api:1.21.11-R0.1-SNAPSHOT") } @@ -35,19 +54,6 @@ publishing { } } repositories { - maven { - name = "scrow" - url = uri("http://forge.kentoj.de/api/packages/scrow/maven") - isAllowInsecureProtocol = true - - credentials(HttpHeaderCredentials::class) { - name = "Authorization" - value = "token $scrowToken" - } - - authentication { - create("header") - } - } + scrowRepo(this) } } diff --git a/kencommandapi-bukkit/src/main/java/de/kentoj/kencommandapi/type/PlayerArgumentType.java b/kencommandapi-bukkit/src/main/java/de/kentoj/kencommandapi/type/PlayerArgumentType.java new file mode 100644 index 0000000..68b5879 --- /dev/null +++ b/kencommandapi-bukkit/src/main/java/de/kentoj/kencommandapi/type/PlayerArgumentType.java @@ -0,0 +1,28 @@ +package de.kentoj.kencommandapi.type; + +import de.kentoj.kencommandapi.api.processing.CommandContext; +import de.kentoj.kencommandapi.api.structure.argument.ArgumentType; +import de.kentoj.kencommandapi.api.structure.argument.SuggestionProvider; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.bukkit.Bukkit; +import org.bukkit.entity.Player; + +import java.util.Set; + +// TODO +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public class PlayerArgumentType implements ArgumentType { + + @Override + public Player parseInput(String string) { + var player = Bukkit.getPlayer(string); + if (player == null) throw new RuntimeException("Player not online -- " + string); + return player; + } + + @Override + public SuggestionProvider defaultSuggestionProvider() { + return (SuggestionProvider) context -> Set.of(); + } +} diff --git a/kencommandapi-core/build.gradle.kts b/kencommandapi-core/build.gradle.kts index 2dc5d16..d267ea6 100644 --- a/kencommandapi-core/build.gradle.kts +++ b/kencommandapi-core/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "de.kentoj" -version = "1.0-SNAPSHOT" +version = "1.0.0" repositories { mavenCentral()