I need help figuring out how to set permissions for specific "classes"

Discussion in 'Plugin Development' started by Janooary, Jun 27, 2017.

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

    Janooary

    So my friend and I are working on a plugin that uses different classes (in game classes, not java classes). We have several different "abilities" for each "class" but we can't figure out how to separate the classes, so that you can't have more than one class at a time. Any idea how to do this?
     
  2. Online

    timtower Administrator Administrator Moderator

    @Janooary Turn each in game class into a java class.
     
  3. Offline

    Janooary

    We've already done that. I guess what I want to know is how can you assign one in-game class to a player at a time, using commands to switch between classes.
     
  4. Online

    timtower Administrator Administrator Moderator

  5. Offline

    Janooary

    @timtower So after looking into HashMaps, I have one more question, how do I call the HashMap (if it's in one java class) into different java classes? Thanks for your help, btw.
     
  6. Offline

    InstanceofDeath

    The easiest way is to give it the modifier public static (anchored in the class) and then you can just call from everywhere with ClassName[Where your HashMap is].HashMapVariable
     
  7. Offline

    Janooary

    Alright, thanks to you guys, we got the perms working.
     
  8. Online

    timtower Administrator Administrator Moderator

    @InstanceofDeath That is not really convention though, Bukkit does not know how to clean that up.
    @Janooary Put the hasmap in the main class.
    Pass the main class to the other classes using constructors.
    Put a getter in the main class for the hashmap.
     
  9. Offline

    InstanceofDeath

    I know thats why I said "easiest" way not best
     
Thread Status:
Not open for further replies.

Share This Page