Color wool.

Discussion in 'Plugin Development' started by Tamir, Apr 24, 2015.

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

    Tamir

    EDIT: Think I figured out whats the problem, didn't check the event block *faceplam*, Ill try to fix it, meanwhile, other question anyone?
    EDIT 2: I Fixed it, I guess I just need help on the other question:
    how do I split messages from PlayerChatEvent for word after word?
     
    Last edited: Apr 24, 2015
  2. Offline

    mine-care

    @Tamir What have you tried so far?
    the structure is:
    A loop running through the word array from the message (See String class documentation for more)
     
  3. Offline

    Tamir

    @mine-care Let me see if I got you, Basically, getting every single array in the ChatEvent?
     
  4. Offline

    mine-care

    @Tamir
    Each time the event runns, loop through the words in the message string (see String#split(String regex);)
    and if the word matches whatever ypi want do any action :p
     
  5. Offline

    Tamir

    @mine-care Okay, learned a bit about splits, I have a string and its splited into it. but it got me only one string?
     
  6. Offline

    mine-care

    @Tamir are you spliting spaces? can i see your code so far?
     
  7. Offline

    Tamir

    @mine-care Sure, and yea.
    Code:
    String cg = getConfig().getString(p.getName());
    for(String split : cg.split("  ")){
    p.sendMessage(split);
    }
    I want every word in a different color
     
  8. Offline

    mine-care

    Err you are spliting 2 spaces :/ (" ") instead of (" ") KaBoom! Now it should split spaces just fine :- )
     
  9. Offline

    Tamir

    @mine-care
    I know that, But its not my problem, I fixed it to one.
    You dont get it, I want to get any word in the spaces
    I want the chat to come out like this:
    This is how its supposed to be
     
  10. Offline

    mine-care

    So you want it to follow the zig zag patern; it is a matter of loop enchancement use a boolean turning true/false in every run of the loop if it is true get the word and add it to a string builder else do nothing but changing the Boolean to true :- ) Ik it sounds complex but asap I'll send an example sudo code
     
Thread Status:
Not open for further replies.

Share This Page