update kencommandapi ig

This commit is contained in:
kento2 2026-07-06 22:09:03 +02:00
parent a55d985773
commit be248bfea9
22 changed files with 93 additions and 93 deletions

View file

@ -21,15 +21,14 @@ public class CoreImplPlugin extends JavaPlugin {
public void onEnable() { public void onEnable() {
ScrowAPISurface.initScrowAPI(this); ScrowAPISurface.initScrowAPI(this);
{ {
ScrowAPI.getCommandApi().register(new CoinsCommand().getRootNode()); ScrowAPI.getCommandApi().register(new CoinsCommand().getRootLiteral());
ScrowAPI.getCommandApi().register(FriendCommand.create()); ScrowAPI.getCommandApi().register(FriendCommand.create());
var instanceCache = new InstanceCache(); var instanceCache = new InstanceCache();
ScrowAPI.getCommandApi().register(InstanceCommand.create(instanceCache)); ScrowAPI.getCommandApi().register(InstanceCommand.create(instanceCache));
ScrowAPI.getCommandApi().register(new PlayCommand().getRootNode()); ScrowAPI.getCommandApi().register(new PlayCommand().getRootLiteral());
ScrowAPI.getCommandApi().register(new LobbyCommand().getRootNode()); ScrowAPI.getCommandApi().register(new LobbyCommand().getRootLiteral());
} }
// Listeners
getServer().getPluginManager().registerEvents(new ChatStyleListener(), this); getServer().getPluginManager().registerEvents(new ChatStyleListener(), this);
// TODO/FIXME // TODO/FIXME

View file

@ -4,8 +4,8 @@ import com.leakyabstractions.result.api.Result;
import com.leakyabstractions.result.core.Results; import com.leakyabstractions.result.core.Results;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.node.RootCommandNode; import de.kentoj.kencommandapi.api.literal.RootLiteral;
import de.kentoj.kencommandapi.api.platform.MessageStyle; import de.kentoj.kencommandapi.api.platform.MessageStyle;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.scheduler.Tasks; import de.kentoj.scrow.bukkit.scheduler.Tasks;
@ -18,22 +18,22 @@ import java.util.concurrent.CompletableFuture;
public class CoinsCommand implements CommandExecutor<CommandSender> { public class CoinsCommand implements CommandExecutor<CommandSender> {
@Getter @Getter
private final RootCommandNode<CommandSender> rootNode; private final RootLiteral<CommandSender> rootLiteral;
private final MessageStyle style; private final MessageStyle style;
public CoinsCommand() { public CoinsCommand() {
style = ScrowMessageStyle.GENERIC; style = ScrowMessageStyle.GENERIC;
rootNode = CommandNode.rootNode(style, "coins", "bal", "balance"); rootLiteral = Literal.rootLiteral(style, "coins", "bal", "balance");
rootNode.setPermission("command.coins.get.self"); rootLiteral.setPermission("command.coins.get.self");
rootNode.setExecutor(this); rootLiteral.setExecutor(this);
var setLiteral = new CoinsSetLiteral(style).getLiteral(); var setLiteral = new CoinsSetLiteral(style).getLiteral();
setLiteral.setPermission("command.coins.set"); setLiteral.setPermission("command.coins.set");
rootNode.addLiteral(setLiteral); rootLiteral.addLiteral(setLiteral);
var getLiteral = new CoinsGetLiteral(style).getLiteral(); var getLiteral = new CoinsGetLiteral(style).getLiteral();
getLiteral.setPermission("command.coins.get.others"); getLiteral.setPermission("command.coins.get.others");
rootNode.addLiteral(getLiteral); rootLiteral.addLiteral(getLiteral);
} }
@Override @Override

View file

@ -5,7 +5,7 @@ import com.leakyabstractions.result.core.Results;
import de.kentoj.kencommandapi.api.argument.CommandArgument; import de.kentoj.kencommandapi.api.argument.CommandArgument;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.platform.MessageStyle; import de.kentoj.kencommandapi.api.platform.MessageStyle;
import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType; import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
@ -19,7 +19,7 @@ import java.util.concurrent.CompletableFuture;
public class CoinsGetLiteral implements CommandExecutor<CommandSender> { public class CoinsGetLiteral implements CommandExecutor<CommandSender> {
@Getter @Getter
private final CommandNode<CommandSender> literal; private final Literal<CommandSender> literal;
private final MessageStyle style; private final MessageStyle style;
private final CommandArgument<CommandSender, OfflinePlayer> playerArg; private final CommandArgument<CommandSender, OfflinePlayer> playerArg;
@ -30,7 +30,7 @@ public class CoinsGetLiteral implements CommandExecutor<CommandSender> {
playerArg = CommandArgument.arg("player", OfflinePlayerArgumentType.getInstance()); playerArg = CommandArgument.arg("player", OfflinePlayerArgumentType.getInstance());
playerArg.setDefaultValueProvider(sender -> (OfflinePlayer) sender); playerArg.setDefaultValueProvider(sender -> (OfflinePlayer) sender);
literal = CommandNode.node("get"); literal = Literal.literal("get");
literal.addArgument(playerArg); literal.addArgument(playerArg);
literal.setExecutor(this); literal.setExecutor(this);
} }

View file

@ -6,7 +6,7 @@ import de.kentoj.kencommandapi.api.argument.CommandArgument;
import de.kentoj.kencommandapi.api.argument.types.IntegerArgumentType; import de.kentoj.kencommandapi.api.argument.types.IntegerArgumentType;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.platform.MessageStyle; import de.kentoj.kencommandapi.api.platform.MessageStyle;
import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType; import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
@ -20,7 +20,7 @@ import java.util.concurrent.CompletableFuture;
public class CoinsSetLiteral implements CommandExecutor<CommandSender> { public class CoinsSetLiteral implements CommandExecutor<CommandSender> {
@Getter @Getter
private final CommandNode<CommandSender> literal; private final Literal<CommandSender> literal;
private final MessageStyle style; private final MessageStyle style;
private final CommandArgument<CommandSender, OfflinePlayer> playerArg; private final CommandArgument<CommandSender, OfflinePlayer> playerArg;
@ -32,7 +32,7 @@ public class CoinsSetLiteral implements CommandExecutor<CommandSender> {
playerArg = CommandArgument.arg("player", OfflinePlayerArgumentType.getInstance()); playerArg = CommandArgument.arg("player", OfflinePlayerArgumentType.getInstance());
amountArg = CommandArgument.arg("amount", new IntegerArgumentType<>()); amountArg = CommandArgument.arg("amount", new IntegerArgumentType<>());
literal = CommandNode.node("set"); literal = Literal.literal("set");
literal.addArgument(playerArg); literal.addArgument(playerArg);
literal.addArgument(amountArg); literal.addArgument(amountArg);
literal.setExecutor(this); literal.setExecutor(this);

View file

@ -5,7 +5,7 @@ import com.leakyabstractions.result.core.Results;
import de.kentoj.kencommandapi.api.argument.CommandArgument; import de.kentoj.kencommandapi.api.argument.CommandArgument;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType; import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrowlib.friends.FriendRequestService; import de.kentoj.scrowlib.friends.FriendRequestService;
@ -31,7 +31,7 @@ import java.util.concurrent.CompletableFuture;
public class FriendAddLiteral implements CommandExecutor<CommandSender> { public class FriendAddLiteral implements CommandExecutor<CommandSender> {
@Getter @Getter
private final CommandNode<CommandSender> literal; private final Literal<CommandSender> literal;
private final CommandArgument<CommandSender, OfflinePlayer> playerArg; private final CommandArgument<CommandSender, OfflinePlayer> playerArg;
private final ScrowMessageStyle style; private final ScrowMessageStyle style;
private final FriendRequestService requestService = ScrowAPI.getFriendRequestService(); private final FriendRequestService requestService = ScrowAPI.getFriendRequestService();
@ -40,7 +40,7 @@ public class FriendAddLiteral implements CommandExecutor<CommandSender> {
public FriendAddLiteral(ScrowMessageStyle style) { public FriendAddLiteral(ScrowMessageStyle style) {
this.style = style; this.style = style;
playerArg = CommandArgument.arg("player", OfflinePlayerArgumentType.getInstance()); playerArg = CommandArgument.arg("player", OfflinePlayerArgumentType.getInstance());
literal = CommandNode.node("add"); literal = Literal.literal("add");
literal.addArgument(playerArg); literal.addArgument(playerArg);
literal.setExecutor(this); literal.setExecutor(this);
} }

View file

@ -1,7 +1,7 @@
package de.kentoj.scrow.bukkit.command.friends; package de.kentoj.scrow.bukkit.command.friends;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.node.RootCommandNode; import de.kentoj.kencommandapi.api.literal.RootLiteral;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -13,15 +13,15 @@ import org.bukkit.command.CommandSender;
@NoArgsConstructor(access = AccessLevel.NONE) @NoArgsConstructor(access = AccessLevel.NONE)
public class FriendCommand { public class FriendCommand {
public static RootCommandNode<CommandSender> create() { public static RootLiteral<CommandSender> create() {
var style = new ScrowMessageStyle("Friends", NamedTextColor.AQUA); var style = new ScrowMessageStyle("Friends", NamedTextColor.AQUA);
RootCommandNode<CommandSender> rootNode = CommandNode.rootNode(style, "f", "friend"); RootLiteral<CommandSender> rootLiteral = Literal.rootLiteral(style, "f", "friend");
rootNode.addLiteral(new FriendListLiteral(style).getLiteral()); rootLiteral.addLiteral(new FriendListLiteral(style).getLiteral());
rootNode.addLiteral(new FriendAddLiteral(style).getLiteral()); rootLiteral.addLiteral(new FriendAddLiteral(style).getLiteral());
rootNode.addLiteral(new FriendRemoveLiteral(style).getLiteral()); rootLiteral.addLiteral(new FriendRemoveLiteral(style).getLiteral());
rootNode.addLiteral(new FriendRequestDeclineLiteral(style).getLiteral()); rootLiteral.addLiteral(new FriendRequestDeclineLiteral(style).getLiteral());
rootNode.addLiteral(new FriendRequestsLiteral(style).getLiteral()); rootLiteral.addLiteral(new FriendRequestsLiteral(style).getLiteral());
return rootNode; return rootLiteral;
} }
public static Component friendRequestOptions(String requestSenderName, boolean runInstantly) { public static Component friendRequestOptions(String requestSenderName, boolean runInstantly) {

View file

@ -4,7 +4,7 @@ import com.leakyabstractions.result.api.Result;
import com.leakyabstractions.result.core.Results; import com.leakyabstractions.result.core.Results;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.scheduler.Tasks; import de.kentoj.scrow.bukkit.scheduler.Tasks;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
@ -26,12 +26,12 @@ import static net.kyori.adventure.text.Component.text;
public class FriendListLiteral implements CommandExecutor<CommandSender> { public class FriendListLiteral implements CommandExecutor<CommandSender> {
@Getter @Getter
private final CommandNode<CommandSender> literal; private final Literal<CommandSender> literal;
private final ScrowMessageStyle style; private final ScrowMessageStyle style;
public FriendListLiteral(ScrowMessageStyle style) { public FriendListLiteral(ScrowMessageStyle style) {
this.style = style; this.style = style;
this.literal = CommandNode.node("list"); this.literal = Literal.literal("list");
literal.setExecutor(this); literal.setExecutor(this);
} }

View file

@ -5,7 +5,7 @@ import com.leakyabstractions.result.core.Results;
import de.kentoj.kencommandapi.api.argument.CommandArgument; import de.kentoj.kencommandapi.api.argument.CommandArgument;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType; import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.scheduler.Tasks; import de.kentoj.scrow.bukkit.scheduler.Tasks;
@ -19,14 +19,14 @@ import java.util.concurrent.CompletableFuture;
public class FriendRemoveLiteral implements CommandExecutor<CommandSender> { public class FriendRemoveLiteral implements CommandExecutor<CommandSender> {
@Getter @Getter
private final CommandNode<CommandSender> literal; private final Literal<CommandSender> literal;
private final CommandArgument<CommandSender, OfflinePlayer> playerArg; private final CommandArgument<CommandSender, OfflinePlayer> playerArg;
private final ScrowMessageStyle style; private final ScrowMessageStyle style;
public FriendRemoveLiteral(ScrowMessageStyle style) { public FriendRemoveLiteral(ScrowMessageStyle style) {
this.style = style; this.style = style;
this.playerArg = CommandArgument.arg("player", OfflinePlayerArgumentType.getInstance()); this.playerArg = CommandArgument.arg("player", OfflinePlayerArgumentType.getInstance());
this.literal = CommandNode.node("remove"); this.literal = Literal.literal("remove");
this.literal.addArgument(playerArg); this.literal.addArgument(playerArg);
this.literal.setExecutor(this); this.literal.setExecutor(this);
} }

View file

@ -5,7 +5,7 @@ import com.leakyabstractions.result.core.Results;
import de.kentoj.kencommandapi.api.argument.CommandArgument; import de.kentoj.kencommandapi.api.argument.CommandArgument;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType; import de.kentoj.kencommandapi.type.OfflinePlayerArgumentType;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrowlib.friends.FriendRequestService; import de.kentoj.scrowlib.friends.FriendRequestService;
@ -23,7 +23,7 @@ import java.util.concurrent.CompletableFuture;
public class FriendRequestDeclineLiteral implements CommandExecutor<CommandSender> { public class FriendRequestDeclineLiteral implements CommandExecutor<CommandSender> {
@Getter @Getter
private final CommandNode<CommandSender> literal; private final Literal<CommandSender> literal;
private final CommandArgument<CommandSender, OfflinePlayer> playerArg; private final CommandArgument<CommandSender, OfflinePlayer> playerArg;
private final ScrowMessageStyle style; private final ScrowMessageStyle style;
private final FriendRequestService requestService = ScrowAPI.getFriendRequestService(); private final FriendRequestService requestService = ScrowAPI.getFriendRequestService();
@ -31,7 +31,7 @@ public class FriendRequestDeclineLiteral implements CommandExecutor<CommandSende
public FriendRequestDeclineLiteral(ScrowMessageStyle style) { public FriendRequestDeclineLiteral(ScrowMessageStyle style) {
this.style = style; this.style = style;
playerArg = CommandArgument.arg("player", OfflinePlayerArgumentType.getInstance()); playerArg = CommandArgument.arg("player", OfflinePlayerArgumentType.getInstance());
literal = CommandNode.node("reject", "decline"); literal = Literal.literal("reject", "decline");
literal.addArgument(playerArg); literal.addArgument(playerArg);
literal.setExecutor(this); literal.setExecutor(this);
} }

View file

@ -4,7 +4,7 @@ import com.leakyabstractions.result.api.Result;
import com.leakyabstractions.result.core.Results; import com.leakyabstractions.result.core.Results;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrowlib.friends.FriendRequest; import de.kentoj.scrowlib.friends.FriendRequest;
import de.kentoj.scrow.bukkit.scheduler.Tasks; import de.kentoj.scrow.bukkit.scheduler.Tasks;
@ -25,12 +25,12 @@ import static net.kyori.adventure.text.Component.text;
public class FriendRequestsLiteral implements CommandExecutor<CommandSender> { public class FriendRequestsLiteral implements CommandExecutor<CommandSender> {
@Getter @Getter
private final CommandNode<CommandSender> literal; private final Literal<CommandSender> literal;
private final ScrowMessageStyle style; private final ScrowMessageStyle style;
public FriendRequestsLiteral(ScrowMessageStyle style) { public FriendRequestsLiteral(ScrowMessageStyle style) {
this.style = style; this.style = style;
literal = CommandNode.node("requests"); literal = Literal.literal("requests");
literal.setExecutor(this); literal.setExecutor(this);
} }

View file

@ -1,7 +1,7 @@
package de.kentoj.scrow.bukkit.command.instance; package de.kentoj.scrow.bukkit.command.instance;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.node.RootCommandNode; import de.kentoj.kencommandapi.api.literal.RootLiteral;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -10,12 +10,12 @@ import org.bukkit.command.CommandSender;
@NoArgsConstructor(access = AccessLevel.NONE) @NoArgsConstructor(access = AccessLevel.NONE)
public class InstanceCommand { public class InstanceCommand {
public static RootCommandNode<CommandSender> create(InstanceCache instanceCache) { public static RootLiteral<CommandSender> create(InstanceCache instanceCache) {
var style = new ScrowMessageStyle("server-manager", NamedTextColor.RED); var style = new ScrowMessageStyle("server-manager", NamedTextColor.RED);
RootCommandNode<CommandSender> rootNode = CommandNode.rootNode(style, "instance", "server-manager"); RootLiteral<CommandSender> rootLiteral = Literal.rootLiteral(style, "instance", "server-manager");
rootNode.addLiteral(new InstanceListLiteral(style).getNode()); rootLiteral.addLiteral(new InstanceListLiteral(style).getNode());
rootNode.addLiteral(new InstanceDeployLiteral(style).getLiteral()); rootLiteral.addLiteral(new InstanceDeployLiteral(style).getLiteral());
rootNode.addLiteral(new InstanceDestroyLiteral(instanceCache, style).getLiteral()); rootLiteral.addLiteral(new InstanceDestroyLiteral(instanceCache, style).getLiteral());
return rootNode; return rootLiteral;
} }
} }

View file

@ -6,7 +6,7 @@ import de.kentoj.kencommandapi.api.argument.CommandArgument;
import de.kentoj.kencommandapi.api.argument.types.StringArgumentType; import de.kentoj.kencommandapi.api.argument.types.StringArgumentType;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.scheduler.Tasks; import de.kentoj.scrow.bukkit.scheduler.Tasks;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
@ -18,7 +18,7 @@ import java.util.concurrent.CompletableFuture;
public class InstanceDeployLiteral implements CommandExecutor<CommandSender> { public class InstanceDeployLiteral implements CommandExecutor<CommandSender> {
@Getter @Getter
private final CommandNode<CommandSender> literal; private final Literal<CommandSender> literal;
private final CommandArgument<CommandSender, String> templateArg; private final CommandArgument<CommandSender, String> templateArg;
private final ScrowMessageStyle style; private final ScrowMessageStyle style;
@ -27,7 +27,7 @@ public class InstanceDeployLiteral implements CommandExecutor<CommandSender> {
templateArg = CommandArgument.arg("template", new StringArgumentType<>()); templateArg = CommandArgument.arg("template", new StringArgumentType<>());
literal = CommandNode.node("deploy"); literal = Literal.literal("deploy");
literal.addArgument(templateArg); literal.addArgument(templateArg);
literal.setExecutor(this); literal.setExecutor(this);
} }

View file

@ -6,7 +6,7 @@ import de.kentoj.kencommandapi.api.argument.CommandArgument;
import de.kentoj.kencommandapi.api.argument.types.StringArgumentType; import de.kentoj.kencommandapi.api.argument.types.StringArgumentType;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.scheduler.Tasks; import de.kentoj.scrow.bukkit.scheduler.Tasks;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
@ -19,7 +19,7 @@ import java.util.concurrent.CompletableFuture;
public class InstanceDestroyLiteral implements CommandExecutor<CommandSender> { public class InstanceDestroyLiteral implements CommandExecutor<CommandSender> {
@Getter @Getter
private final CommandNode<CommandSender> literal; private final Literal<CommandSender> literal;
private final CommandArgument<CommandSender, String> handleArg; private final CommandArgument<CommandSender, String> handleArg;
private final ScrowMessageStyle style; private final ScrowMessageStyle style;
@ -30,7 +30,7 @@ public class InstanceDestroyLiteral implements CommandExecutor<CommandSender> {
handleArg.setSuggestionProvider(ctx -> cache.getInstances().stream() handleArg.setSuggestionProvider(ctx -> cache.getInstances().stream()
.map(ServerInstance::getHandle) .map(ServerInstance::getHandle)
.toList()); .toList());
literal = CommandNode.node("destroy"); literal = Literal.literal("destroy");
literal.addArgument(handleArg); literal.addArgument(handleArg);
literal.setExecutor(this); literal.setExecutor(this);
} }

View file

@ -4,7 +4,7 @@ import com.leakyabstractions.result.api.Result;
import com.leakyabstractions.result.core.Results; import com.leakyabstractions.result.core.Results;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.scheduler.Tasks; import de.kentoj.scrow.bukkit.scheduler.Tasks;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
@ -17,12 +17,12 @@ import java.util.concurrent.CompletableFuture;
public class InstanceListLiteral implements CommandExecutor<CommandSender> { public class InstanceListLiteral implements CommandExecutor<CommandSender> {
@Getter @Getter
private final CommandNode<CommandSender> node; private final Literal<CommandSender> node;
private final ScrowMessageStyle style; private final ScrowMessageStyle style;
public InstanceListLiteral(ScrowMessageStyle style) { public InstanceListLiteral(ScrowMessageStyle style) {
this.style = style; this.style = style;
this.node = CommandNode.node("list"); this.node = Literal.literal("list");
this.node.setExecutor(this); this.node.setExecutor(this);
} }

View file

@ -4,8 +4,8 @@ import com.leakyabstractions.result.api.Result;
import com.leakyabstractions.result.core.Results; import com.leakyabstractions.result.core.Results;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.SyncCommandExecutor; import de.kentoj.kencommandapi.api.invocation.SyncCommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.node.RootCommandNode; import de.kentoj.kencommandapi.api.literal.RootLiteral;
import de.kentoj.kencommandapi.api.platform.MessageStyle; import de.kentoj.kencommandapi.api.platform.MessageStyle;
import lombok.Getter; import lombok.Getter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -14,11 +14,11 @@ import org.bukkit.command.CommandSender;
public class LobbyCommand implements SyncCommandExecutor<CommandSender> { public class LobbyCommand implements SyncCommandExecutor<CommandSender> {
@Getter @Getter
private final RootCommandNode<CommandSender> rootNode; private final RootLiteral<CommandSender> rootLiteral;
public LobbyCommand() { public LobbyCommand() {
this.rootNode = CommandNode.rootNode(MessageStyle.PLAIN, "lobby", "l", "hub"); this.rootLiteral = Literal.rootLiteral(MessageStyle.PLAIN, "lobby", "l", "hub");
this.rootNode.setExecutor(this); this.rootLiteral.setExecutor(this);
} }
@Override @Override

View file

@ -6,8 +6,8 @@ import de.kentoj.kencommandapi.api.argument.CommandArgument;
import de.kentoj.kencommandapi.api.argument.types.StringArgumentType; import de.kentoj.kencommandapi.api.argument.types.StringArgumentType;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.CommandExecutor; import de.kentoj.kencommandapi.api.invocation.CommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.node.RootCommandNode; import de.kentoj.kencommandapi.api.literal.RootLiteral;
import de.kentoj.scrow.bukkit.ScrowAPI; import de.kentoj.scrow.bukkit.ScrowAPI;
import de.kentoj.scrow.bukkit.scheduler.Tasks; import de.kentoj.scrow.bukkit.scheduler.Tasks;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
@ -20,7 +20,7 @@ import java.util.concurrent.CompletableFuture;
public class PlayCommand implements CommandExecutor<CommandSender> { public class PlayCommand implements CommandExecutor<CommandSender> {
@Getter @Getter
private final RootCommandNode<CommandSender> rootNode; private final RootLiteral<CommandSender> rootLiteral;
private final CommandArgument<CommandSender, String> gamemodeArg; private final CommandArgument<CommandSender, String> gamemodeArg;
public PlayCommand() { public PlayCommand() {
@ -28,9 +28,9 @@ public class PlayCommand implements CommandExecutor<CommandSender> {
gamemodeArg = CommandArgument.arg("gamemode", new StringArgumentType<>()); gamemodeArg = CommandArgument.arg("gamemode", new StringArgumentType<>());
rootNode = CommandNode.rootNode(style, "play", "queue"); rootLiteral = Literal.rootLiteral(style, "play", "queue");
rootNode.addArgument(this.gamemodeArg); rootLiteral.addArgument(this.gamemodeArg);
rootNode.setExecutor(this); rootLiteral.setExecutor(this);
} }
@Override @Override

View file

@ -8,6 +8,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
public class ChatStyleListener implements Listener { public class ChatStyleListener implements Listener {
@EventHandler @EventHandler
public void onChat(AsyncChatEvent event) { public void onChat(AsyncChatEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();

View file

@ -33,9 +33,9 @@ public class CoreVelocityPlugin {
var lastTargetCache = new LastTargetCache(); var lastTargetCache = new LastTargetCache();
var style = new ScrowMessageStyle("MSG", NamedTextColor.LIGHT_PURPLE); var style = new ScrowMessageStyle("MSG", NamedTextColor.LIGHT_PURPLE);
var privmsgHelper = new PrivMsgHandler(style); var privmsgHelper = new PrivMsgHandler(style);
cmds.register(new ReplyCommand(server, lastTargetCache, privmsgHelper, style).getRootNode()); cmds.register(new ReplyCommand(server, lastTargetCache, privmsgHelper, style).getRootLiteral());
cmds.register(new MsgCommand(server, lastTargetCache, privmsgHelper, style).getRootNode()); cmds.register(new MsgCommand(server, lastTargetCache, privmsgHelper, style).getRootLiteral());
cmds.register(new OnlineCommand(server).getRootNode()); cmds.register(new OnlineCommand(server).getRootLiteral());
} }
var registerWatchdog = new ServerRegisterWatchdog(server); var registerWatchdog = new ServerRegisterWatchdog(server);

View file

@ -6,8 +6,8 @@ import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.ProxyServer; import com.velocitypowered.api.proxy.ProxyServer;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.SyncCommandExecutor; import de.kentoj.kencommandapi.api.invocation.SyncCommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.node.RootCommandNode; import de.kentoj.kencommandapi.api.literal.RootLiteral;
import de.kentoj.scrowlib.convention.ScrowMessageStyle; import de.kentoj.scrowlib.convention.ScrowMessageStyle;
import lombok.Getter; import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -16,14 +16,14 @@ import lombok.RequiredArgsConstructor;
public class OnlineCommand implements SyncCommandExecutor<CommandSource> { public class OnlineCommand implements SyncCommandExecutor<CommandSource> {
@Getter @Getter
private final RootCommandNode<CommandSource> rootNode; private final RootLiteral<CommandSource> rootLiteral;
private final ScrowMessageStyle style = ScrowMessageStyle.GENERIC; private final ScrowMessageStyle style = ScrowMessageStyle.GENERIC;
private final ProxyServer server; private final ProxyServer server;
public OnlineCommand(ProxyServer server) { public OnlineCommand(ProxyServer server) {
this.server = server; this.server = server;
rootNode = CommandNode.rootNode(ScrowMessageStyle.GENERIC, "online"); rootLiteral = Literal.rootLiteral(ScrowMessageStyle.GENERIC, "online");
rootNode.setExecutor(this); rootLiteral.setExecutor(this);
} }
@Override @Override

View file

@ -9,8 +9,8 @@ import de.kentoj.kencommandapi.api.argument.CommandArgument;
import de.kentoj.kencommandapi.api.argument.types.StringArgumentType; import de.kentoj.kencommandapi.api.argument.types.StringArgumentType;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.SyncCommandExecutor; import de.kentoj.kencommandapi.api.invocation.SyncCommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.node.RootCommandNode; import de.kentoj.kencommandapi.api.literal.RootLiteral;
import de.kentoj.kencommandapi.api.platform.MessageStyle; import de.kentoj.kencommandapi.api.platform.MessageStyle;
import de.kentoj.kencommandapi.type.PlayerArgumentType; import de.kentoj.kencommandapi.type.PlayerArgumentType;
import lombok.Getter; import lombok.Getter;
@ -18,7 +18,7 @@ import lombok.Getter;
public class MsgCommand implements SyncCommandExecutor<CommandSource> { public class MsgCommand implements SyncCommandExecutor<CommandSource> {
@Getter @Getter
private final RootCommandNode<CommandSource> rootNode; private final RootLiteral<CommandSource> rootLiteral;
private final CommandArgument<CommandSource, Player> targetArg; private final CommandArgument<CommandSource, Player> targetArg;
private final CommandArgument<CommandSource, String> msgArg; private final CommandArgument<CommandSource, String> msgArg;
@ -32,10 +32,10 @@ public class MsgCommand implements SyncCommandExecutor<CommandSource> {
targetArg = CommandArgument.arg("target", new PlayerArgumentType(server)); targetArg = CommandArgument.arg("target", new PlayerArgumentType(server));
msgArg = CommandArgument.arg("msg", new StringArgumentType<>(true)); msgArg = CommandArgument.arg("msg", new StringArgumentType<>(true));
rootNode = CommandNode.rootNode(style, "msg", "w", "privmsg"); rootLiteral = Literal.rootLiteral(style, "msg", "w", "privmsg");
rootNode.setExecutor(this); rootLiteral.setExecutor(this);
rootNode.addArgument(targetArg); rootLiteral.addArgument(targetArg);
rootNode.addArgument(msgArg); rootLiteral.addArgument(msgArg);
} }
@Override @Override

View file

@ -9,15 +9,15 @@ import de.kentoj.kencommandapi.api.argument.CommandArgument;
import de.kentoj.kencommandapi.api.argument.types.StringArgumentType; import de.kentoj.kencommandapi.api.argument.types.StringArgumentType;
import de.kentoj.kencommandapi.api.invocation.CommandContext; import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.SyncCommandExecutor; import de.kentoj.kencommandapi.api.invocation.SyncCommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode; import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.node.RootCommandNode; import de.kentoj.kencommandapi.api.literal.RootLiteral;
import de.kentoj.kencommandapi.api.platform.MessageStyle; import de.kentoj.kencommandapi.api.platform.MessageStyle;
import lombok.Getter; import lombok.Getter;
public class ReplyCommand implements SyncCommandExecutor<CommandSource> { public class ReplyCommand implements SyncCommandExecutor<CommandSource> {
@Getter @Getter
private final RootCommandNode<CommandSource> rootNode; private final RootLiteral<CommandSource> rootLiteral;
private final CommandArgument<CommandSource, String> msgArg; private final CommandArgument<CommandSource, String> msgArg;
private final LastTargetCache cache; private final LastTargetCache cache;
@ -30,9 +30,9 @@ public class ReplyCommand implements SyncCommandExecutor<CommandSource> {
this.privMsgHandler = privMsgHandler; this.privMsgHandler = privMsgHandler;
msgArg = CommandArgument.arg("msg", new StringArgumentType<>(true)); msgArg = CommandArgument.arg("msg", new StringArgumentType<>(true));
rootNode = CommandNode.rootNode(style, "reply", "r"); rootLiteral = Literal.rootLiteral(style, "reply", "r");
rootNode.setExecutor(this); rootLiteral.setExecutor(this);
rootNode.addArgument(msgArg); rootLiteral.addArgument(msgArg);
} }
@Override @Override

View file

@ -1,7 +1,7 @@
[versions] [versions]
shadow = "9.2.0" shadow = "9.2.0"
run-paper = "2.3.1" run-paper = "2.3.1"
scrow-commandapi = "0.32" scrow-commandapi = "0.33-SNAPSHOT"
postgress = "42.7.12" postgress = "42.7.12"
nats = "2.25.2" nats = "2.25.2"
papermc = "1.21.11-rc3-R0.1-SNAPSHOT" papermc = "1.21.11-rc3-R0.1-SNAPSHOT"