Inactive [CHAT] Simple Prefix v1.4 - Easy prefixes & API (PermissionsBukkit)[1.1-R3]

Discussion in 'Inactive/Unsupported Plugins' started by Flabaliki, Jul 17, 2011.

  1. Offline

    Flabaliki

    JesseG17 and TimboHSV like this.
  2. Offline

    Moon_werewolf

    Nice :D finally a plugin that i don't need a massive chat plugin to use prefixed with permissions
     
    mxguy19 likes this.
  3. Offline

    ichingpow

    Indeed, I would like to replace iChat with this but I want to have the source code so I can change a thing or two.

    Is that possible? Thanks <3
     
  4. Offline

    Flabaliki

    @ichingpow I wouldn't mind releasing the source, I'm just curious as to what you'd like to change.
     
  5. Offline

    ichingpow

    For my server, I would like to simply have "playername:" coloured and no actually prefix except for the invisible &4 or w/e.
     
  6. Offline

    Flabaliki

    @ichingpow If you just want to change their colour, you can, just by entering &4 as the prefix. If you wanted to change the default name display from "<playername>" to "playername:" that would require an edit. I'll add up the source in a little while.
     
  7. Offline

    ichingpow

    And that's why I wanted the source code...
     
  8. Offline

    Flabaliki

    @ichingpow Source is now inside the jar file :)
     
  9. Offline

    Drakia

    This plugin will interfere with any other chat plugins, as well as cause duplicate messages with plugins such as McMMO which operate in the same way for Party/Admin chat, as it doesn't check if the chat event is cancelled, and implements its own broadcast instead of implementing prefixes as it should.

    @Flabaliki Some recommendations:
    Don't suppress deprecation warnings, they're there because there is a better option
    Check to make sure the chat event isn't cancelled before you do anything, with the change I'm suggesting it will no longer show duplicate messages, but it's more efficient.
    Instead of using println, broadcastMessage, and cancelling the event, use:
    Code:
    String dispName = prefix + "&f<" + player.getName() + ">" + suffix + "&f ";
    player.setDisplayName(dispName.replaceAll("(&([a-f0-9]))", "\u00A7$2"))
    which will allow it to work with other plugins that don't cancel the chat event themselves and/or change the chat format, it also replaces the call to chatColours with a regex, which is more efficient.
     
  10. Offline

    Flabaliki

    @Drakia Thanks for the advice, I didn't know about displayname. The only thing that bothered me was that if I use displayname it puts the prefix inside of the <> so it ends up as: <prefix name suffix> rather than: prefix<name>suffix. Any suggestions?

    Also thanks for the little replace code for colours, makes it much easier, I didn't know how to make it any shorter than what it was.
     
  11. Offline

    ichingpow

  12. Offline

    Flabaliki

    @ichingpow Not for me :\. I'll add a direct link, you may just be getting stuck at the click counter.

    EDIT: Added the direct link.
     
  13. Offline

    ichingpow

    @Flabaliki and @Drakia I took the recommendations of you and here is the result, however getGroupPrefix is of course deprecated, do you know an alternative?

    Code:
            public void onPlayerChat(PlayerChatEvent event) {
                String user = event.getPlayer().getName();
                String world = event.getPlayer().getWorld().getName();
                Player player = event.getPlayer();
    
                String[] sArray = permissionHandler.getGroups(world, user);
                String prefix = permissionHandler.getGroupPrefix(world, sArray[0]);
                System.out.println(prefix);
                String dispName = prefix + user + "&f";
                player.setDisplayName(dispName.replaceAll("(&([a-f0-9]))",
                        "\u00A7$2"));
    
            }
        }
     
  14. Offline

    Flabaliki

    @ichingpow You do not need the line: System.out.println(prefix); That was a test line I put in there, forgot to take it out it seams.

    Also, yes, that's why I had the suppress warnings originally, but I took it out. As far as I could see, by looking at the plugin handler java for Permissions there didn't appear to be another way to get prefixes or suffixes. That way works, for now at least.

    Edit: You could also easily omit the user variable. I changed mine to use: Player player = event.getPlayer(); Then just changed the instances of user to player.getName()

    I uploaded my revised version 0.2 which includes the changes I made thanks to Drakia
     
  15. Offline

    xFli3r

    It said failed to find prefix. even though I have it perfectly set up with
    &6[&6Admin&6]&4

    Whats wrong?

    Ohhh is this for the user prefix's?
    I was using group.
    Was that the problem?

    For a future improvement could you make it so the prefix goes to the groups and users?
    That would be awesome!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  16. Offline

    Flabaliki

    @ichingpow I got the up-to-date methods, just replace getGroupPrefix and getGroupSuffix with getGroupRawPrefix and getGroupRawSuffix.

    @xFli3r I've updated the plugin, it will now get a users prefix, though, this will override any group prefixes they have. For more info, just read the short description in the post :)
     
  17. Offline

    asterious

    Thx for plugin, its rly simple plugin, that i wanted.
     
  18. Offline

    Redsox4life247

    Thank you so much! Gonna test it out now to see if it works but based on the comments i think it will....NO MORE YAML! well not really but i dont have to go into it as much!

    sry wrong plug

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  19. Offline

    Gilatar

    I don't understand how to use this. I'm using the "PermissionsBukkit" plugin, and am I supposed to do something in the configuration files there to enable this or what?
     
  20. Offline

    Flabaliki

    @Gilatar Currently this only works with the Permissions plugin, as stated in the thread. In the future I will add support for the bukkit permissions system.

    EDIT: @Gilatar I've update the plugin today, basically, it's very different to how it was before. It uses PermissionsBukkit to operate now, and has a config file where you set your prefixes and suffixes. Just check out the thread above which explains it all :)
     
  21. Offline

    Gilatar

    Thank you so much, this really makes it much easier! Much appreciated :D

    I'm still having problems but it just shows that I'm really dumb. I can't get the "Admin" prefix to show up, no matter what I do..
    Here's the permissions file:

    EDIT: Nvm, I got it >_>

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 17, 2016
  22. Offline

    Flabaliki

    @Gilatar What was the problem out of curiosity? Was it just a typo or something? Anything I can make better?
     
  23. Offline

    Gilatar

    @Flabaliki Just a problem on my end. I messed up the config file by removing a group that I was in so I guess that was the problem. I'm really clumsy when it comes to things like this.. :oops:
     
  24. Offline

    iwasnumber4

    How Do i do this? ik it seems simple but idk wut to do Lol
     
  25. Offline

    Flabaliki

    @iwasnumber4 Firstly, just chuck the simpleprefix.jar into your plugins folder and start the server, then stop it again (or leave it running, doesn't particularly matter). Then go to your plugins folder and open up the /Simple Prefix/config.yml in there, by default you will see 3 groups, you can add as many more as you want, whatever you wish to call them. Just place your prefixes / suffixes inside of the '' then just save the file.

    Now, this is the part that includes permissions, I'd recommended using PermissionsBukkit as said in the post. The permissions nodes for the prefixes are very, very simple. If you called your group PurpleMonkeys the permissions node for it would be simpleprefix.PurpleMonkeys and then, whichever group or user has that permission will get that prefix.
     
    iwasnumber4 likes this.
  26. Offline

    svennp

  27. Offline

    Flabaliki

    @svennp Is that Permissions 3.x or 2.x? If so, this only works with superperm based plugins like PermissionsBukkit
     
  28. Offline

    svennp

    its Permissions 3.x
     
  29. Offline

    Flabaliki

    @svennp SimplePrefix[Permissions_3.x].jar Try this. It's an older version that uses Permissions 3.x. Please note, that you set the prefixes inside of your Permissions yml file, not the simpleprefix one.
     
  30. Offline

    svennp

    it works, but it removes the nicknames and i cant have coloured name, just the prefix
    and the editing method is alot better
     

Share This Page