Code Help (I'm a begginer at java coding)

Discussion in 'Plugin Development' started by Sw_aG, Sep 26, 2014.

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

    Sw_aG

    Hi, i need some help making a chat plugin using economy, but i dont know how to make it so it will display The player's money before his name.

    Plugin version: 1.7.2 R3

    Like that:
    (15689) Sw_aG: Hi every1 : P

    Thanks in advance ;)
     
  2. Offline

    timtower Administrator Administrator Moderator

    Sw_aG ChatLikeMe is able to do this. And if this is for developing help, requested a move to plugin development.
    Well, it is moved ( quick btw )
    You need to listen to the asynchchatevent and set the format there.
     
    Sw_aG likes this.
  3. Offline

    Sw_aG

    ChatLikeMe is good, but i that every player who have specific permissions that his chat will look diffrent:

    (15689) Sw_aG: Hi every1 : P
    (276) shay2315: hi Sw_aG : D



    The blue for normal player, red for owner (OP's) green for VIP's and pink for moderators.

    Owner: (15689) Sw_aG: Hi every1 : P
    VIP: (15689) gal_Zoaretz: Hi every1 : P
    Default Player: (276) shay2315: hi Sw_aG : D
    Moderator: (15689) HoodooLP: Hi every1 : P


    Owner Permission: chateco.owner
    VIP Permission: chateco.vip
    Default Player Permission: chateco.player
    Moderator Permission: chateco.mod

    Do you think there's a way to make something like that with ChatLikeMe?

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

    timtower Administrator Administrator Moderator

    Yep, uploaded a new version yesterday that can do that. Works with permissions.
     
  5. Offline

    Sw_aG

    Awesome :D
    I'll try it right now!
    Thanks mate

    Is there any tutorial for how to make perfixes?
    Or if you can show me how to create those that'll be great!
    Thanks

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

    timtower Administrator Administrator Moderator

    There is a full readme file.....
     
  7. Offline

    Sw_aG

    Where?
     
  8. Offline

    timtower Administrator Administrator Moderator

    There should be one next to the config file.
     
  9. Offline

    Sw_aG

    Its not generating a readme file...

    Can you please just send me an edited file with the permissions and things?
    Thanks in advance ;)
     
  10. Offline

    timtower Administrator Administrator Moderator

    Which version do you have? And might have forgot to add the copy part.
    Open the jar with winzip or similar, extract the readme.html by hand.
     
  11. Offline

    Sw_aG

    1.7.2 R3

    I'm sorry, but i dont realy understood how to make it into diffrent teams with diffrent color codes.

    Can you please edit the file for me?

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

    timtower Administrator Administrator Moderator

    You just set a format for a certain permission node. Go to the configuration page and ask there.
    Was talking about the plugin version.
    Also please post your server log. Might have some issues with copying the file.
     
  13. Offline

    XgXXSnipz

    Sw_aG Sw_aG Wait, I thought you were coding this, are you not going to and just use ChatLikeMe?
     
  14. Offline

    Awesomedanguy

    Why not change the format on the AsyncPlayerChatEvent ?
     
  15. Offline

    Peter25715



    Here, take a look.
    Hello Sw_aG, you can just put an event called AsyncPlayerChatEvent. This event is made for getting any message, Replacing any message, CANCELLING any message or cancel messages from specified players.
    Here's the code that explains what to do with that event ;
    Code:java
    1. @EventHandler
    2. public void onChat(AsyncPlayerChatEvent e) {
    3. e.setFormat(ChatColor.AQUA + "Whatever you want.");
    4. }


    WARNING! When you use the event.setFormat(); you should put the correct info over there, I mean if you do this :
    event.setFormat(ChatColor.AQUA + player.getName());
    it will be like this : Sw_aG and your message.

    but if you want the player name and the rank it should be like this :
    event.setFormat(ChatColor.WhatColorUWant + event.getPlayer().getDisplayName());
    event.getDisplayName is Event gets your full name in the server itself not in the game, So [Owner] Yourname.

    So you can edit it using economy and yea!
    Thanks for reading, Hope I helped you and if you got a problem just PM me or reply on this thread.
     
    Sw_aG likes this.
Thread Status:
Not open for further replies.

Share This Page