Solved Changing Prefix via Sign

Discussion in 'Plugin Development' started by EvilTheZ, Jan 10, 2014.

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

    EvilTheZ

    So, i want to make a plugins, what i got is confused.
    I need to make a Self Service Prefix.
    Like in HC server, but i don't know how ?
    Please, help me.
    And if i want to add permissions, where i would place it ?

    All answer will be appreciated, thanks.

    Please do not comment bad content message.
     
  2. Offline

    Krotass

    I do not know much about this but I think you can add a scoreboard team with a prefix? Just an idea

    ofc: set friendly fire to true and stuff :D
     
  3. Offline

    EvilTheZ

    thanks's for the reply, but i need a plugins.
    not a vanilla type.
    but thanks, i appreciated it.

    bump, anyone ?

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

    xBlackLightx

    EvilTheZ You would have to create a listener for a BlockPlaceEvent. Check if the block placed is a sign(remember to check for both wall signs, and sign posts), if it is, the way I would set it up is to check if the first line of the sign is something along the lines of "prefix". if it is, then check the second line (Not sure if the prefix is supposed to fit on only one line or not, so i'll just assume it is). You'll get a string with what they typed. I assume you don't want the sign to stay down, so I would cancel the blockplaceevent by using e.setCancelled(true); Then you're gonna want another listener, this time, an AsyncPlayerChatEvent. You'll do something along the lines of this.

    Code:java
    1. @EventHandler
    2. public void onPlayerChat(AsyncPlayerChatEvent e){
    3. e.setFormat(stringYouUsedForSignSecondLine+ " %s : %s");
    4. ChatColor.translateAlternateColorCodes('&', e.getMessage());
    5. }


    Hopefully this helps. I'm not at my computer, so I didn't test any of this. It's also 5am and I haven't slept so please forgive me for any mistakes.
     
  5. Offline

    EvilTheZ

    xBlackLightx Thanks for your help, it's very usefull, and why don't i think about that method.
    once more, thanks !
     
  6. Offline

    xBlackLightx

    Glad to help. If you have any trouble with it, just let me know, and I'll do my best to help you. Something I just thought of is that is you are using another chat prefix plugin, I highly doubt that this method of doing it will work.
     
  7. Offline

    EvilTheZ

    btw, i will ask you 1 more it seems you're already good in this.
    can you teach me a little about EventHandler, Event, and Listener ?
     
  8. Offline

    xBlackLightx

    Yeah sure. :) Message me, and I'll give you my skype so we don't spam the forums.
     
Thread Status:
Not open for further replies.

Share This Page