Problem getting bungeecord messages to work!

Discussion in 'Spigot Plugin Development' started by MGPro, Dec 21, 2017.

  1. Hello spigot,
    I am trying to make a staffchat. So pretty much i want you to be able to do /sc and it will just be a normal staffchat i have done that. But if you do /sc HCF u will be talking in the staffchat of hcf another server. ALl of this is linked to one bungeecord server. So say i did /sc <any server name> and then press enter then type what i want, it will start sending messages over on that server and i will also be able to reseave messages from that server when they do that same command.
    Any ideas on how i could do this?

    And a little problem that isnt big but i would defo need it. Is how to get the server name on the left of the sc. So like this is what i got so far.

    Code (Text):
            ByteArrayDataInput in = ByteStreams.newDataInput(message);
            String subchannel = in.readUTF();
            if (subchannel.equals("Bungeecord")) {
                String servername = in.readUTF();
               
                  if(Commands.Insc.contains(p)) {
                    e.setCancelled(true);
                   
                        for(Player staff : Bukkit.getServer().getOnlinePlayers()) {
                           
                            if(servername == "Hub") {
                                if(p.hasPermission("staffchat.see")) {
                                    staff.sendMessage(Hub + p.getDisplayName() + ChatColor.translateAlternateColorCodes('&', "&7&o:") + ChatColor.translateAlternateColorCodes('&', " &9") + msg);
                                }
                            }
                            if(servername == "HCF") {
                                if(p.hasPermission("staffchat.see")) {
                                    staff.sendMessage(HCF + p.getDisplayName() + ChatColor.translateAlternateColorCodes('&', "&7&o:") + ChatColor.translateAlternateColorCodes('&', " &9") + msg);
                                }
                            }
                            if(servername == "Practice") {
                                if(p.hasPermission("staffchat.see")) {
                                    staff.sendMessage(Practice + p.getDisplayName() + ChatColor.translateAlternateColorCodes('&', "&7&o:") + ChatColor.translateAlternateColorCodes('&', " &9") + msg);
                                }
                            }
                        }
                  }
            }
    THANK YOU SOO MUCH!
     
  2. Mas

    Mas

    Please take some time to learn java.
    Strings are compared with #equals(), not ==
     
  3. i usually use #equalsIgnoreCase() just in case
     
  4. IV used that and still doesnt work??? any ideas?