mirror of
https://github.com/jie65535/gc-openchat-plugin.git
synced 2025-12-05 18:01:38 +08:00
Add /serverchat reload subcommand
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user