will try smth
This commit is contained in:
parent
f5109f9789
commit
7bfbe48729
28 changed files with 150 additions and 111 deletions
6
.idea/gradle.xml
generated
6
.idea/gradle.xml
generated
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
|
|
@ -8,9 +9,14 @@
|
|||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/kencommandapi-bukkit" />
|
||||
<option value="$PROJECT_DIR$/kencommandapi-core" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/kencommandapi-core" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
plugins {
|
||||
id("java")
|
||||
id("io.freefair.lombok") version "9.2.0"
|
||||
}
|
||||
|
||||
group = "de.kentoj"
|
||||
version = "1.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
|
||||
// https://mvnrepository.com/artifact/org.jetbrains/annotations
|
||||
implementation("org.jetbrains:annotations:26.0.2-1")
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package de.kentoj.kencommandapi;
|
||||
|
||||
import de.kentoj.kencommandapi.api.KenCommandApi;
|
||||
|
||||
public class BukkitKenCommandApi extends KenCommandApiImpl<> {
|
||||
|
||||
private final KenCommandApi<>
|
||||
}
|
||||
47
kencommandapi-core/build.gradle.kts
Normal file
47
kencommandapi-core/build.gradle.kts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
val scrowToken = providers.gradleProperty("scrowMavenToken")
|
||||
.orElse(providers.environmentVariable("SCROW_MAVEN_TOKEN")).get()
|
||||
|
||||
plugins {
|
||||
id("java")
|
||||
id("maven-publish")
|
||||
id("io.freefair.lombok") version "9.2.0"
|
||||
}
|
||||
|
||||
group = "de.kentoj"
|
||||
version = "1.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// https://mvnrepository.com/artifact/org.jetbrains/annotations
|
||||
implementation("org.jetbrains:annotations:26.0.2-1")
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("KenCommandAPI") {
|
||||
groupId = project.group.toString()
|
||||
artifactId = project.name
|
||||
version = project.version.toString()
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
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<HttpHeaderAuthentication>("header")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package de.kencommand;
|
||||
package de.kentoj.kencommandapi;
|
||||
|
||||
import de.kencommand.api.KenCommandApi;
|
||||
import de.kencommand.api.structure.argument.types.IntegerArgumentType;
|
||||
import de.kencommand.impl.KenCommandApiImpl;
|
||||
import de.kentoj.kencommandapi.api.KenCommandApi;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.types.IntegerArgumentType;
|
||||
import de.kentoj.kencommandapi.impl.KenCommandApiImpl;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
|
|
@ -22,6 +22,6 @@ public class Main {
|
|||
|
||||
addNode.addArgument(api.createArgument("amount", IntegerArgumentType.create()));
|
||||
root.addLiteral(addNode);
|
||||
api.invoke(root, System.out, new String[] { "add", "100" });
|
||||
api.invoke(root, System.out, new String[]{"add", "100"});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package de.kentoj.kencommandapi.api;
|
||||
|
||||
import de.kentoj.kencommandapi.api.structure.argument.ArgumentType;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
|
||||
import de.kentoj.kencommandapi.api.structure.node.CommandNode;
|
||||
|
||||
public interface KenCommandApi<T> {
|
||||
|
||||
CommandNode<T> createNode(String... name);
|
||||
|
||||
<V> CommandArgument<T, V> createArgument(String id, ArgumentType<V> type);
|
||||
|
||||
void invoke(CommandNode<T> node, T sender, String[] args);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package de.kencommand.api.processing;
|
||||
package de.kentoj.kencommandapi.api.processing;
|
||||
|
||||
public interface CommandContext<T> {
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
package de.kentoj.kencommandapi.api.processing;
|
||||
|
||||
public interface CommandExecutor<S> {
|
||||
|
||||
void execute(CommandContext<T> ctx);
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package de.kentoj.kencommandapi.api.processing;
|
||||
|
||||
import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
|
||||
|
||||
public interface ParsedArgument<T, V> {
|
||||
|
||||
V getValue();
|
||||
|
||||
CommandArgument<T, V> getArgument();
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package de.kencommand.api.structure.argument;
|
||||
package de.kentoj.kencommandapi.api.structure.argument;
|
||||
|
||||
public interface ArgumentType<V> {
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package de.kencommand.api.structure.argument;
|
||||
package de.kentoj.kencommandapi.api.structure.argument;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package de.kencommand.api.structure.argument;
|
||||
package de.kentoj.kencommandapi.api.structure.argument;
|
||||
|
||||
import de.kencommand.api.processing.CommandContext;
|
||||
import de.kentoj.kencommandapi.api.processing.CommandContext;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package de.kencommand.api.structure.argument.suggestion;
|
||||
package de.kentoj.kencommandapi.api.structure.argument.suggestion;
|
||||
|
||||
import de.kencommand.api.processing.CommandContext;
|
||||
import de.kencommand.api.structure.argument.SuggestionProvider;
|
||||
import de.kentoj.kencommandapi.api.processing.CommandContext;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.SuggestionProvider;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package de.kencommand.api.structure.argument.types;
|
||||
package de.kentoj.kencommandapi.api.structure.argument.types;
|
||||
|
||||
import de.kencommand.api.structure.argument.ArgumentType;
|
||||
import de.kencommand.api.structure.argument.SuggestionProvider;
|
||||
import de.kencommand.api.structure.argument.suggestion.NoSuggestionProvider;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.ArgumentType;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.SuggestionProvider;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.suggestion.NoSuggestionProvider;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package de.kencommand.api.structure.node;
|
||||
package de.kentoj.kencommandapi.api.structure.node;
|
||||
|
||||
import de.kencommand.api.structure.argument.CommandArgument;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package de.kencommand.api.structure.node;
|
||||
package de.kentoj.kencommandapi.api.structure.node;
|
||||
|
||||
import de.kencommand.api.processing.CommandExecutor;
|
||||
import de.kentoj.kencommandapi.api.processing.CommandExecutor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package de.kencommand.api.structure.node;
|
||||
package de.kentoj.kencommandapi.api.structure.node;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
package de.kencommand.impl;
|
||||
package de.kentoj.kencommandapi.impl;
|
||||
|
||||
import de.kencommand.api.KenCommandApi;
|
||||
import de.kencommand.api.processing.ParsedArgument;
|
||||
import de.kencommand.api.structure.argument.ArgumentType;
|
||||
import de.kencommand.api.structure.argument.CommandArgument;
|
||||
import de.kencommand.api.structure.node.CommandNode;
|
||||
import de.kencommand.impl.processing.CommandContextImpl;
|
||||
import de.kencommand.impl.processing.ParsedArgumentImpl;
|
||||
import de.kencommand.impl.structure.argument.CommandArgumentImpl;
|
||||
import de.kencommand.impl.structure.node.CommandNodeImpl;
|
||||
import de.kentoj.kencommandapi.api.KenCommandApi;
|
||||
import de.kentoj.kencommandapi.api.processing.ParsedArgument;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.ArgumentType;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
|
||||
import de.kentoj.kencommandapi.api.structure.node.CommandNode;
|
||||
import de.kentoj.kencommandapi.impl.processing.CommandContextImpl;
|
||||
import de.kentoj.kencommandapi.impl.processing.ParsedArgumentImpl;
|
||||
import de.kentoj.kencommandapi.impl.structure.argument.CommandArgumentImpl;
|
||||
import de.kentoj.kencommandapi.impl.structure.node.CommandNodeImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package de.kencommand.impl.processing;
|
||||
package de.kentoj.kencommandapi.impl.processing;
|
||||
|
||||
import de.kencommand.api.processing.CommandContext;
|
||||
import de.kencommand.api.processing.ParsedArgument;
|
||||
import de.kentoj.kencommandapi.api.processing.CommandContext;
|
||||
import de.kentoj.kencommandapi.api.processing.ParsedArgument;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package de.kentoj.kencommandapi.impl.processing;
|
||||
|
||||
import de.kentoj.kencommandapi.api.processing.ParsedArgument;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ParsedArgumentImpl<T, V> implements ParsedArgument<T, V> {
|
||||
final V value;
|
||||
final CommandArgument<T, V> argument;
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package de.kencommand.impl.structure.argument;
|
||||
package de.kentoj.kencommandapi.impl.structure.argument;
|
||||
|
||||
import de.kencommand.api.structure.argument.ArgumentType;
|
||||
import de.kencommand.api.structure.argument.CommandArgument;
|
||||
import de.kencommand.api.structure.argument.SuggestionProvider;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.ArgumentType;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.SuggestionProvider;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
package de.kencommand.impl.structure.node;
|
||||
package de.kentoj.kencommandapi.impl.structure.node;
|
||||
|
||||
import de.kencommand.api.processing.CommandExecutor;
|
||||
import de.kencommand.api.structure.argument.CommandArgument;
|
||||
import de.kencommand.api.structure.node.CommandNode;
|
||||
import de.kencommand.api.structure.node.LiteralNode;
|
||||
import de.kentoj.kencommandapi.api.processing.CommandExecutor;
|
||||
import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
|
||||
import de.kentoj.kencommandapi.api.structure.node.CommandNode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
|
@ -1 +1,4 @@
|
|||
rootProject.name = "KenCommandAPI"
|
||||
|
||||
include("kencommandapi-core")
|
||||
include("kencommandapi-bukkit")
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
package de.kencommand.api;
|
||||
|
||||
import de.kencommand.api.structure.argument.ArgumentType;
|
||||
import de.kencommand.api.structure.argument.CommandArgument;
|
||||
import de.kencommand.api.structure.node.CommandNode;
|
||||
|
||||
public interface KenCommandApi<T> {
|
||||
|
||||
CommandNode<T> createNode(String... name);
|
||||
|
||||
<V> CommandArgument<T, V> createArgument(String id, ArgumentType<V> type);
|
||||
|
||||
void invoke(CommandNode<T> node, T sender, String[] args);
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
package de.kencommand.api.processing;
|
||||
|
||||
public interface CommandExecutor<T> {
|
||||
|
||||
void execute(CommandContext<T> ctx);
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
package de.kencommand.api.processing;
|
||||
|
||||
import de.kencommand.api.structure.argument.CommandArgument;
|
||||
|
||||
public interface ParsedArgument<T, V> {
|
||||
|
||||
V getValue();
|
||||
|
||||
CommandArgument<T, V> getArgument();
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
package de.kencommand.impl.processing;
|
||||
|
||||
import de.kencommand.api.processing.ParsedArgument;
|
||||
import de.kencommand.api.structure.argument.CommandArgument;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ParsedArgumentImpl<T, V> implements ParsedArgument<T, V> {
|
||||
final V value;
|
||||
final CommandArgument<T, V> argument;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue