Hi, I'm working on a plugin that is not BungeeCord, but I want to add the following options to plug in config.yml: Code (Text): BungeeCord: enable: true // enable BungeeCord AnnounceServers: true // send an broadcastMessage on other servers serverLobby 'survival' // Server on the ad message: 'The Tournament is open in <server>' // message in the announcement on other servers I want to know if anyone knows how to do this Use this code it does not work me and gives me no errors: Code (Text): ByteArrayOutputStream b = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(b); try { out.writeUTF("Forward"); out.writeUTF("ALL"); } catch (IOException e) { } ByteArrayOutputStream msgbytes = new ByteArrayOutputStream(); DataOutputStream msgout = new DataOutputStream(msgbytes); try { msgout.writeUTF(instance.getConfig().getString("settings.PrefixMessages") + "Torunament Open In Server " + server.replaceAll("&", "§")); } catch (IOException e) { } this is the onEnable: Code (Text): @SuppressWarnings("unchecked") @Override public void onEnable() { instance = this; File configFile = new File(getDataFolder(), "config.yml"); if (!configFile.exists()) { saveDefaultConfig(); } getServer().getPluginManager().registerEvents(new TListener(), this); getCommand("tournament").setExecutor(new TCommand()); if (getConfig().get("save.mysaveditems") != null) { for(String key : getConfig().getConfigurationSection("save.mysaveditems.").getKeys(false)) { ItemStack[] value = ((List<ItemStack>) getConfig().get("save.mysaveditems." + key)).toArray(new ItemStack[0]); mySavedItems.put(key, value); } } if (instance.getConfig().getBoolean("settings.AutoRun.enable") == true) { Bukkit.getLogger().info("[TournamentPvP] AutoRun is Enable"); int players = instance.getConfig().getInt("settings.AutoRun.players"); instance.place = players; BukkitScheduler scheduler = Bukkit.getServer().getScheduler(); scheduler.scheduleSyncRepeatingTask(this, new Runnable() { @Override public void run() { int players = instance.getConfig().getInt("settings.AutoRun.players"); if (!instance.start && !instance.open) { String kit = instance.getConfig().getString("settings.AutoRun.kit"); if (instance.getConfig().contains("location1") || instance.getConfig().contains("location2")) { if (instance.getConfig().contains("kits." + kit)) { instance.open = true; instance.kit = kit; instance.place = players; if (instance.getConfig().getBoolean("settings.BungeCord.enable") == true) { Bukkit.getLogger().info("[TournamentPvP] BungeeCord is Enable"); String server = instance.getConfig().getString("settings.BungeeCord.ServerTournament"); if (instance.getConfig().getBoolean("settings.BungeeCord.SendMessageServers") == true) { ByteArrayOutputStream b = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(b); try { out.writeUTF("Forward"); out.writeUTF("ALL"); } catch (IOException e) { } ByteArrayOutputStream msgbytes = new ByteArrayOutputStream(); DataOutputStream msgout = new DataOutputStream(msgbytes); try { msgout.writeUTF(instance.getConfig().getString("settings.PrefixMessages") + "Torunament Open In Server " + server.replaceAll("&", "§")); } catch (IOException e) { } } } else { String announce = instance.getConfig().getString("messages.announce").replace("<playerleft>", String.valueOf(0)).replace("<playermax>", String.valueOf(players)).replace("<kit>", kit).replaceAll("&", "§"); Bukkit.getServer().broadcastMessage(instance.getConfig().getString("setting.PrefixMessages") + announce.replaceAll("&", "§")); } } else { Bukkit.getServer().broadcastMessage(instance.getConfig().getString("messages.NonExistentKit").replace("<kit>", kit).replaceAll("&", "§")); } } else { Bukkit.getServer().broadcastMessage(instance.getConfig().getString("messages.NonExistentSpawn").replaceAll("&", "§")); } } } }, getConfig().getInt("settings.AutoRun.time")*20L, getConfig().getInt("settings.AutoRun.time")*20L); } else { Bukkit.getLogger().info("[TournamentPvP] AutoRun is Disable"); } getConfig().set("save", null); saveConfig(); }
Bukkit -> MySQL -> Bukkit2 Plugin for Bukkit & Bukkit2, to handle the broadcast i dont known if bungeecord has a method to handle a broadcast via plugin messaging, if not, you will need to create a bungee plugin to handle the broadcast.