Name highlighter

Discussion in 'Plugin Requests' started by tspierer2, May 13, 2016.

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

    tspierer2

    Plugin category: Chat

    Suggested name: ChatNames

    What I want: I want a plugin which when someone says your username in chat, your name would be highlighted in a different color on your screen and will play a noteblock sound or something.
    There is one other plugin that I found that does this but it is extremely outdated and doesn't work.


    CONFIG:

    format of spoken name: &d&l@%name%&r
    play sound: true


    (a nice bonus, not needed if too hard to code) Amount of letters before highlight: 4 (This will highlight the name of the player if at least amount letters of his username is said. For example if a username is xXslayerXx
    then if his name is spoken as xXsl or more of his letters, then it will highlight for him. However less than 4 letters, there would be no highlight.)


    -------------
    Example of result: [Player]Notch: yo @XxSlayerxX you there? (The name was supposed to be pink but bukkit forums changed it to blue)

    Ideas for commands: /chatname reload

    Ideas for permissions:
    chat.recieve - player will see his username highlighted if has this perm
    chat.sound - player will hear the sound if name is spoken


    Thank you very much! Take your time if you are making this plugin, I am in no rush for this.

    If you have any questions about what I am trying to get at, let me know and I will do my best to explain differently.

    Also my server version is:
    Spigot 1.8.3
     
    Last edited: May 13, 2016
  2. You do realize that for this, youd need to assume EVERY part of a sentence that is more that 4 words is a name, check EVERY word to the beginning of EVERY player on the server.
     
  3. Offline

    I Al Istannen

    @Link_Awesomesause
    Which really isn't that much. Depending on what he really wants, checking every word starting with a @ would be enough. Apart from that the event is async, so you shouldn't really notice any lag on the server itself.


    @tspierer2
    Do you use any plugins that change the chat format?
    Must the user write @ or a prefix before the name to tahg/tag the player? Or does it work if I write
    "Hey XxSlayerxX how are you?"
    Should the @ symbol be added before the player name.

    Now, this is borderline random tagging, but I think I remember @DoggyCode™ making a plugin that does this. So just summoning him. If he did, there is no need to do it again.
     
  4. Offline

    DoggyCode™

    No worries ;) and you're correct. However I'm not sure if I'd suggest making one unless it's for a custom core or some stuff as the compatability with other plugins if you wanna release it for free/paid is pure hell.

    I managed to make it compatible with factions, but it's not easy and very efficient I'd say

    Sent from my SM-N9005 using Tapatalk

    EDIT:
    This is Plugin Request and not Plugin Development lol. Anyways. Yeah. I made it custom for somebody with no permission to give it out :( .

    EDIT2:
    But unless you have any other plugin formatting the chat (as @I Al said it wouldn't be hard to make.
     
    Last edited: May 14, 2016
  5. Offline

    tspierer2

    No I don't need the @ thing.
    It was just to preview the formatting.
    You will type: "Hey XxSlayerxX how are you?" and it will come out as "Hey XxSlayerxX how are you?" on Slayer's screen with a @ infront of the name. (I don't really want the @, it was just to help understand how the formatting in the config will work.)

    Also I don't mind if you exclude the 4 letter thingy. It would be a nice little addition though.
     
  6. Offline

    I Al Istannen

    @tspierer2
    You still haven't answered one of the most important questions:
    And additonally, what do they change?

    You could also try tahgging people by writing "@<name>" or clicking the "Tahg User" button on the bottom right of every post. This way they will be alerted of your post.
     
  7. Offline

    tspierer2

    I don't understand what you're talking about.

    Also I have essentials chat, and its formatted
     
    Last edited: May 15, 2016
  8. Offline

    I Al Istannen

    @tspierer2
    Ok. Let's try to explain it with a bit more detail.
    In Bukkit there is a ChatEvent which gets called when a User chats. The message then gets send to everybody on a List, normally everyone on the server. In this event, you can change the list though, which means you can exclude players from getting the message. This is needed, if you want to send ONE player a different message, e.g. their name colored. You don't want the name to be colored for everybody, do you?

    So now we have removed the Player from the list, which means he won't get ANY message. That is also quite bad, isn't it. To counter that we will need to send the message ourselves. And this is how the problem starts.

    Consider having a Plugin, that adds a Prefix to the Player's name. You will need to grab this Prefix and append it to the message you send. So far so good. If the Plugin adding the prefix is nice, there will be no problem.
    But now things can get trickier.

    Consider Factions. With EssentialsChat, you can color the prefix depending on the player's relation with the other faction. This is also on a per player basis, meaning Essentials does the same: Removing the player from the List and then sending it's own message. But since Essentials decides the format when it sends the message, WE have no idea of how it will look like. This means we CAN'T reproduce the exat same format, leading to placeholders being not replaced or colors being wrong.

    There are two ways I am aware of to counter that. The first is intercepting the outgoing packet from the server and changing it there, which is not exactly a really good choice. The other way (Thanks @DoggyCode™ ;)) would involve you knowing exactly what plugins and placeholders you use. If you know that, you can change the placeholders and colors yourself. This is the choice I would use, as it is mostly version independent and doesn't require listening to packets which might change in the future.

    TL;DR: How does your chat look like? What placeholders do you use in Essentials? From what Plugin do these placeholders come from? If you haven't read the wall of text above, just note that it is important to know the answer to these questions.
     
    DoggyCode™ likes this.
  9. Offline

    tspierer2

    Okay. I did not realize it was this complicated. I am giving up on this plugin -moderator fill-
     
  10. Offline

    I Al Istannen

    @tspierer2
    Its not that complicated, old boy :p Depending on what you use, it can be done in a few minutes. I would say, the devolper (which might be me :)), can tell you that. I would just really linke you to answer the questions in the tldr. Have a nice nicht (or whereever you live) ;)
     
    Last edited: May 20, 2016
Thread Status:
Not open for further replies.

Share This Page