Replaced inconsistent `ReloadConfig` usage with `reloadConfig` across the codebase for better naming consistency. Introduced `ServerName` utility to standardize server name retrieval and improve maintainability. Added logging enhancements for better debugging of muted users and blocked messages.
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);
|
|
}
|
|
}
|