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