Need some advice on permissions for potions

Discussion in 'Plugin Development' started by nala3, Feb 16, 2014.

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

    nala3

    Before I begin, I am not asking how to use permissions or even how to block potions. I just need some outside input on how exactly I should format my permissions to be checked. Again, I don't actually need any programming help.

    So right now, I am doing some work on my NoItem plugin and I have gotten to potion blocking. In past versions I used either the recipe or the data value of the resulting potion from a recipe to block potions, which was fine for a while, but no longer. This time around I am trying to give the users of my plugin as much control as possible over what is being blocked.
    Currently the plugin checks 2 different kinds of permissions for an action that is going to be blocked, whether is be block placement, or holding an item. Here is an example for blocking an item being held:
    When it comes to potions though, things are a bit more complex. If I used the current method I would end up having to check all of these:
    And that is if I just just the action permissions. There really must be a better way.
    Does anybody have an idea on how I could minimize the permissions I need to check for this while still maintaining the ability to check the effect, splash, and extended possibilities?
     
  2. Offline

    xTigerRebornx

    nala3 I suggest a "consume" action, as it can be used for anything consumable, i.e. noitem.action.consume.potion, and for specific potions you could try the PotionType enum , so it'd be like noitem.action.consume.potion.REGEN, where REGEN is from the PotionType enum
     
  3. Offline

    nala3

    Already have something like that planned, but I need to be able to stop the actual brewing of a potion is the problem.
     
  4. Offline

    xTigerRebornx

  5. Offline

    nala3

    Okay, I don't think your understanding the question. I do not need any help at all with anything API related. (P.S. BrewEvent doesn't work because it does not give the player who brewed it, but that isn't the problem. I solved that a long time ago)
    I just need ideas for how to reduce the amount of permissions I need to check, a better permission structure for brewing if you will, instead of noitem.action.brew.etc...
     
  6. Offline

    xTigerRebornx

    nala3
    If this isn't the problem, then what is?
    Edit: Nevermind, I read the post when it was unedited. Ill look into this abit more
     
  7. Offline

    nala3

    Yeah lol, accidentally submitted before I was done :p
     
  8. Offline

    xTigerRebornx

    nala3 The way you have currently for your permissions looks okay, could try something like this
    noitem.action.brew.type.PotionType
    noitem.action.brew.splash.PotionType
    noitem.action.brew.extended.PotionType
    etc
     
  9. Offline

    nala3

    Thanks, that is a good idea. I may also have found a solution. I guess typing things out sometimes makes it a bit easier to think about them xD
    Anywho, thanks again for your help good sir. Have an internet cookie :)
    [​IMG]
     
  10. Offline

    xTigerRebornx

    nala3 Yey, I love internet cookies.
     
Thread Status:
Not open for further replies.

Share This Page