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

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

View file

@ -6,8 +6,8 @@ import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.proxy.ProxyServer;
import de.kentoj.kencommandapi.api.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.SyncCommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode;
import de.kentoj.kencommandapi.api.node.RootCommandNode;
import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.literal.RootLiteral;
import de.kentoj.scrowlib.convention.ScrowMessageStyle;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@ -16,14 +16,14 @@ import lombok.RequiredArgsConstructor;
public class OnlineCommand implements SyncCommandExecutor<CommandSource> {
@Getter
private final RootCommandNode<CommandSource> rootNode;
private final RootLiteral<CommandSource> rootLiteral;
private final ScrowMessageStyle style = ScrowMessageStyle.GENERIC;
private final ProxyServer server;
public OnlineCommand(ProxyServer server) {
this.server = server;
rootNode = CommandNode.rootNode(ScrowMessageStyle.GENERIC, "online");
rootNode.setExecutor(this);
rootLiteral = Literal.rootLiteral(ScrowMessageStyle.GENERIC, "online");
rootLiteral.setExecutor(this);
}
@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.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.SyncCommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode;
import de.kentoj.kencommandapi.api.node.RootCommandNode;
import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.literal.RootLiteral;
import de.kentoj.kencommandapi.api.platform.MessageStyle;
import de.kentoj.kencommandapi.type.PlayerArgumentType;
import lombok.Getter;
@ -18,7 +18,7 @@ import lombok.Getter;
public class MsgCommand implements SyncCommandExecutor<CommandSource> {
@Getter
private final RootCommandNode<CommandSource> rootNode;
private final RootLiteral<CommandSource> rootLiteral;
private final CommandArgument<CommandSource, Player> targetArg;
private final CommandArgument<CommandSource, String> msgArg;
@ -32,10 +32,10 @@ public class MsgCommand implements SyncCommandExecutor<CommandSource> {
targetArg = CommandArgument.arg("target", new PlayerArgumentType(server));
msgArg = CommandArgument.arg("msg", new StringArgumentType<>(true));
rootNode = CommandNode.rootNode(style, "msg", "w", "privmsg");
rootNode.setExecutor(this);
rootNode.addArgument(targetArg);
rootNode.addArgument(msgArg);
rootLiteral = Literal.rootLiteral(style, "msg", "w", "privmsg");
rootLiteral.setExecutor(this);
rootLiteral.addArgument(targetArg);
rootLiteral.addArgument(msgArg);
}
@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.invocation.CommandContext;
import de.kentoj.kencommandapi.api.invocation.SyncCommandExecutor;
import de.kentoj.kencommandapi.api.node.CommandNode;
import de.kentoj.kencommandapi.api.node.RootCommandNode;
import de.kentoj.kencommandapi.api.literal.Literal;
import de.kentoj.kencommandapi.api.literal.RootLiteral;
import de.kentoj.kencommandapi.api.platform.MessageStyle;
import lombok.Getter;
public class ReplyCommand implements SyncCommandExecutor<CommandSource> {
@Getter
private final RootCommandNode<CommandSource> rootNode;
private final RootLiteral<CommandSource> rootLiteral;
private final CommandArgument<CommandSource, String> msgArg;
private final LastTargetCache cache;
@ -30,9 +30,9 @@ public class ReplyCommand implements SyncCommandExecutor<CommandSource> {
this.privMsgHandler = privMsgHandler;
msgArg = CommandArgument.arg("msg", new StringArgumentType<>(true));
rootNode = CommandNode.rootNode(style, "reply", "r");
rootNode.setExecutor(this);
rootNode.addArgument(msgArg);
rootLiteral = Literal.rootLiteral(style, "reply", "r");
rootLiteral.setExecutor(this);
rootLiteral.addArgument(msgArg);
}
@Override