This commit is contained in:
len
2021-06-13 13:53:49 +02:00
parent bfadd18020
commit a5c23d842d
24 changed files with 139 additions and 166 deletions
@@ -24,7 +24,7 @@ public class GlobalAdminChat {
.executes(context -> {
VelocityChat.getPlugin().getChatHandler().globalAdminChat(context.getSource(), context.getArgument("message", String.class));
return 1;
}) // TODO call in the same way as gc?
})
)
.executes(context -> 0)
.build();
@@ -15,29 +15,29 @@ import com.velocitypowered.api.proxy.ProxyServer;
public class GlobalChat {
public GlobalChat(ProxyServer proxyServer) {
LiteralCommandNode<CommandSource> command = LiteralArgumentBuilder
.<CommandSource>literal("globalchat")
.requires(ctx -> ctx.hasPermission("command.proxy.globalchat"))// TODO permission system? load permissions from config?
.requires(ctx -> ctx instanceof Player) // players only can use this
.then(RequiredArgumentBuilder
.<CommandSource, String>argument("message", StringArgumentType.greedyString())
.executes(context -> {
VelocityChat.getPlugin().getChatHandler().globalChat((Player) context.getSource(), context.getArgument("message", String.class));
return 1;
})
)
.executes(context -> 0) // todo info message /usage
.build();
BrigadierCommand brigadierCommand = new BrigadierCommand(command);
CommandMeta.Builder metaBuilder = proxyServer.getCommandManager().metaBuilder(brigadierCommand);
for (String alias : Config.GCALIAS) {
metaBuilder.aliases(alias);
}
CommandMeta meta = metaBuilder.build();
proxyServer.getCommandManager().register(meta, brigadierCommand);
// LiteralCommandNode<CommandSource> command = LiteralArgumentBuilder
// .<CommandSource>literal("globalchat")
// .requires(ctx -> ctx.hasPermission("command.proxy.globalchat"))// TODO permission system? load permissions from config?
// .requires(ctx -> ctx instanceof Player) // players only can use this
// .then(RequiredArgumentBuilder
// .<CommandSource, String>argument("message", StringArgumentType.greedyString())
// .executes(context -> {
// VelocityChat.getPlugin().getChatHandler().globalChat((Player) context.getSource(), context.getArgument("message", String.class));
// return 1;
// })
// )
// .executes(context -> 0) // todo info message /usage
// .build();
//
// BrigadierCommand brigadierCommand = new BrigadierCommand(command);
//
// CommandMeta.Builder metaBuilder = proxyServer.getCommandManager().metaBuilder(brigadierCommand);
//
// for (String alias : Config.GCALIAS) {
// metaBuilder.aliases(alias);
// }
// CommandMeta meta = metaBuilder.build();
//
// proxyServer.getCommandManager().register(meta, brigadierCommand);
}
}