Bungeecord Staff chat {ASAP}

Discussion in 'Plugin Development' started by WingedMLGPro, Apr 6, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    WingedMLGPro

    Hey everyone!
    I am trying to make a StaffChat plugin that uses BungeeCord!
    But i cant seem to get it right!
    Here is my code:
    Code:
    @EventHandler
        public void onPlayerChat(AsyncPlayerChatEvent e) {
            Player p = e.getPlayer();
            String msg = e.getMessage();
            if (msg.startsWith("@")) {
                msg = msg.replaceFirst("@", "");
                if (p.hasPermission("swifty.mod")){
                    e.setCancelled(true);
                    for (Player a : Bukkit.getServer().getOnlinePlayers()){
                        if (a.hasPermission("swifty.mod")) {
                            ByteArrayOutputStream b = new ByteArrayOutputStream();
                            DataOutputStream out = new DataOutputStream(b);
                            String data = "§o§l[§a§lSTAFF§o§l]§b"+p.getDisplayName()+"§8: §6"+msg;
                            try {
                                out.writeUTF("Forward");
                                out.writeUTF("ALL");
                                out.writeUTF("SwiftyPVP");
                                out.writeShort(data.length());
                                out.writeUTF(data);
                            } catch (IOException ex){
                            }
                            a.sendPluginMessage(TheMain.getInstance(), "BungeeCord", b.toByteArray());
                        }
                    }
                }
            }
        }
    So if u know plz help!
    Thanks.
    WingedMLGPro
     
  2. Offline

    ZeldoKavira

    We don't support Bungee.
     
    dlange likes this.
Thread Status:
Not open for further replies.

Share This Page