40 lines
1.4 KiB
Java
Executable File
40 lines
1.4 KiB
Java
Executable File
package com.alttd.chat.commands;
|
|
|
|
import com.alttd.chat.VelocityChat;
|
|
import com.alttd.chat.config.Config;
|
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
|
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
|
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
|
import com.mojang.brigadier.suggestion.Suggestions;
|
|
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.Player;
|
|
import com.velocitypowered.api.proxy.ProxyServer;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
|
|
public class Reload {
|
|
|
|
public Reload(ProxyServer proxyServer) {
|
|
LiteralCommandNode<CommandSource> command = LiteralArgumentBuilder
|
|
.<CommandSource>literal("reloadchat")
|
|
.requires(ctx -> ctx.hasPermission("command.proxy.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);
|
|
}
|
|
}
|