Config help and Permission Nodes help.

Discussion in 'Bukkit Discussion' started by JollyGiant16, May 8, 2012.

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

    JollyGiant16

    Permissions nodes let's say I made A Plugin and I wanted to add permission nodes
    I would do: Example

    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
          Player player = (Player) sender;
          if(commandLabel.equalsIgnoreCase("captureblue")){
          Bukkit.broadcastMessage(ChatColor.BLUE + " Blue Team has captured" + ChatColor.RED + " Reds flag!" + " (1) Point Blue!");
          player.sendMessage(ChatColor.GREEN + "Successfully Captured Reds flag!");
    And I would add to it,
    if(player.hasPermission("allow.capture.flag")
    Now,

    Code:
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
    Player player = (Player) sender;
    if(commandLabel.equalsIgnoreCase("captureblue")){
    Bukkit.broadcastMessage(ChatColor.BLUE + " Blue Team has captured" + ChatColor.RED + " Reds flag!" + " (1) Point Blue!");
    player.sendMessage(ChatColor.GREEN + "Successfully Captured Reds flag!");
    if(player.hasPermission("allow.capture.flag")
    Then the Config.yml would look like?
    permissions:
    capture.*:
    description: Gives access to capture the flag
    default:
    allow.capture.flag: true
    allow.capture.flag:
    description: Allows you to capture the flag!
    default: true

    Put how would the plugin.yml look?
     
  2. Offline

    nala3

    you do not actually have to register the permissions in the plugin.yml, your supposed to but it is not needed.
     
  3. Offline

    JollyGiant16

    Alright thank you but is the codeing right for the adding permission nodes into the plugin, I tried it but it didn't work.
     
  4. Offline

    nala3

    Yes, but if you want them to be added by default as true, then they do infact need to be in the plugin.yml. you can find a guide on how to set up permissions in the plugin.yml on the bukkit wiki.
     
  5. Offline

    JollyGiant16

    nala3
    Alright Thanks buddy for replying that to me.
     
  6. Offline

    nala3

    you should @ tag somebody or quote them if you would like a reply most of the time. I for instance usually don't ever see a response if there is no alert to me
     
  7. Offline

    JollyGiant16

    nala3
    name: Captureflag
    main: me.jollygiant13.captureflag.captureflag
    version: 1.2.5
    depend: GroupManager, PermissionEX ????
    loaddepend: GroupManager, PermissionEX ????

    permissions:
    captureflag.*:
    description: Gives you all access to all Captureflag commands
    children:
    allow.capture.flag: true
    deny.capture.flag: false
    allow.capture.flag:
    Description: Allows you to capture the flag
    default: true
     
  8. Offline

    nala3

    Code:
    name: CaptureFlag
    description: An awesome CTF plugin written by JollyGiant13!
    main: me.jollygiant13.captureflag.captureflag
    version 1.2.5
     
    permissions:
        captureflag.*:
            description: All CaptureFlag permisssions
            children:
                captureflag.allow: true
                captureflag.deny: false
       
        captureflag.allow:
            description: Allow capturing the flag
            default: true
           
        captureflag.deny:
            description: Deny capturing the flag (overrides captureflag.allow)
            default: false
    you should make captureflag.deny override captureflag.allow in the code, it only makes sense :)
     
  9. Offline

    JollyGiant16

    The Other Thing I need to know was how to reload plugins ./hcreload I'm not sure

    nala3
    Code:
    name: CaptureFlag
    description: An awesome CTF plugin written by JollyGiant13!
    main: me.jollygiant13.captureflag.captureflag
    version 1.2.5
     
    permissions:
        captureflag.*:
            description: All CaptureFlag permisssions
            children:
                captureflag.allow: true
                captureflag.deny: false
     
        captureflag.allow:
            description: Allow capturing the flag
            default: true
         
        captureflag.deny:
            description: Deny capturing the flag (overrides captureflag.allow)
            default: false
    Same thing in the Config.yml?

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

    nala3

    You don't need any of that in the config.yml [pig]
     
  11. Offline

    JollyGiant16

    nala3
    Alright so would you add
    Code:
    if(player.hasPermission("helpcenter.*"));
    Aswell, and what about the ./hcreload
     
Thread Status:
Not open for further replies.

Share This Page