diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 26d3352..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
deleted file mode 100644
index 6f0ae42..0000000
--- a/.idea/gradle.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index ad43ab6..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
deleted file mode 100644
index 254a1fc..0000000
--- a/.idea/kotlinc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 5cd9a10..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core-bukkit-api/build.gradle.kts b/core-bukkit-api/build.gradle.kts
index d73d155..601d24e 100644
--- a/core-bukkit-api/build.gradle.kts
+++ b/core-bukkit-api/build.gradle.kts
@@ -12,16 +12,16 @@ repositories {
}
dependencies {
- //api("org.spigotmc:spigot-api:1.21.11-R0.1-SNAPSHOT")
+ api(project(":core-lib"))
- // Source: https://mvnrepository.com/artifact/io.nats/jnats
+ api("org.spigotmc:spigot-api:1.21.11-R0.1-SNAPSHOT")
+
+ // https://mvnrepository.com/artifact/io.nats/jnats
implementation("io.nats:jnats:2.25.2")
api("io.nats:jnats:2.25.2")
- api("de.kentoj.scrow:kencommandapi-core:0.4")
- api("de.kentoj.scrow:kencommandapi-bukkit:0.4")
-
- api(project(":core-lib"))
+ api("de.kentoj.scrow:kencommandapi-core:0.8")
+ api("de.kentoj.scrow:kencommandapi-bukkit:0.8")
}
publishing {
diff --git a/core-bukkit-api/src/main/java/de/kentoj/scrow/bukkit/ScrowAPI.java b/core-bukkit-api/src/main/java/de/kentoj/scrow/bukkit/ScrowAPI.java
index fa9a113..c794f68 100644
--- a/core-bukkit-api/src/main/java/de/kentoj/scrow/bukkit/ScrowAPI.java
+++ b/core-bukkit-api/src/main/java/de/kentoj/scrow/bukkit/ScrowAPI.java
@@ -19,7 +19,7 @@ public class ScrowAPI {
@Getter
private static @Nullable MongoDatabase database;
@Getter
- private static BukkitKenCommandApi commandManager;
+ private static BukkitKenCommandApi commandApi;
@Getter
private static Scheduler minecraftScheduler;
@Getter
@@ -44,8 +44,8 @@ public class ScrowAPI {
}
@ApiStatus.Internal
- public static void setCommandManager(BukkitKenCommandApi commandManager) {
- ScrowAPI.commandManager = commandManager;
+ public static void setCommandApi(BukkitKenCommandApi commandApi) {
+ ScrowAPI.commandApi = commandApi;
}
@ApiStatus.Internal
diff --git a/core-bukkit-impl/build.gradle.kts b/core-bukkit-impl/build.gradle.kts
index 6b57f8d..8b8fdee 100644
--- a/core-bukkit-impl/build.gradle.kts
+++ b/core-bukkit-impl/build.gradle.kts
@@ -3,7 +3,6 @@ plugins {
id("java")
id("com.gradleup.shadow") version "9.2.0"
id("xyz.jpenilla.run-paper") version "2.3.1"
- kotlin("jvm")
}
group = "de.kentoj.scrow"
@@ -14,21 +13,16 @@ repositories {
}
dependencies {
- testImplementation(platform("org.junit:junit-bom:5.10.0"))
- testImplementation("org.junit.jupiter:junit-jupiter")
- testRuntimeOnly("org.junit.platform:junit-platform-launcher")
-
- implementation(kotlin("stdlib-jdk8"))
implementation(project(":core-bukkit-api"))
- implementation("org.spigotmc:spigot-api:1.21.11-R0.1-SNAPSHOT")
- implementation("de.kentoj.scrow:kencommandapi-bukkit:0.4")
- implementation(project(":core-lib"))
+ implementation(kotlin("stdlib-jdk8"))
+
+ //implementation("org.spigotmc:spigot-api:1.21.11-R0.1-SNAPSHOT")
+ //implementation("de.kentoj.scrow:kencommandapi-bukkit:0.8")
}
tasks {
runServer {
-
minecraftVersion("1.21.11")
downloadPlugins {
url("https://hangarcdn.papermc.io/plugins/ViaVersion/ViaVersion/versions/5.7.1/PAPER/ViaVersion-5.7.1.jar")
@@ -40,10 +34,3 @@ tasks {
tasks.build {
dependsOn("shadowJar")
}
-
-tasks.test {
- useJUnitPlatform()
-}
-kotlin {
- jvmToolchain(21)
-}
\ No newline at end of file
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/CoreImplPlugin.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/CoreImplPlugin.java
index 56541b0..689770b 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/CoreImplPlugin.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/CoreImplPlugin.java
@@ -17,11 +17,11 @@ public class CoreImplPlugin extends JavaPlugin {
ScrowAPISurface.initScrowAPI(this, ENABLE_DATABASE);
{
- ScrowAPI.getCommandManager().register(new FriendCommand().getRootNode());
- ScrowAPI.getCommandManager().register(new CoinsCommand().getRootNode());
- ScrowAPI.getCommandManager().register(new CrownCommand().getRootNode());
- ScrowAPI.getCommandManager().register(new PlayCommand().getRootNode());
- ScrowAPI.getCommandManager().register(new LobbyCommand().getRootNode());
+ ScrowAPI.getCommandApi().register(new FriendCommand().getRootNode());
+ ScrowAPI.getCommandApi().register(new CoinsCommand().getRootNode());
+ ScrowAPI.getCommandApi().register(new CrownCommand().getRootNode());
+ ScrowAPI.getCommandApi().register(new PlayCommand().getRootNode());
+ ScrowAPI.getCommandApi().register(new LobbyCommand().getRootNode());
}
registerServer();
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/ScrowAPISurface.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/ScrowAPISurface.java
index 432c465..6771c0b 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/ScrowAPISurface.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/ScrowAPISurface.java
@@ -26,7 +26,7 @@ import reactor.core.scheduler.Schedulers;
import java.io.IOException;
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
+@NoArgsConstructor(access = AccessLevel.NONE)
public class ScrowAPISurface {
private static @Nullable MongoClient mongoClient;
@@ -75,7 +75,7 @@ public class ScrowAPISurface {
ScrowAPI.setFriendshipService(ScrowAPI.getDatabase() != null ?
new MongoFriendshipService(ScrowAPI.getDatabase()) : new InMemoryFriendshipService());
- ScrowAPI.setCommandManager(new BukkitKenCommandApi());
+ ScrowAPI.setCommandApi(new BukkitKenCommandApi());
}
public static void destroyScrowAPI() {
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownCommand.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownCommand.java
index d42ec71..d958c35 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownCommand.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownCommand.java
@@ -1,7 +1,7 @@
package de.kentoj.scrow.bukkit.crown;
import de.kentoj.kencommandapi.BukkitCommandContext;
-import de.kentoj.kencommandapi.api.structure.node.CommandNode;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
import de.kentoj.scrow.bukkit.ScrowAPI;
import lombok.Getter;
import org.bukkit.command.CommandSender;
@@ -12,9 +12,9 @@ public class CrownCommand {
private final CommandNode rootNode;
public CrownCommand() {
- this.rootNode = ScrowAPI.getCommandManager().createNode("crown", "server-manager");
- this.rootNode.addLiteral(new CrownListServersLiteral().getNode());
- this.rootNode.addLiteral(new CrownDeployServerLiteral().getNode());
- this.rootNode.addLiteral(new CrownDestroyServerLiteral().getNode());
+ this.rootNode = ScrowAPI.getCommandApi().createNode("crown", "server-manager");
+ this.rootNode.addLiteral(new CrownListServersLiteral().getRootNode());
+ this.rootNode.addLiteral(new CrownDeployServerLiteral().getRootNode());
+ this.rootNode.addLiteral(new CrownDestroyServerLiteral().getRootNode());
}
}
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownDeployServerLiteral.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownDeployServerLiteral.java
index 60e3d15..7c3fcb5 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownDeployServerLiteral.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownDeployServerLiteral.java
@@ -1,10 +1,10 @@
package de.kentoj.scrow.bukkit.crown;
import de.kentoj.kencommandapi.BukkitCommandContext;
+import de.kentoj.kencommandapi.api.argument.CommandArgument;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
import de.kentoj.kencommandapi.api.processing.CommandExecutor;
-import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
-import de.kentoj.kencommandapi.api.structure.argument.types.StringArgumentType;
-import de.kentoj.kencommandapi.api.structure.node.CommandNode;
+import de.kentoj.kencommandapi.api.types.StringArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI;
import lombok.Getter;
import org.bukkit.command.CommandSender;
@@ -12,15 +12,15 @@ import org.bukkit.command.CommandSender;
public class CrownDeployServerLiteral implements CommandExecutor {
@Getter
- private final CommandNode node;
+ private final CommandNode rootNode;
private final CommandArgument templateArg;
public CrownDeployServerLiteral() {
- this.node = ScrowAPI.getCommandManager().createNode("deploy-server");
- this.node.setExecutor(this);
+ this.rootNode = ScrowAPI.getCommandApi().createNode("deploy-server");
+ this.rootNode.setExecutor(this);
{
- this.templateArg = ScrowAPI.getCommandManager().createArgument("template", new StringArgumentType<>());
- this.node.addArgument(templateArg);
+ this.templateArg = ScrowAPI.getCommandApi().createArgument("template", new StringArgumentType<>());
+ this.rootNode.addArgument(templateArg);
}
}
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownDestroyServerLiteral.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownDestroyServerLiteral.java
index f14c9a0..f3f520d 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownDestroyServerLiteral.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/crown/CrownDestroyServerLiteral.java
@@ -1,10 +1,10 @@
package de.kentoj.scrow.bukkit.crown;
import de.kentoj.kencommandapi.BukkitCommandContext;
+import de.kentoj.kencommandapi.api.argument.CommandArgument;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
import de.kentoj.kencommandapi.api.processing.CommandExecutor;
-import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
-import de.kentoj.kencommandapi.api.structure.argument.types.StringArgumentType;
-import de.kentoj.kencommandapi.api.structure.node.CommandNode;
+import de.kentoj.kencommandapi.api.types.StringArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrowlib.servermanager.ServerInstance;
import lombok.Getter;
@@ -15,14 +15,14 @@ import java.util.stream.Collectors;
public class CrownDestroyServerLiteral implements CommandExecutor {
@Getter
- private final CommandNode node;
+ private final CommandNode rootNode;
private final CommandArgument handleArg;
public CrownDestroyServerLiteral() {
- this.node = ScrowAPI.getCommandManager().createNode("destroy-server");
- this.node.setExecutor(this);
+ this.rootNode = ScrowAPI.getCommandApi().createNode("destroy-server");
+ this.rootNode.setExecutor(this);
{
- this.handleArg = ScrowAPI.getCommandManager().createArgument("template", new StringArgumentType<>());
+ this.handleArg = ScrowAPI.getCommandApi().createArgument("template", new StringArgumentType<>());
this.handleArg.setSuggestionProvider(ctx -> {
//noinspection CodeBlock2Expr
return ScrowAPI.getServerManager().getRunningServers()
@@ -30,7 +30,7 @@ public class CrownDestroyServerLiteral implements CommandExecutor {
@Getter
- private final CommandNode node;
+ private final CommandNode rootNode;
public CrownListServersLiteral() {
- this.node = ScrowAPI.getCommandManager().createNode("list-servers");
- this.node.setExecutor(this);
+ this.rootNode = ScrowAPI.getCommandApi().createNode("list-servers");
+ this.rootNode.setExecutor(this);
}
@Override
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/economy/CoinsCommand.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/economy/CoinsCommand.java
index b04f0f3..83e5520 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/economy/CoinsCommand.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/economy/CoinsCommand.java
@@ -1,10 +1,9 @@
package de.kentoj.scrow.bukkit.economy;
import de.kentoj.kencommandapi.BukkitCommandContext;
-import de.kentoj.kencommandapi.api.processing.CommandContext;
-import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
-import de.kentoj.kencommandapi.api.structure.argument.types.IntegerArgumentType;
-import de.kentoj.kencommandapi.api.structure.node.CommandNode;
+import de.kentoj.kencommandapi.api.argument.CommandArgument;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
+import de.kentoj.kencommandapi.api.types.IntegerArgumentType;
import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI;
import lombok.Getter;
@@ -23,19 +22,19 @@ public class CoinsCommand {
private final CommandArgument amountArg;
public CoinsCommand() {
- this.rootNode = ScrowAPI.getCommandManager().createNode("coins", "eco");
- this.playerArg = ScrowAPI.getCommandManager().createArgument("player", OfflinePlayerArgumentType.getInstance());
- this.amountArg = ScrowAPI.getCommandManager().createArgument("amount", new IntegerArgumentType<>());
+ this.rootNode = ScrowAPI.getCommandApi().createNode("coins", "eco");
+ this.playerArg = ScrowAPI.getCommandApi().createArgument("player", OfflinePlayerArgumentType.getInstance());
+ this.amountArg = ScrowAPI.getCommandApi().createArgument("amount", new IntegerArgumentType<>());
{
- var setLiteral = ScrowAPI.getCommandManager().createNode("set");
+ var setLiteral = ScrowAPI.getCommandApi().createNode("set");
rootNode.addLiteral(setLiteral);
setLiteral.addArgument(playerArg);
setLiteral.addArgument(amountArg);
setLiteral.setExecutor(this::setCoins);
}
{
- var getLiteral = ScrowAPI.getCommandManager().createNode("get");
+ var getLiteral = ScrowAPI.getCommandApi().createNode("get");
rootNode.addLiteral(getLiteral);
getLiteral.addArgument(playerArg);
getLiteral.setExecutor(this::getCoins);
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendAddLiteral.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendAddLiteral.java
index 408b8c7..3afa2ac 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendAddLiteral.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendAddLiteral.java
@@ -1,27 +1,34 @@
package de.kentoj.scrow.bukkit.friends.command;
import de.kentoj.kencommandapi.BukkitCommandContext;
-import de.kentoj.kencommandapi.api.structure.node.CommandNode;
+import de.kentoj.kencommandapi.api.argument.CommandArgument;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
+import de.kentoj.kencommandapi.api.processing.CommandExecutor;
import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.friends.handler.FriendAddHandler;
import lombok.Getter;
+import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
-public class FriendAddLiteral {
+public class FriendAddLiteral implements CommandExecutor {
@Getter
- private final CommandNode node;
+ private final CommandNode rootNode;
+ private final CommandArgument playerArg;
public FriendAddLiteral() {
- var cmdManager = ScrowAPI.getCommandManager();
- var playerArg = cmdManager.createArgument("player", OfflinePlayerArgumentType.getInstance());
+ var cmds = ScrowAPI.getCommandApi();
- this.node = cmdManager.createNode("add");
- this.node.addArgument(playerArg);
- this.node.setExecutor(ctx -> {
- var handler = new FriendAddHandler(ctx.getPlayerSender(), ctx.getArg(playerArg));
- handler.handle();
- });
+ this.playerArg = cmds.createArgument("player", OfflinePlayerArgumentType.getInstance());
+ this.rootNode = cmds.createNode("add");
+ this.rootNode.addArgument(playerArg);
+ this.rootNode.setExecutor(this);
+ }
+
+ @Override
+ public void execute(BukkitCommandContext ctx) {
+ var handler = new FriendAddHandler(ctx.getPlayerSender(), ctx.getArg(playerArg));
+ handler.handle();
}
}
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendCommand.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendCommand.java
index 82b2439..d92378b 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendCommand.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendCommand.java
@@ -1,7 +1,7 @@
package de.kentoj.scrow.bukkit.friends.command;
import de.kentoj.kencommandapi.BukkitCommandContext;
-import de.kentoj.kencommandapi.api.structure.node.CommandNode;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
import de.kentoj.scrow.bukkit.ScrowAPI;
import lombok.Getter;
import org.bukkit.command.CommandSender;
@@ -12,10 +12,10 @@ public class FriendCommand {
private final CommandNode rootNode;
public FriendCommand() {
- this.rootNode = ScrowAPI.getCommandManager().createNode("friends", "f", "friend");
- rootNode.addLiteral(new FriendListLiteral().getNode());
- rootNode.addLiteral(new FriendAddLiteral().getNode());
- rootNode.addLiteral(new FriendRemoveLiteral().getNode());
- rootNode.addLiteral(new FriendRequestsLiteral().getNode());
+ this.rootNode = ScrowAPI.getCommandApi().createNode("friends", "f", "friend");
+ rootNode.addLiteral(new FriendListLiteral().getRootNode());
+ rootNode.addLiteral(new FriendAddLiteral().getRootNode());
+ rootNode.addLiteral(new FriendRemoveLiteral().getRootNode());
+ rootNode.addLiteral(new FriendRequestsLiteral().getRootNode());
}
}
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendListLiteral.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendListLiteral.java
index 591f75e..e487dc8 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendListLiteral.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendListLiteral.java
@@ -1,23 +1,21 @@
package de.kentoj.scrow.bukkit.friends.command;
import de.kentoj.kencommandapi.BukkitCommandContext;
-import de.kentoj.kencommandapi.api.structure.node.CommandNode;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
import de.kentoj.scrow.bukkit.ScrowAPI;
-import de.kentoj.scrow.bukkit.friends.FriendshipService;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
-import reactor.core.scheduler.Schedulers;
public class FriendListLiteral {
@Getter
- private final CommandNode node;
+ private final CommandNode rootNode;
public FriendListLiteral() {
- this.node = ScrowAPI.getCommandManager().createNode("list");
- node.setExecutor(this::friendList);
+ this.rootNode = ScrowAPI.getCommandApi().createNode("list");
+ rootNode.setExecutor(this::friendList);
}
private void friendList(BukkitCommandContext ctx) {
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendRemoveLiteral.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendRemoveLiteral.java
index 0838c3b..dad9e52 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendRemoveLiteral.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendRemoveLiteral.java
@@ -1,26 +1,25 @@
package de.kentoj.scrow.bukkit.friends.command;
import de.kentoj.kencommandapi.BukkitCommandContext;
-import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
-import de.kentoj.kencommandapi.api.structure.node.CommandNode;
+import de.kentoj.kencommandapi.api.argument.CommandArgument;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI;
import lombok.Getter;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandException;
import org.bukkit.command.CommandSender;
-import reactor.core.publisher.Mono;
public class FriendRemoveLiteral {
@Getter
- private final CommandNode node;
+ private final CommandNode rootNode;
private final CommandArgument playerArg;
public FriendRemoveLiteral() {
- this.node = ScrowAPI.getCommandManager().createNode("remove");
- this.playerArg = ScrowAPI.getCommandManager().createArgument("player", OfflinePlayerArgumentType.getInstance());
- this.node.addArgument(playerArg);
- this.node.setExecutor(this::removeFriend);
+ this.playerArg = ScrowAPI.getCommandApi().createArgument("player", OfflinePlayerArgumentType.getInstance());
+ this.rootNode = ScrowAPI.getCommandApi().createNode("remove");
+ this.rootNode.addArgument(playerArg);
+ this.rootNode.setExecutor(this::removeFriend);
}
private void removeFriend(BukkitCommandContext ctx) {
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendRequestsLiteral.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendRequestsLiteral.java
index 005ac1b..9d2efe2 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendRequestsLiteral.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/command/FriendRequestsLiteral.java
@@ -1,7 +1,7 @@
package de.kentoj.scrow.bukkit.friends.command;
import de.kentoj.kencommandapi.BukkitCommandContext;
-import de.kentoj.kencommandapi.api.structure.node.CommandNode;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
import de.kentoj.scrow.bukkit.ScrowAPI;
import lombok.Getter;
import org.bukkit.Bukkit;
@@ -10,11 +10,11 @@ import org.bukkit.command.CommandSender;
public class FriendRequestsLiteral {
@Getter
- private final CommandNode node;
+ private final CommandNode rootNode;
public FriendRequestsLiteral() {
- this.node = ScrowAPI.getCommandManager().createNode("requests", "list-requests");
- node.setExecutor(this::friendRequestsList);
+ this.rootNode = ScrowAPI.getCommandApi().createNode("requests", "list-requests");
+ rootNode.setExecutor(this::friendRequestsList);
}
private void friendRequestsList(BukkitCommandContext ctx) {
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/handler/FriendAddHandler.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/handler/FriendAddHandler.java
index 0f965e5..ecfcbe1 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/handler/FriendAddHandler.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/friends/handler/FriendAddHandler.java
@@ -22,7 +22,7 @@ public class FriendAddHandler {
findAction()
.flatMap(this::executeAction)
.doOnError(CommandException.class, e -> {
- ScrowAPI.getCommandManager().sendErrorMessage(self, e);
+ ScrowAPI.getCommandApi().sendErrorMessage(self, e);
})
.onErrorComplete(CommandException.class)
.subscribe();
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/server/LobbyCommand.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/server/LobbyCommand.java
index c8ef0f3..4ddbac2 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/server/LobbyCommand.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/server/LobbyCommand.java
@@ -1,8 +1,8 @@
package de.kentoj.scrow.bukkit.server;
import de.kentoj.kencommandapi.BukkitCommandContext;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
import de.kentoj.kencommandapi.api.processing.CommandExecutor;
-import de.kentoj.kencommandapi.api.structure.node.CommandNode;
import de.kentoj.scrow.bukkit.ScrowAPI;
import lombok.Getter;
import org.bukkit.Bukkit;
@@ -14,7 +14,7 @@ public class LobbyCommand implements CommandExecutor rootNode;
public LobbyCommand() {
- var cmds = ScrowAPI.getCommandManager();
+ var cmds = ScrowAPI.getCommandApi();
this.rootNode = cmds.createNode("lobby", "l", "hub");
this.rootNode.setExecutor(this);
}
diff --git a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/server/PlayCommand.java b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/server/PlayCommand.java
index b28fda6..87f4171 100644
--- a/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/server/PlayCommand.java
+++ b/core-bukkit-impl/src/main/java/de/kentoj/scrow/bukkit/server/PlayCommand.java
@@ -1,10 +1,10 @@
package de.kentoj.scrow.bukkit.server;
import de.kentoj.kencommandapi.BukkitCommandContext;
+import de.kentoj.kencommandapi.api.argument.CommandArgument;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
import de.kentoj.kencommandapi.api.processing.CommandExecutor;
-import de.kentoj.kencommandapi.api.structure.argument.CommandArgument;
-import de.kentoj.kencommandapi.api.structure.argument.types.StringArgumentType;
-import de.kentoj.kencommandapi.api.structure.node.CommandNode;
+import de.kentoj.kencommandapi.api.types.StringArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrowlib.servermanager.ServerInstance;
import lombok.Getter;
@@ -18,8 +18,8 @@ public class PlayCommand implements CommandExecutor gamemodeArg;
public PlayCommand() {
- this.rootNode = ScrowAPI.getCommandManager().createNode("play", "queue");
- this.gamemodeArg = ScrowAPI.getCommandManager().createArgument("gamemode", new StringArgumentType<>());
+ this.rootNode = ScrowAPI.getCommandApi().createNode("play", "queue");
+ this.gamemodeArg = ScrowAPI.getCommandApi().createArgument("gamemode", new StringArgumentType<>());
this.rootNode.addArgument(this.gamemodeArg);
this.rootNode.setExecutor(this);
}
diff --git a/core-velocity-api/src/main/java/de/kentoj/scrow/velocity/ScrowAPI.java b/core-velocity-api/src/main/java/de/kentoj/scrow/velocity/ScrowAPI.java
new file mode 100644
index 0000000..2d1e666
--- /dev/null
+++ b/core-velocity-api/src/main/java/de/kentoj/scrow/velocity/ScrowAPI.java
@@ -0,0 +1,45 @@
+package de.kentoj.scrow.velocity;
+
+import com.mongodb.reactivestreams.client.MongoDatabase;
+import de.kentoj.kencommandapi.VelocityKenCommandApi;
+import de.kentoj.scrowlib.servermanager.ServerManager;
+import io.nats.client.Connection;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Nullable;
+
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class ScrowAPI {
+
+ @Getter
+ private static @Nullable MongoDatabase database;
+ @Getter
+ private static VelocityKenCommandApi commandApi;
+ @Getter
+ private static Connection nats;
+ @Getter
+ private static ServerManager serverManager;
+
+ @ApiStatus.Internal
+ public static void setDatabase(@Nullable MongoDatabase database) {
+ ScrowAPI.database = database;
+ }
+
+ @ApiStatus.Internal
+ public static void setCommandApi(VelocityKenCommandApi commandApi) {
+ ScrowAPI.commandApi = commandApi;
+ }
+
+ @ApiStatus.Internal
+ public static void setNats(Connection nats) {
+ ScrowAPI.nats = nats;
+ }
+
+ @ApiStatus.Internal
+ public static void setServerManager(ServerManager serverManager) {
+ ScrowAPI.serverManager = serverManager;
+ }
+}
+
diff --git a/core-velocity-impl/build.gradle.kts b/core-velocity-impl/build.gradle.kts
index 31ddb44..e255c74 100644
--- a/core-velocity-impl/build.gradle.kts
+++ b/core-velocity-impl/build.gradle.kts
@@ -15,15 +15,14 @@ repositories {
}
dependencies {
+ implementation(project(":core-velocity-api"))
+
// https://docs.papermc.io/velocity/dev/creating-your-first-plugin/
annotationProcessor("com.velocitypowered:velocity-api:3.5.0-SNAPSHOT")
- compileOnly("com.velocitypowered:velocity-api:3.5.0-SNAPSHOT")
// https://mvnrepository.com/artifact/com.github.ben-manes.caffeine/caffeine
implementation("com.github.ben-manes.caffeine:caffeine:3.2.4")
// http://forge.kentoj.de/scrow/-/packages/maven/de.kentoj.scrow:kencommandapi-velocity
implementation("de.kentoj.scrow:kencommandapi-velocity")
-
- implementation(project(":core-lib"))
}
\ No newline at end of file
diff --git a/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/CoreVelocity.java b/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/CoreVelocity.java
deleted file mode 100644
index 7ca61ba..0000000
--- a/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/CoreVelocity.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package de.kentoj.scrow.corevelocity;
-
-import com.google.inject.Inject;
-import com.velocitypowered.api.command.CommandManager;
-import com.velocitypowered.api.plugin.Plugin;
-import com.velocitypowered.api.proxy.ProxyServer;
-import de.kentoj.scrow.corevelocity.command.OnlineCommand;
-import de.kentoj.scrow.corevelocity.privmsg.LastTargetCache;
-import de.kentoj.scrow.corevelocity.privmsg.MsgCommand;
-import de.kentoj.scrow.corevelocity.privmsg.ReplyCommand;
-import de.kentoj.scrowlib.servermanager.ServerManager;
-import de.kentoj.scrowlib.servermanager.ServerManagerImpl;
-import io.nats.client.Connection;
-import io.nats.client.Nats;
-import io.nats.client.Options;
-import lombok.extern.java.Log;
-
-import java.io.IOException;
-
-@Plugin(
- id = "corevelocity",
- name = "CoreVelocity",
- version = "0.1"
-)
-@Log
-public class CoreVelocity {
-
- private final ProxyServer server;
- private final Connection nats;
- private final ServerManager serverManager;
- private final ServerRegisterWatchdog registerWatchdog;
- private final SendPlayerWatchdog sendPlayerWatchdog;
-
- @Inject
- public CoreVelocity(ProxyServer server) {
- this.server = server;
- var cmds = server.getCommandManager();
- {
- cmds.register(OnlineCommand.commandMeta(cmds), new OnlineCommand(server));
- }
- {
- var lastTargetCache = new LastTargetCache();
- cmds.register(MsgCommand.commandMeta(cmds), new MsgCommand(lastTargetCache, server));
- cmds.register(ReplyCommand.commandMeta(cmds), new ReplyCommand(lastTargetCache, server));
- }
-
- try {
- var natsHost = System.getenv("HOST_NATS");
- nats = Nats.connect(Options.builder()
- .pedantic()
- .server(natsHost)
- .build());
- serverManager = new ServerManagerImpl(nats);
- registerWatchdog = new ServerRegisterWatchdog(nats, serverManager, server);
- sendPlayerWatchdog = new SendPlayerWatchdog(nats, server);
-
- log.info("listening on " + natsHost + " for server registrations");
- registerWatchdog.listen();
- sendPlayerWatchdog.listen();
- } catch (IOException | InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
-}
\ No newline at end of file
diff --git a/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/CoreVelocityPlugin.java b/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/CoreVelocityPlugin.java
new file mode 100644
index 0000000..7fd20c7
--- /dev/null
+++ b/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/CoreVelocityPlugin.java
@@ -0,0 +1,36 @@
+package de.kentoj.scrow.corevelocity;
+
+import com.google.inject.Inject;
+import com.velocitypowered.api.plugin.Plugin;
+import com.velocitypowered.api.proxy.ProxyServer;
+import de.kentoj.scrow.corevelocity.privmsg.LastTargetCache;
+import de.kentoj.scrow.corevelocity.privmsg.MsgCommand;
+import de.kentoj.scrow.corevelocity.privmsg.ReplyCommand;
+import de.kentoj.scrow.velocity.ScrowAPI;
+import lombok.extern.java.Log;
+
+@Plugin(
+ id = "corevelocity",
+ name = "CoreVelocity",
+ version = "0.1"
+)
+@Log
+public class CoreVelocityPlugin {
+
+ @Inject
+ public CoreVelocityPlugin(ProxyServer server) {
+ ScrowAPISurface.initScrowAPI(server, true);
+
+ var cmds = ScrowAPI.getCommandApi();
+ {
+ var lastTargetCache = new LastTargetCache();
+ cmds.register(new ReplyCommand(server, lastTargetCache).getRootNode());
+ cmds.register(new MsgCommand(server, lastTargetCache).getRootNode());
+ }
+
+ var registerWatchdog = new ServerRegisterWatchdog(ScrowAPI.getNats(), ScrowAPI.getServerManager(), server);
+ var sendPlayerWatchdog = new SendPlayerWatchdog(ScrowAPI.getNats(), server);
+ registerWatchdog.listen();
+ sendPlayerWatchdog.listen();
+ }
+}
\ No newline at end of file
diff --git a/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/ScrowAPISurface.java b/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/ScrowAPISurface.java
new file mode 100644
index 0000000..38e7fa0
--- /dev/null
+++ b/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/ScrowAPISurface.java
@@ -0,0 +1,66 @@
+package de.kentoj.scrow.corevelocity;
+
+import com.mongodb.ConnectionString;
+import com.mongodb.MongoClientSettings;
+import com.mongodb.reactivestreams.client.MongoClient;
+import com.mongodb.reactivestreams.client.MongoClients;
+import com.velocitypowered.api.proxy.ProxyServer;
+import de.kentoj.kencommandapi.VelocityKenCommandApi;
+import de.kentoj.scrow.velocity.ScrowAPI;
+import de.kentoj.scrowlib.servermanager.ServerManagerImpl;
+import io.nats.client.Nats;
+import io.nats.client.Options;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.bson.UuidRepresentation;
+import org.bson.codecs.configuration.CodecRegistries;
+import org.bson.codecs.pojo.PojoCodecProvider;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.IOException;
+
+@NoArgsConstructor(access = AccessLevel.NONE)
+public class ScrowAPISurface {
+
+ private static @Nullable MongoClient mongoClient;
+
+ public static void initScrowAPI(ProxyServer server, boolean enableDatabase) {
+ try {
+ String natsHost = System.getenv("HOST_NATS");
+ var options = Options.builder()
+ .server(natsHost)
+ .pedantic()
+ .build();
+ ScrowAPI.setNats(Nats.connect(options));
+ } catch (IOException | InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+
+ if (enableDatabase) {
+ var pojoCodecProvider = PojoCodecProvider.builder().automatic(true).build();
+ var codecRegistry = CodecRegistries.fromRegistries(
+ MongoClientSettings.getDefaultCodecRegistry(),
+ CodecRegistries.fromProviders(pojoCodecProvider)
+ );
+ String mongoHost = System.getenv("HOST_MONGO");
+ var settings = MongoClientSettings.builder()
+ .codecRegistry(codecRegistry)
+ .uuidRepresentation(UuidRepresentation.STANDARD)
+ .applyConnectionString(new ConnectionString(mongoHost))
+ .build();
+
+ mongoClient = MongoClients.create(settings);
+ ScrowAPI.setDatabase(mongoClient.getDatabase("scrow"));
+ }
+
+ ScrowAPI.setServerManager(new ServerManagerImpl(ScrowAPI.getNats()));
+
+ ScrowAPI.setCommandApi(new VelocityKenCommandApi(server));
+ }
+
+ public static void destroyScrowAPI() {
+ if (mongoClient != null) {
+ mongoClient.close();
+ }
+ }
+}
diff --git a/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/privmsg/MsgCommand.java b/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/privmsg/MsgCommand.java
index b1158d6..0e715c0 100644
--- a/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/privmsg/MsgCommand.java
+++ b/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/privmsg/MsgCommand.java
@@ -1,59 +1,48 @@
package de.kentoj.scrow.corevelocity.privmsg;
-import com.velocitypowered.api.command.CommandManager;
-import com.velocitypowered.api.command.CommandMeta;
-import com.velocitypowered.api.command.SimpleCommand;
+import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.Player;
import com.velocitypowered.api.proxy.ProxyServer;
-import lombok.RequiredArgsConstructor;
-import net.kyori.adventure.text.Component;
-import net.kyori.adventure.text.format.NamedTextColor;
+import de.kentoj.kencommandapi.VelocityCommandContext;
+import de.kentoj.kencommandapi.api.argument.CommandArgument;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
+import de.kentoj.kencommandapi.api.processing.CommandException;
+import de.kentoj.kencommandapi.api.processing.CommandExecutor;
+import de.kentoj.kencommandapi.api.types.StringArgumentType;
+import de.kentoj.kencommandapi.type.PlayerArgumentType;
+import de.kentoj.scrow.velocity.ScrowAPI;
+import lombok.Getter;
-import java.util.Arrays;
-import java.util.stream.Collectors;
+public class MsgCommand implements CommandExecutor {
-@RequiredArgsConstructor
-public class MsgCommand implements SimpleCommand {
+ @Getter
+ private final CommandNode rootNode;
+ private final CommandArgument targetArg;
+ private final CommandArgument msgArg;
private final LastTargetCache cache;
- private final ProxyServer server;
- @Override
- public void execute(Invocation invocation) {
- if (!(invocation.source() instanceof Player player)) return;
+ public MsgCommand(ProxyServer server, LastTargetCache cache) {
+ this.cache = cache;
- var targetName = invocation.arguments()[0];
- if (invocation.arguments().length < 2) {
- player.sendMessage(Component.text("usage: ./msg "));
- return;
- NamedTextColor
- }
-
- var target = server.getPlayer(targetName).orElse(null);
- if (target == null) {
- player.sendMessage(Component.text("The player you last messaged is now offline."));
- return;
- }
-
- if (target.getUniqueId().equals(player.getUniqueId())) {
- player.sendMessage(Component.text("You can't message yourself."));
- return;
- }
-
- var msg = Arrays.stream(invocation.arguments())
- .skip(1)
- .collect(Collectors.joining(" "));
- cache.setLastTarget(player.getUniqueId(), target.getUniqueId());
- PrivmsgHelper.handle(player, target, msg);
+ var cmds = ScrowAPI.getCommandApi();
+ targetArg = cmds.createArgument("target", new PlayerArgumentType(server));
+ msgArg = cmds.createArgument("msg", new StringArgumentType<>(true));
+ rootNode = cmds.createNode("msg", "w");
+ rootNode.setExecutor(this);
+ rootNode.addArgument(targetArg);
+ rootNode.addArgument(msgArg);
}
-
@Override
- public boolean hasPermission(Invocation invocation) {
- return invocation.source().hasPermission("corevelocity.cmd.msg");
- }
+ public void execute(VelocityCommandContext ctx) {
+ var target = ctx.getArg(targetArg);
+ var msg = ctx.getArg(msgArg);
- public static CommandMeta commandMeta(CommandManager cmds) {
- return cmds.metaBuilder("msg").aliases("w").build();
+ var isMessagingSelf = target.getUniqueId().equals(ctx.getPlayerSender().getUniqueId());
+ if (isMessagingSelf) throw new CommandException("You can't message yourself.");
+
+ cache.setLastTarget(ctx.getPlayerSender().getUniqueId(), target.getUniqueId());
+ PrivmsgHelper.handle(ctx.getPlayerSender(), target, msg);
}
}
diff --git a/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/privmsg/ReplyCommand.java b/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/privmsg/ReplyCommand.java
index b58d481..a0bd3cd 100644
--- a/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/privmsg/ReplyCommand.java
+++ b/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/privmsg/ReplyCommand.java
@@ -1,44 +1,44 @@
package de.kentoj.scrow.corevelocity.privmsg;
-import com.velocitypowered.api.command.CommandManager;
-import com.velocitypowered.api.command.CommandMeta;
-import com.velocitypowered.api.command.RawCommand;
-import com.velocitypowered.api.proxy.Player;
+import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.ProxyServer;
-import lombok.RequiredArgsConstructor;
-import net.kyori.adventure.text.Component;
+import de.kentoj.kencommandapi.VelocityCommandContext;
+import de.kentoj.kencommandapi.api.argument.CommandArgument;
+import de.kentoj.kencommandapi.api.nodes.CommandNode;
+import de.kentoj.kencommandapi.api.processing.CommandException;
+import de.kentoj.kencommandapi.api.processing.CommandExecutor;
+import de.kentoj.kencommandapi.api.types.StringArgumentType;
+import de.kentoj.scrow.velocity.ScrowAPI;
+import lombok.Getter;
-@RequiredArgsConstructor
-public class ReplyCommand implements RawCommand {
+public class ReplyCommand implements CommandExecutor {
+
+ @Getter
+ private final CommandNode rootNode;
+ private final CommandArgument msgArg;
private final LastTargetCache cache;
private final ProxyServer server;
- @Override
- public void execute(Invocation invocation) {
- if (!(invocation.source() instanceof Player player)) return;
- var targetId = cache.getLastTarget(player.getUniqueId());
- if (targetId == null) {
- player.sendMessage(Component.text("You haven't msg'd anyone recently. Use '/msg ' first."));
- return;
- }
+ public ReplyCommand(ProxyServer server, LastTargetCache cache) {
+ this.cache = cache;
+ this.server = server;
+ var cmds = ScrowAPI.getCommandApi();
+ msgArg = cmds.createArgument("msg", new StringArgumentType<>(true));
+ rootNode = cmds.createNode("reply", "r");
+ rootNode.setExecutor(this);
+ rootNode.addArgument(msgArg);
+ }
+
+ @Override
+ public void execute(VelocityCommandContext ctx) {
+ var targetId = cache.getLastTarget(ctx.getPlayerSender().getUniqueId());
var target = server.getPlayer(targetId).orElse(null);
- if (target == null) {
- player.sendMessage(Component.text("The player you last messaged is now offline."));
- return;
- }
+ if (target == null) throw new CommandException("The player you last messaged is no longer online");
- cache.setLastTarget(player.getUniqueId(), target.getUniqueId());
- PrivmsgHelper.handle(player, target, invocation.arguments());
- }
-
- @Override
- public boolean hasPermission(Invocation invocation) {
- return invocation.source().hasPermission("corevelocity.cmd.msg");
- }
-
- public static CommandMeta commandMeta(CommandManager cmds) {
- return cmds.metaBuilder("reply").aliases("r").build();
+ var msg = ctx.getArg(msgArg);
+ cache.setLastTarget(ctx.getPlayerSender().getUniqueId(), target.getUniqueId());
+ PrivmsgHelper.handle(ctx.getPlayerSender(), target, msg);
}
}
diff --git a/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/privmsg/ReplyKenCommand.java b/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/privmsg/ReplyKenCommand.java
deleted file mode 100644
index 83db736..0000000
--- a/core-velocity-impl/src/main/java/de/kentoj/scrow/corevelocity/privmsg/ReplyKenCommand.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package de.kentoj.scrow.corevelocity.privmsg;
-
-import com.velocitypowered.api.proxy.ProxyServer;
-
-public class ReplyKenCommand {
-
- public ReplyKenCommand(ProxyServer server) {
-
- }
-}
diff --git a/gradlew.bat b/gradlew.bat
index f39e6fa..9d21a21 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -46,7 +46,7 @@ set JAVA_EXE=java.exe
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
-echo ERROR: JAVA_HOME is not set and no 'java' SCommand could be found in your PATH. 1>&2
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
@@ -68,7 +68,7 @@ echo location of your Java installation. 1>&2
goto fail
:execute
-@rem Setup the SCommand line
+@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 049cb9b..93a00d7 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -10,4 +10,5 @@ rootProject.name = "core"
include("core-bukkit-api")
include("core-bukkit-impl")
include("core-lib")
-include("core-velocity")
\ No newline at end of file
+include("core-velocity-api")
+include("core-velocity-impl")
\ No newline at end of file