Solved Custom spigot build help

Discussion in 'Spigot Plugin Development' started by Vytska111, Jan 24, 2020.

  1. Hello,
    I'm editing spigot to change some things. I would like to make the permission for /version be only for operators. I found the version command class, but I don't know how to do it. I could probably just change the permission for the command and it would work, but I'm looking for a better solution to this. Is there like a list that has all the permissions which I could change and make the permission only for operators?
    Thanks
     
  2. SteelPhoenix

    Moderator

    This sounds like x/y problem, why would you need to modify spigot if you can just use a permissions plugin and properly setup permissions?
     
  3. The /version thing is not the only thing I'm changing in the spigot. I'm editing the spigot so it would work better for the server I'm working on.
     
  4. May I ask what kind of server are you running and why you need to have a custom spigot?
     
  5. SteelPhoenix

    Moderator

    And that server doesn't use a permissions plugin? Pretty much every (public) server uses a perms plugin
     
  6. I'm currently working on it, not running it. I'm making a custom spigot because some stuff changed and added would be easier to do some things in my plugins.

    It is going to have permission management, but adding that permission change in the spigot wouldn't hurt.

    Please don't ask more questions, just get to the point.
     
    • Optimistic Optimistic x 1
  7. This is how NOT to get help. People were trying to help you see if you don't need to build a custom spigot fork, you shouldn't be due to it being much easier to make plugins than to be building your own jar. Not to be rude, but if you can't edit a permission you shouldn't be building your own spigot fork, it's an advanced topic.

    That being said if you plan to continue, I don't intend to spoonfeed, but I'll point you in the right direction: check the class for the version command, and look where the permission is checked
     
    #7 darthteddy1, Jan 24, 2020
    Last edited: Jan 24, 2020
    • Winner Winner x 1
  8. That server I said I was working on, it's going to be a BungeeCord network. So I thought that a custom spigot that has some built in features for the server would be good. I have a lot of spigot plugin development experience so making a custom spigot isn't really that advanced for me. I think that a permission change wouldn't hurt (even if there is going to be permission management). If it's really that hard to make that permission change, then I can just not do it then.
     
  9. Alright well take a look at the second part of my post then, I'm specifically referring to the
    Code (Text):
    execute
    field.
     
  10. I'm probably missing something, but I cannot find anything useful. It just checks if the player has the permission
     
  11. In that spot, I instead check if the sender is OP, not if the sender has the permission. If they are not OP, I return true to exit the method.
     
  12. I don't think that is a good idea. Bukkit probably adds a permission attachment to all players with the permissions. I'm gonna do some debugging.
     
  13. It doesn't matter. If you replace the permission check with an op check, it doesn't matter if the player has the permission attached, the command will not run.
     
  14. I cannot just change the code. It's in the Command class which is used by not just the version command.
     
  15. Well, I can just check if the player is op, but I found a better solution to this. There is a class called CommandPermissions (org.bukkit.util.permissions.CommandPermissions) which registers all of the default permissions. I edited it and it worked perfectly! Marking as solved.
    Thanks for the help!