Skip to content

Commit dce50c3

Browse files
committed
added adminmessages Bungee Support
1 parent 041ca83 commit dce50c3

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/co/proxa/founddiamonds/handlers/AdminMessageHandler.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.google.common.io.ByteStreams;
1010

1111
import co.proxa.founddiamonds.FoundDiamonds;
12+
import co.proxa.founddiamonds.file.Config;
1213
import co.proxa.founddiamonds.util.Format;
1314
import co.proxa.founddiamonds.util.Prefix;
1415

@@ -40,7 +41,23 @@ public void sendAdminMessage(final Material mat, final int blockTotal, final Pla
4041
receivedAdminMessage.add(y.getName());
4142
}
4243
}
43-
}
44+
}
45+
if(fd.getConfig().getBoolean(Config.useBungeeCord)){
46+
List<String> bungeeadmins = (List<String>) fd.getConfig().getList(Config.BungeeCordAdminList);
47+
if(bungeeadmins.size() > 0){
48+
for(String admin : bungeeadmins){
49+
if(Bukkit.getPlayer(admin) == null){
50+
ByteArrayDataOutput out = ByteStreams.newDataOutput();
51+
out.writeUTF("Message");
52+
out.writeUTF(admin);
53+
out.writeUTF(adminMessage);
54+
Bukkit.getServer().sendPluginMessage(fd, "BungeeCord", out.toByteArray());
55+
}
56+
}
57+
}else{
58+
System.out.println("[ERROR] Founddiamonds: Bungeecordsupport is enabled but no admins are defined. Can't send infos!");
59+
}
60+
}
4461
}
4562

4663
public void clearReceivedAdminMessage() {

0 commit comments

Comments
 (0)