mirror of
https://github.com/jie65535/gc-openchat-plugin.git
synced 2025-06-01 17:29:11 +08:00
Add /serverchat reload
subcommand
This commit is contained in:
parent
0f2847b684
commit
6384d5daef
@ -30,6 +30,7 @@ Server command (requires `server.chat.others` permissions) :
|
||||
- `/serverchat ban|mute @uid [time(Minutes)]` Mute the specified player for the specified time (minutes) (optional)
|
||||
- `/serverchat unban|unmute @uid` Unmute a specified player
|
||||
- `/serverchat limit <timesPerMinute>` Set a frequency limit for sending messages
|
||||
- `/serverchat reload` reload config.json
|
||||
|
||||
`/serverchat` can be aliased as `/sc`
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
- `/serverchat ban @uid [时间(分钟)]` 禁言指定玩家
|
||||
- `/serverchat unban @uid` 解除指定玩家禁言
|
||||
- `/serverchat limit <次每分钟>` 设置发消息频率限制
|
||||
- `/serverchat reload` 重载配置文件
|
||||
|
||||
`/serverchat` 可用别名 `/sc`
|
||||
|
||||
|
@ -40,7 +40,7 @@ public final class OpenChatPlugin extends Plugin {
|
||||
public OpenChatConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
private void loadConfig() {
|
||||
public void loadConfig() {
|
||||
var configFile = new File(getDataFolder(), "config.json");
|
||||
if (!configFile.exists()) {
|
||||
config = new OpenChatConfig();
|
||||
|
@ -9,7 +9,7 @@ import java.util.List;
|
||||
|
||||
@Command(label = "serverchat",
|
||||
aliases = { "sc" },
|
||||
usage = { "on/off", "unban|unmute @uid", "ban|mute @uid [time(Minutes)]", "limit <timesPerMinute>" },
|
||||
usage = { "on/off", "unban|unmute @uid", "ban|mute @uid [time(Minutes)]", "limit <timesPerMinute>", "reload" },
|
||||
permission = "server.chat",
|
||||
permissionTargeted = "server.chat.others")
|
||||
public class ChatServerCommands implements CommandHandler {
|
||||
@ -70,6 +70,10 @@ public class ChatServerCommands implements CommandHandler {
|
||||
plugin.saveConfig();
|
||||
CommandHandler.sendMessage(sender, "OK");
|
||||
}
|
||||
case "reload" -> {
|
||||
plugin.loadConfig();
|
||||
CommandHandler.sendMessage(sender, "OK");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user