ChatColor HashTag plugin problem

Discussion in 'Spigot Plugin Development' started by TheMasteredPanda, May 22, 2016.

  1. Aight,

    so I have made a hashtag plugin that makes anything attached to the hashtag be coloured yellow. But I have ran into a problem, I have set my staff ranks to have automatic chat colors and I want to allow them to speak the same color after they have done #whateverisinhere, how would I achieve that? Pic: http://prntscr.com/b71h79

    Thanks,
    Panda :)
     
  2. What does your current code look like?
     
  3. Maybe use vault API or just hard code with permissions
     
  4. You would hook into your permissions plugin, get their rank and use the colour of their rank. So:

    Code (PHP):

    String rank = "";
    switch(rank) {
        case "admin":
        return ChatColor.RED
    }
     
    EDIT: @BiastGaming has a nice idea. If you have permissions for the chat colors, you can check for those.
     
  5. There are two easy approached you to take to prevent this, one of which Bukkit doesn't support because Bukkit sucks. The other method would be to set the color to the color previously used, this can even be done with some simple regex stuff.
     
  6. https://github.com/StuddedExpandabl...thevoxstudios/chataddons/hashtag/HashTag.java


    Sounds like an interesting idea, have never hooked into PermissionsEx before but I'll sure give it a go.
     
  7. Anyone know where the PermissionsEx Javadoc are? I cannot find it on the webs.