forked from circlecloud/MiaoChat
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;
|
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.config.ServerInfo;
|
||||||
import net.md_5.bungee.api.event.PluginMessageEvent;
|
import net.md_5.bungee.api.event.PluginMessageEvent;
|
||||||
import net.md_5.bungee.api.plugin.Listener;
|
import net.md_5.bungee.api.plugin.Listener;
|
||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
|
import pw.yumc.MiaoChat.bungee.FileConfig;
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
|
|
||||||
public class MiaoChatBungee extends Plugin implements Listener {
|
public class MiaoChatBungee extends Plugin implements Listener {
|
||||||
|
private Map<InetSocketAddress, List<ServerInfo>> group;
|
||||||
|
private FileConfig config;
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void handle(final PluginMessageEvent event) {
|
public void handle(final PluginMessageEvent event) {
|
||||||
if (event.getTag().equals(MiaoMessage.CHANNEL) || event.getTag().equals(MiaoMessage.NORMALCHANNEL)) {
|
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
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
getProxy().registerChannel(MiaoMessage.CHANNEL);
|
getProxy().registerChannel(MiaoMessage.CHANNEL);
|
||||||
|
@ -2,6 +2,7 @@ package pw.yumc.MiaoChat.bungee;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -169,6 +170,9 @@ public class FileConfig {
|
|||||||
public FileConfig(Plugin plugin, String name) {
|
public FileConfig(Plugin plugin, String name) {
|
||||||
this.file = new File(plugin.getDataFolder(), name);
|
this.file = new File(plugin.getDataFolder(), name);
|
||||||
try {
|
try {
|
||||||
|
if (!file.exists()) {
|
||||||
|
Files.copy(plugin.getResourceAsStream(name), file.toPath());
|
||||||
|
}
|
||||||
this.config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file);
|
this.config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(file);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w("配置文件读取失败!");
|
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