32 lines
1.2 KiB
Java
Executable File
32 lines
1.2 KiB
Java
Executable File
package com.alttd.velocitychat.commands;
|
|
|
|
import com.alttd.velocitychat.VelocityChat;
|
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
import com.mojang.brigadier.tree.LiteralCommandNode;
|
|
import com.velocitypowered.api.command.BrigadierCommand;
|
|
import com.velocitypowered.api.command.CommandMeta;
|
|
import com.velocitypowered.api.command.CommandSource;
|
|
import com.velocitypowered.api.proxy.ProxyServer;
|
|
|
|
public class Reload {
|
|
|
|
public Reload(ProxyServer proxyServer) {
|
|
LiteralCommandNode<CommandSource> command = LiteralArgumentBuilder
|
|
.<CommandSource>literal("reloadchat")
|
|
.requires(ctx -> ctx.hasPermission("command.chat.reloadchat"))
|
|
.executes(context -> {
|
|
VelocityChat.getPlugin().ReloadConfig();
|
|
return 1;
|
|
})
|
|
.build();
|
|
|
|
BrigadierCommand brigadierCommand = new BrigadierCommand(command);
|
|
|
|
CommandMeta.Builder metaBuilder = proxyServer.getCommandManager().metaBuilder(brigadierCommand);
|
|
|
|
CommandMeta meta = metaBuilder.build();
|
|
|
|
proxyServer.getCommandManager().register(meta, brigadierCommand);
|
|
}
|
|
}
|