NoPermsMessage

Discussion in 'Archived: Plugin Requests' started by Zahachos, Apr 15, 2014.

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

    Zahachos

    Plugin category: Admin

    Suggested name: NoPermsMessage (NPS)

    What I want: I would like a plugin that gives the same message every time you type a command of which you don't have the permission to use. The plugin would just replace that message with a global message (color supported) telling you whatever you set in the config. (Instead of a different message for the various different plugins).

    Ideas for commands:
    /nps <--- See the current noperms message.
    /setnps [MessageWithColorSupport] <--- Set the nps message.

    Ideas for permissions:
    nps.see <--- Use the /nps command.
    nps.set <--- Use the /setnps command.

    When I'd like it by: When someone can do it.
     
  2. Online

    timtower Moderator Moderator

    Zahach We can't change this. This is located in the plugin.ynl or hardcoded in the source of the plugin.
    The only way to do this is by listing every command with the permission node behind it, then you can check it before another plugin sees it.
     
  3. Offline

    Zahachos

    timtower And how would you do that?
     
  4. Offline

    Empire92

  5. Online

    timtower Moderator Moderator

    Did that before, not easy to get the right packet.
    And why would you get the packet if you can do stuff that isn't nms?
     
  6. Offline

    Zahachos

  7. Offline

    Empire92

    Well, the problem is that there is no centralized method allowing you to change the method.
    You can either get all the commands that have a registered permission (and not all do) and check if you have that before the plugin does...

    Or you can modify any packet that has something like "You don't have permission for..." but some plugins have their own message.

    What I would suggest is a config file which contains all the sentences you would like replaced with your global "No Perm" message.
     
  8. Online

    timtower Moderator Moderator

    Empire92 PlayerPreCommand get the command with the node listed in the config, if they don't have the perm, then show the new message
     
  9. Offline

    Empire92

  10. Offline

    Zahachos

    Empire92 Testing it now.

    Empire92 Unfortunately... it doesn't work. :/

    Empire92 Or I just don't know how to use it.

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

    Garris0n

    This assumes the plugin properly registers the permission to the command, which is not always the case. Sometimes it's not even bad practice, such as in the case of sub-commands where it's impossible to register a permission via the plugin.yml. The best you could do is to create a config where the user has to list every command on the server (in a string form with the sub command, for example '/ncp info') along with its permission and then the plugin can check against that. Sounds like a huge pain, and would probably be abused to trick users into thinking the server is running custom plugins ("[ServerAntiCheatVClipBanMcMMO] Sorry you can't use that command on our custom server because it's custom coded and custom.").
     
  12. Online

    timtower Moderator Moderator

    Garris0n Don't need to be registred. And we are not responsible for usage right?
     
  13. Offline

    Garris0n

    I suppose not, I would just imagine that's how it would end up. Listing every single command (and editing the list every time you add a plugin) sounds annoying, though. Doesn't seem like anybody would end up using it.
     
  14. Offline

    Zahachos

  15. Online

    timtower Moderator Moderator

    Zahach https://www.dropbox.com/s/kpdes5etqbvr775/NoPermsMessage.jar
    Message supports color codes. There won't be a reload command, edit the config when the server is not running.
    Example config:
    Code:
    Message: '&5You dont have permission for this command'
    Commands:
      help: 'bukkit.commands.help'
      stop: 'bukkit.commands.stop'
    This will give custom messages for the commands /help and /stop but only if the player doesn't has the permission nodes behind it.
    And yes, you need to list every command.
    Sub commands are also supported, the plugin will take the command that looks the most like one in the config
     
  16. Offline

    Zahachos

    timtower hmm... Who can do it for me? I don't really have the time to list every single one... Either somebody is nice enough to do it for me (which I don't think anybody would want to do it) or I won't use the plugin :/ sorry. I have 55 plugins on my server and its a huge amount to handle. But thanks for helping me out!
     
  17. Online

    timtower Moderator Moderator

    Never said that it would be fun to setup.
    Zahach redownload the original file. It now gets as many commands as it can get with the required permission nodes if it can find them
    https://www.dropbox.com/s/up0qc76r5v5x6bx/CommandGetter.jar
    That plugin will list all known commands when you perform /CommandGetter, perm for that is commandgetter.use
    It will output all known commands and permission nodes in a html file.
    Best you will get

    And having it check every command is impossible without setting things yourself, nobody has the time to list 55 plugins for somebody they don't know
     
  18. Offline

    Zahachos

    Last edited by a moderator: Jun 7, 2016
  19. Offline

    Empire92

    Zahach My plugin works fine.
    What you want to do is add any messages that you want replaced with the no perm message to the config.
    You will see "example message one" and "example message two" are already added there.
    any instances of these messages will be replaced by the global message.
    The commands and permissions you requested above work:
    /nps - views the current no perm message
    /setnps - sets the no perm message
    /nps reload

    If you have 55 plugins on your server, then it's likely that there are up to a thousand permissions...
     
  20. Online

    timtower Moderator Moderator

    Zahach Spigot is not supported here
     
  21. Offline

    Zahachos

    timtower So... is it because of spigot?

    Empire92 OHH!! I didn't know how to use it x) could you add a command to add the messages you want to change, so that you can do it in-game? like /npsadd [message]
    and are the messages to be inputed case-sensitive? and how does it work if the message is in, say darkred? do I add the color code at the beginning? or leave the sentence without it?
    Sorry so much questions :/

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

    Empire92

  23. Offline

    Zahachos

    Empire92 I edited my message look again :p
     
  24. Online

    timtower Moderator Moderator

    No, spigot is just not supported on bukkit
     
  25. Offline

    Zahachos

    timtower Ok i'll go back to bukkit then... I just find it easier to use this forum than the spigot** forum..
    And I normally use bukkit, but it's just for the 1.7.8. When bukkit releases a beta 1.7.8 I'll move on to that.

    Empire92 <index> is the message? And look back at my other post I added questions.

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

    Empire92

  27. Offline

    Zahachos

    Empire92 Perfect! Thanks! I'm trying it out now. ;)

    Empire92 Doesn't work... Well it does but I can't add a message:
    when I use /addnps it doesn't say anything (probably that you didn't add a sender.sendMessage("Nps added!")
    but thats not the problem. The problem is that after I use the addnps [message] and I use /nps to see if it added it... well, it doesn't :/ it shows me:
    MESSAGES: <--- nothing show up here... but I did adda msg... I don't understand :/
    GLOBAL:
    Unfortunately, you can't do that. <--- This is what I set as a global msg and it works, only with the nps plugin.

    Can you fix it?

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

    Empire92

  29. Offline

    Zahachos

    Empire92 FUCK YES! DUDE YES! YOU ARE A FUCKING GOD! AND I THANK YOU SO MUCH! (sorry for bad language)
    There is just a little bug... (I don't really care but) it's just that when you type /nps.. the messages are all global messages:
    Example, this is what shows up:
    MESSAGES:
    - Unfortunately you can't do that.
    - Unfortunately you can't do that.
    - Unfortunately you can't do that.
    - Unfortunately you can't do that.
    - Unfortunately you can't do that.
    - Unfortunately you can't do that.
    - Unfortunately you can't do that.
    - Unfortunately you can't do that.
    GLOBAL:
    - Unfortunately you can't do that.
     
    Empire92 likes this.
  30. Offline

    Empire92

    Zahach Oh, LOL. I forgot about the feature of replacing those messages when I added that part. :p
    Want me to patch it, or is it fine?
     
Thread Status:
Not open for further replies.

Share This Page