Bungee - Proxy NetChat 1.1.1.1.1.1.1

Cross server chat for multiple uses.

  1. CustomForms

    CustomForms Retired Moderator
    Retired Supporter

    nhadobas submitted a new resource:

    NetChat - Cross server chat for multiple uses.

    Read more about this resource...
     
  2. That permission can go on the bukkit servers?
     
  3. CustomForms

    CustomForms Retired Moderator
    Retired Supporter

    No, this is a Bungee plugin so the permissions are held at the Bungee level.
     
  4. Can you make customizable messages string example
    &4[&9%server&4] %player: %message
     
  5. CustomForms

    CustomForms Retired Moderator
    Retired Supporter

    It's a possibility.
     
  6. +1
    That would allow me to definitely use this plugin. Also, does this queue messages ?
     
    • Agree Agree x 1
  7. CustomForms

    CustomForms Retired Moderator
    Retired Supporter

    No, its just a super simple cross server chat.
     
  8. Please, make a config and allow us to always have the global chat on by default. And customize the chat string
     
    • Agree Agree x 1
  9. CustomForms

    CustomForms Retired Moderator
    Retired Supporter

    Dont count on me adding that. Busy and barely know Java.
     
  10. joehot200

    Supporter

    :confused:

    Reading from a file:
    public static String readFileAsString(String filePath)
    throws java.io.IOException{
    StringBuffer fileData = new StringBuffer(1000);
    BufferedReader reader = new BufferedReader(
    new FileReader(filePath));
    char[] buf = new char[1024];
    int numRead=0;
    while((numRead=reader.read(buf)) != -1){
    String readData = String.valueOf(buf, 0, numRead);
    fileData.append(readData);
    buf = new char[1024];
    }
    reader.close();
    return fileData.toString().replace("?", ""); //Fixes an error where it outputs a ? at the end of the file
    }
    So that would be used like:
    Code (Text):

    String getConfig = readFileAsString("path/to/file");
     
    Writing to/creating the file (If the file does not exist already it will automatically create one)
    //THIS WAS FOR PER-PLAYER MOTD IDENTIFYING. Replace things like "player" with your own string
    try {
    File file = new File("/home/craftbukkitserver1/lib" + ev.getConnection().getAddress().getAddress().toString().trim());
    file.delete();

    PrintWriter out = new PrintWriter("/home/craftbukkitserver1/lib" + ev.getConnection().getAddress().getAddress().toString().trim());


    out.println(player);
    out.close();
    //FileUtils.writeStringToFile(new File("/home/craftbukkitserver1/lib" + ev.getConnection().getAddress().getAddress().toString().trim()), "Hello File");
    } catch (IOException e) {
    System.out.println("----------- Cant write to file! -----------");
    e.printStackTrace();
    System.out.println("----------- Cant write to file! -----------");
    }

    Edit: Getting the plugins folder:
    Code (Text):

    [FONT=Consolas]File f = new File(Bukkit.getWorldContainer().getAbsolutePath() + "\\plugins")[/FONT]
     
    Taken from SasukeGabe from this comment.
     
    #10 joehot200, Sep 13, 2013
    Last edited: Sep 13, 2013
  11. For now, I am just going to modify the code making it look like I wanted it to look like.
     
    • Like Like x 1
  12. Can you change how the prefix looks, how do you change things on it
     
  13. CustomForms

    CustomForms Retired Moderator
    Retired Supporter

    You currently cannot change the look of it. Because of school, sports, work, and extracurricular activities my time to work on this is slim.
     
  14. Ok Thanks,will there be an update when you can??
     
    • Optimistic Optimistic x 1
  15. CustomForms

    CustomForms Retired Moderator
    Retired Supporter

    Ya, I plan on adding a few new feature and customize-able aspects.
     
  16. xD i tried to edit the files and ended up just making making the plugin not work (I’m a bit of a noob at programing java)
     
  17. joehot200

    Supporter

    Hi, modified the code to make it so it only sends players messages if they are on a different server with the following code:

    Code (Java):

    @EventHandler
      public void onPlayerChat(ChatEvent e)
      {
     if (e.getMessage().startsWith("/")) return;
        if ((e.getSender() instanceof ProxiedPlayer)) {
          ProxiedPlayer s = (ProxiedPlayer)e.getSender();
         
            for (ProxiedPlayer pl : this.pasta.getProxy().getPlayers()){
           // s.sendMessage("Your server: " + s.getServer().getInfo().getName() + ", " + pl.getName() + "'s server: " + pl.getServer().getInfo().getName() + "");
           if (!s.getServer().getInfo().getName().startsWith(pl.getServer().getInfo().getName())){
           pl.sendMessage(ChatColor.DARK_RED + "[" + ChatColor.BLUE + s.getServer().getInfo().getName() +  " Server" + ChatColor.DARK_RED + "]" + ChatColor.GOLD + s.getName() + ChatColor.RED + ": " + e.getMessage());
           
              }
            }
           
          }
         
        }
     
    I changed nothing else.

    Is it OK if i use that modified version for my server?
    (Also when i get round to it ill send you some AntiSpam code as well to make it block spammers)
     
  18. CustomForms

    CustomForms Retired Moderator
    Retired Supporter

    Doesn't bother me.
     
  19. joehot200

    Supporter

    :D Brilliant! Cross-server chat for me! Woohoo! *Happy mode*

    Oh and if you know how to set delayed tasks for bungee i have got some code that will block message repetition for you.
     
    #19 joehot200, Sep 28, 2013
    Last edited: Sep 28, 2013
  20. CustomForms

    CustomForms Retired Moderator
    Retired Supporter

    I may take you up on that later on when I have some free time to work on this plugin more. Real life has been nipping me in the bum lately.