Solved Help with this?

Discussion in 'Plugin Development' started by Dllmnd12, Jul 23, 2015.

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

    Dllmnd12

    I need help figuring out what the problem with this is... I'm trying to get it to work so when a player that is Staff or a certain rank types a * before the message it deletes their message then types shows up in chat like this: ADMIN > Message. So the original message would be "*Hey guys I like poo!" but would show up in chat as "ADMIN > Hey guys I like poo!". Thanks.

    Code: http://pastebin.com/Xq6aVKs7
     
  2. Offline

    WinX64

    Here's a list of what you should fix to make it work as you described:

    1) I'm not sure if you forgot to paste, but your event is missing the event handler annotation.
    2) You're checking for the second character on the message, and not the first.
    3) If you want your message to be prefixed with ADMIN and only the message, you should set the format and not the message, this format should work: ADMIN > %2$s
    4) If you want to get rid of that asterisk, get a substring from the original message, starting from the second character and set it as the new message.
     
  3. Offline

    Dllmnd12

    Do you think you could help me out with fixing the 4th problem?
     
  4. Offline

    WinX64

    Try String#substring, it will return a string starting from the point specified by you, starting at 0.
    EDIT: e.getMessage().substring(1), this will return the same text but ignoring the first character.
     
    Last edited: Jul 23, 2015
  5. Offline

    Dllmnd12

    I'm sorry but I am still very confused, do you mind editing that part of the code? @WinX64

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 11, 2016
  6. Offline

    WinX64

  7. Offline

    Dllmnd12

    I think I fixed everything you said but yet it doesn't work... @WinX64

    http://pastebin.com/HCgFmZ3s

    Sorry for all the troubles.
    Whoops I didnt see that reply you just sent.
     
  8. Offline

    WinX64

    You're still checking for the second character of the message:
    [​IMG]
     
Thread Status:
Not open for further replies.

Share This Page