
在一些情况下想实时检测文件修改并直接重载,如果不想自己实现逻辑,可以使用 AyCore 的 ModifyListener



ModifyListener.addListener(Plugin plugin, CustomExecute<ModifyData> execute, boolean async, File... files);
代码:
ModifyListener.addListener(this, (modifyData) -> {
this.reloadConfig();
System.out.println(this.getConfig().getString("text"));
}, true, new File(this.getDataFolder(), "config.yml"));

如果你有什么关于 AyCore 的疑惑可以在下方评论,看到会一一回复。