fix: bungee servers forEach error
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
b477938e4f
commit
fad4e27a7f
@ -14,6 +14,8 @@ const GZIPOutputStream = Java.type("java.util.zip.GZIPOutputStream");
|
|||||||
const Consumer = Java.type("java.util.function.Consumer");
|
const Consumer = Java.type("java.util.function.Consumer");
|
||||||
const ByteArray = Java.type("byte[]")
|
const ByteArray = Java.type("byte[]")
|
||||||
|
|
||||||
|
const BiConsumer = Java.type('java.util.function.BiConsumer')
|
||||||
|
|
||||||
class MiaoMessage {
|
class MiaoMessage {
|
||||||
// public static final String CHANNEL = "MiaoChat:Default".toLowerCase();
|
// public static final String CHANNEL = "MiaoChat:Default".toLowerCase();
|
||||||
public static CHANNEL: string = "MiaoChat:Default".toLowerCase()
|
public static CHANNEL: string = "MiaoChat:Default".toLowerCase()
|
||||||
@ -287,11 +289,13 @@ export class MiaoChat extends interfaces.Plugin {
|
|||||||
let event = e as net.md_5.bungee.api.event.PluginMessageEvent
|
let event = e as net.md_5.bungee.api.event.PluginMessageEvent
|
||||||
if (event.getTag() == MiaoMessage.CHANNEL || event.getTag() == MiaoMessage.NORMAL_CHANNEL) {
|
if (event.getTag() == MiaoMessage.CHANNEL || event.getTag() == MiaoMessage.NORMAL_CHANNEL) {
|
||||||
let origin = event.getSender().getAddress();
|
let origin = event.getSender().getAddress();
|
||||||
bungee.getServers().forEach(server => {
|
bungee.getServers().forEach(new BiConsumer({
|
||||||
if (server.getAddress() != origin && server.getPlayers().size() > 0) {
|
accept: (s, server) => {
|
||||||
server.sendData(event.getTag(), event.getData())
|
if (server.getAddress() != origin && server.getPlayers().size() > 0) {
|
||||||
|
server.sendData(event.getTag(), event.getData())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user