mirror of
https://e.coding.net/circlecloud/MiaoChat.git
synced 2024-11-14 13:28:46 +00:00
feat: 初步添加BC分组发送
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
938bc2d03a
commit
f806fdad0e
@ -1,14 +1,19 @@
|
||||
package pw.yumc.MiaoChat;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import pw.yumc.MiaoChat.bungee.FileConfig;
|
||||
|
||||
public class MiaoChatBungee extends Plugin implements Listener {
|
||||
private Map<InetSocketAddress, List<ServerInfo>> group;
|
||||
private FileConfig config;
|
||||
@EventHandler
|
||||
public void handle(final PluginMessageEvent event) {
|
||||
if (event.getTag().equals(MiaoMessage.CHANNEL) || event.getTag().equals(MiaoMessage.NORMALCHANNEL)) {
|
||||
@ -21,6 +26,11 @@ public class MiaoChatBungee extends Plugin implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
config = new FileConfig(this, "group.yml");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
getProxy().registerChannel(MiaoMessage.CHANNEL);
|
||||
|
@ -2,6 +2,7 @@ package pw.yumc.MiaoChat.bungee;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -169,6 +170,9 @@ public class FileConfig {
|
||||
public FileConfig(Plugin plugin, String name) {
|
||||
this.file = new File(plugin.getDataFolder(), name);
|
||||
try {
|
||||
if (!file.exists()) {
|
||||
Files.copy(plugin.getResourceAsStream(name), file.toPath());
|
||||
}
|
||||
this.config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file);
|
||||
} catch (IOException e) {
|
||||
Log.w("配置文件读取失败!");
|
||||
|
0
src/main/resources/group.yml
Normal file
0
src/main/resources/group.yml
Normal file
Loading…
Reference in New Issue
Block a user