Messagers

Discussion in 'Plugin Development' started by JJSfluffyduck, Oct 4, 2012.

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

    JJSfluffyduck

    I am Planing on making a plugin that when write /pm <user><message>
    how would i store what the player writes in for the message?
     
  2. Offline

    ZeusAllMighty11

    Store it as a String, save that to a hashmap with the player name. Save it to an external file, and load it up onEnable()
     
  3. Offline

    JJSfluffyduck

    but how do i just get the message so i can store it?
     
  4. Offline

    MrFigg

    Assuming args has at least 2 strings and args[0] is the players name you can use this;
    Code:
    String message = "";
    for(int i = 1; i < args.length; i++) {
        message = message + " " + args[i];
    }
    message = message.trim();
     
  5. Offline

    JJSfluffyduck

    whats the .trim();?
     
  6. Offline

    MrFigg

    .trim() gets rid of white space (spaces) on the front and back of the string. Without it you would have an extra space at the beginning of the message.
     
  7. Offline

    JJSfluffyduck

    ok thanks
     
Thread Status:
Not open for further replies.

Share This Page