need to implement some argument types
This commit is contained in:
parent
c1385924fb
commit
d936a9246a
3 changed files with 52 additions and 18 deletions
|
|
@ -3,25 +3,44 @@ val scrowToken = providers.gradleProperty("scrowMavenToken")
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("java")
|
||||||
|
id("java-library")
|
||||||
id("maven-publish")
|
id("maven-publish")
|
||||||
id("io.freefair.lombok") version "9.2.0"
|
id("io.freefair.lombok") version "9.2.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "de.kentoj"
|
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<HttpHeaderAuthentication>("header")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") {
|
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") {
|
||||||
name = "spigotmc-repo"
|
name = "spigotmc-repo"
|
||||||
}
|
}
|
||||||
|
scrowRepo(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// https://mvnrepository.com/artifact/org.jetbrains/annotations
|
// https://mvnrepository.com/artifact/org.jetbrains/annotations
|
||||||
implementation("org.jetbrains:annotations:26.0.2-1")
|
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")
|
implementation("org.spigotmc:spigot-api:1.21.11-R0.1-SNAPSHOT")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,19 +54,6 @@ publishing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
scrowRepo(this)
|
||||||
name = "scrow"
|
|
||||||
url = uri("http://forge.kentoj.de/api/packages/scrow/maven")
|
|
||||||
isAllowInsecureProtocol = true
|
|
||||||
|
|
||||||
credentials(HttpHeaderCredentials::class) {
|
|
||||||
name = "Authorization"
|
|
||||||
value = "token $scrowToken"
|
|
||||||
}
|
|
||||||
|
|
||||||
authentication {
|
|
||||||
create<HttpHeaderAuthentication>("header")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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<Player> {
|
||||||
|
|
||||||
|
@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<CommandContext>) context -> Set.of();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -8,7 +8,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "de.kentoj"
|
group = "de.kentoj"
|
||||||
version = "1.0-SNAPSHOT"
|
version = "1.0.0"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue