Permission Config

Discussion in 'Spigot Plugin Development' started by Sky-Time, Jul 17, 2018.

  1. I am trying to make it so that I can access the permission from the kit but that I can stil change the name of the kit from the config.
    Can someone please help me.
     

    Attached Files:

  2. Benz56

    Moderator Supporter

    Example for “member”.
    1. Config.getConfigurationSection(“kits.member”); and assign it a variable. Let’s call it cfgSection.
    2. Config.set(“kits.” + yourNewName, cfgSection);
    3. Config.set(“kits.” + cfgSection.getName(), null);
    This is very broad but is how this can be achieved.
     
  3. Can you put it in a whole code?
    That would be nice if possible.
     
  4. Benz56

    Moderator Supporter

    The code below is something that I've used in GPS.
    It basically does what you want; move a config section to another key and delete the old section.
    Code (Java):
            ConfigurationSection section = pointsFile.getConfig().getConfigurationSection("Points." + configuratorData.getSelectedPoint().getSection());
            pointsFile.getConfig().set("Points." + StringUtil.locationToString(player.getLocation()), section);
            pointsFile.getConfig().set("Points." + configuratorData.getSelectedPoint().getSection(), null);
            pointsFile.save();
     
  5. Thank You