mywarps.warp.[warpname] : How?

Discussion in 'Plugin Development' started by pookeythekid, Dec 27, 2013.

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

    pookeythekid

    How would you make per-warp permissions or something? For example, you use the command "/setmywarp thiswarp" and then there's the ability to deny the permission to use that warp. To deny that warp, you would deny the permission "mywarps.warps.thiswarp".

    I've been told before to use a command executor to register the permission on command, but I can't think at all how the heck that could be done! Please help, I've been searching for the answer to this for over a month.
     
  2. Offline

    XvBaseballkidvX

    Maybe this?
    Code:java
    1. if(args.length() == 1){
    2. String warpname = args[0];
    3. if(player.hasPermission("warps.use." + warpname){
    4. //Teleport them
    5. }else{
    6. player.sendMessage("You do not have permission to use this warp!");
    7. }
     
    Gater12 likes this.
  3. Offline

    xTigerRebornx

    XvBaseballkidvX That, and some checks to see if the warp actually exists :p
     
    XvBaseballkidvX likes this.
  4. Offline

    pookeythekid

    Yes, I know that. But how would you get that permission registered when you set the warp? If I granted permissions the way you just listed, I would have to list every single possible warp name which would literally take all eternity.

    Edit: *facepalm* I know to check if it exists, and I know how to grant permissions! What I don't know is how to register a new child permission at the moment the warp is set!
     
  5. Offline

    Gater12

    pookeythekid You don't HAVE to register every single permission node.
     
    XvBaseballkidvX likes this.
  6. Offline

    pookeythekid


    I.... know that!

    Edit: What I want to know is how to add a new permission for the warp that I set, when I set it. I've thought about setting things in the plugin.yml onCommand, but as far as my knowledge it's impossible.
     
  7. Offline

    xTigerRebornx

    pookeythekid A quote from Dinnerbone :p
     
  8. Offline

    pookeythekid

    xTigerRebornx I know that too. That's exactly how I always do my permissions! In fact, I've never actually done permissions via plugin.yml.
     
  9. Offline

    Gater12

    pookeythekid ?
    Someone tries to warp -> get the warp name -> Check if it exists FIRST -> Then check if they have permission (Like warp.use. + the warp's name here)
    So if they have that permission node they can teleport to that warp.
     
  10. Offline

    xTigerRebornx

    pookeythekid Well, if you have a list of warps, you could register them with what Dinnerbone says in your onEnable(), looping through that list to do the specifics?
     
  11. Offline

    pookeythekid

    Yes, like that. Except for one thing: How would you create that permission node to check for the warp and its permission, if the node doesn't exist in the first place?
     
  12. Offline

    xTigerRebornx

    pookeythekid You want to create a permission node to check for the warp?........Wut. Explain the post you made more, if you can
     
  13. Offline

    pookeythekid

    xTigerRebornx ..... Registering onEnable.... I never thought about that.

    You just solved it. Thank you very much!!!! ;DDD
     
  14. Offline

    xTigerRebornx

    pookeythekid Why are you trying to register the permission for the warp anyway? It just seems like a pointless step to me
     
  15. Offline

    pookeythekid

    xTigerRebornx It's so I can grant the specific permission to the warp to a player or group. Like Essentials does with "essentials.warp.[warpname]".

    And BTW, this whole thread was never for my warps plugin. It was for my kits plugin. I just used warps as an example. xD
     
  16. Offline

    xTigerRebornx

    pookeythekid You don't need to define the permission to give it to a rank......you just need to check if the rank has that permission
     
  17. Offline

    pookeythekid

    Wait a second!!! Aaagh! I've already tried to register onEnable! Can you send me a link to that thread where you mentioned Dinnerbone? My idea of how to do that didn't work, which is why I'm chatting here today.

    xTigerRebornx And I mean per-warp permission, not just permission to all warps in one certain rank.

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

    xTigerRebornx

    pookeythekid It is stickied, just look in this section, it should be the first Stickied post. But as I was saying, you don't need to register the permissions to give them to a group, you could go and give group Random the permission "wow.such.a.random.node". It wouldn't do anything, unless a plugin checked for it. And, essentials doesn't register their permissions either (as far as I've checked)

    pookeythekid You can just do what others have said, check when a player does /warp <name>, then check for the permission "your.node.<name>", and tada.....Per-Warp permissions

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

    pookeythekid

    xTigerRebornx Okay, sorry my wording has been very confusing. I guess we have different definitions of "register". But how would you create the permission "your.node.<name>" in the first place? You can't really use a node that doesn't exist.

    Edit: Or can child nodes automatically connect to their parent nodes? For example, "warpplugin.warps.thiswarp" is the child of "warpplugin.warps" because the child begins with "warpplugin.warps"?
     
  20. Offline

    xTigerRebornx

    pookeythekid You can use a node that doesn't exist....Go on your server and try to add some random node to your group. The group holds the permission node, but no plugins use the permission node.
     
  21. Offline

    pookeythekid

    xTigerRebornx Hmm.... So you're saying that the non-existing node is just a guideline, not exactly attatched to the plugin?
     
  22. Offline

    xTigerRebornx

    pookeythekid Essential's permission nodes aren't "attached" to the plugin, if by attached, you mean defined by the plugin.yml. You can check for any permission at anytime using player.hasPermission("permnode") (or sender if its not defined as a player yet), and if the player has the permission (regardless of it being registered or not) it will still continue through the code because the player has the permission
     
  23. Offline

    pookeythekid

    xTigerRebornx You sir, just opened up an entire new world for me. Thank you very much! ;D

    And sorry if I've been an annoying noob to you in this conversation.

    P.S. I just went and checked out your plugin. I like the idea of it. It'd be useful for survival plotworlds, even though it's kind of ironic to have survival in an unlimited-building world...
     
  24. Offline

    xTigerRebornx

    pookeythekid The only "annoying noob" here is the one that goes around trolling people :p
    Have fun with the new world you've found XD
     
  25. Offline

    pookeythekid

Thread Status:
Not open for further replies.

Share This Page