Package org.bukkit.configuration

Examples of org.bukkit.configuration.ConfigurationSection


            }
            if (plugin.getNode("groups/" + group + "/" + node) == null) {
              plugin.getConfig().createSection("groups/" + group + "/" + node);
            }

            ConfigurationSection sec = plugin.getNode("groups/" + group + "/" + node);
            if (!sec.contains(perm)) {
                sender.sendMessage(ChatColor.GREEN + "Group " + ChatColor.WHITE + group + ChatColor.GREEN + " did not have " + ChatColor.WHITE + perm + ChatColor.GREEN + " set.");
                return true;
            }
            sec.set(perm, null);
            plugin.refreshPermissions();
           
            sender.sendMessage(ChatColor.GREEN + "Group " + ChatColor.WHITE + group + ChatColor.GREEN + " no longer has " + ChatColor.WHITE + perm + ChatColor.GREEN + " set.");
            return true;
        } else {
View Full Code Here


    final FileConfiguration config = getConfig();
    for (final Entry<String, Object> e : def.entrySet())
      if (!config.contains(e.getKey()))
        config.set(e.getKey(), e.getValue());
    saveConfig();
    final ConfigurationSection cfg = getConfig();
    tools = new HashSet<Integer>(cfg.getIntegerList("tools"));
    dontBreak = new HashSet<Integer>(cfg.getIntegerList("dontBreak"));
    disableDrops = cfg.getBoolean("disableDrops", false);
    disableToolWear = cfg.getBoolean("disableToolWear", false);
    overrideWorldEditCommands = cfg.getBoolean("overrideWorldEditCommands");
    if (disableDrops) {
      if (getPluginManager().isPluginEnabled("LogBlock"))
        consumer = ((LogBlock)getPluginManager().getPlugin("LogBlock")).getConsumer();
      else {
        getLogger().severe("[Superpickaxe] LogBlock not found");
View Full Code Here

      file.createNewFile();
    }
    config = new YamlConfiguration();
    config.load(file);

    ConfigurationSection usersConfig = config
        .getConfigurationSection(USERS);
    if (usersConfig != null) {

      Set<String> names = usersConfig.getKeys(false);

      for (String name : names) {
        List<String> nPerm = usersConfig.getStringList(name + "."
            + PERMISSIONS);
        List<String> nGroup = usersConfig.getStringList(name + "."
            + GROUPS);
        Set<Permission> perms = Permission.loadFromString(nPerm);
        // Create the new user
        add(new User(name, nGroup, perms, this));
      }

    }

    ConfigurationSection groupsConfig = config
        .getConfigurationSection(GROUPS);
    if (groupsConfig != null) {

      Set<String> names = groupsConfig.getKeys(false);

      for (String name : names) {
        List<String> nPerm = groupsConfig.getStringList(name + "."
            + PERMISSIONS);
        List<String> nGroup = groupsConfig.getStringList(name + "."
            + GROUPS);
        Set<Permission> perms = Permission.loadFromString(nPerm);
        // Create the new group
        this.add(new Group(name, nGroup, perms, this));
      }
View Full Code Here

    gconfig = new YamlConfiguration();
   
    uconfig.load(ufile);
    gconfig.load(gfile);

    ConfigurationSection usersConfig = uconfig
        .getConfigurationSection(USERS);
    if (usersConfig != null) {

      Set<String> names = usersConfig.getKeys(false);

      for (String name : names) {
        List<String> nPerm = usersConfig.getStringList(name + "."
            + PERMISSIONS);
        List<String> nGroup = usersConfig.getStringList(name + "."
            + GROUPS);
        Set<Permission> perms = Permission.loadFromString(nPerm);
        // Create the new user
        add(new User(name, nGroup, perms, this));
      }

    }

    ConfigurationSection groupsConfig = gconfig
        .getConfigurationSection(GROUPS);
    if (groupsConfig != null) {

      Set<String> names = groupsConfig.getKeys(false);

      for (String name : names) {
        List<String> nPerm = groupsConfig.getStringList(name + "."
            + PERMISSIONS);
        List<String> nGroup = groupsConfig.getStringList(name + "."
            + GROUPS);
        Set<Permission> perms = Permission.loadFromString(nPerm);
        // Create the new group
        this.add(new Group(name, nGroup, perms, this));
      }
View Full Code Here

      uConfig.load(users);
      gConfig.load(groups);
      } catch (Exception e) {
        e.printStackTrace();
      }
      ConfigurationSection usConfig = uConfig.getConfigurationSection("users");
      ConfigurationSection grConfig = gConfig.getConfigurationSection("groups");
     
      Set<String> usersList = null;
      if(usConfig != null)
        usersList = usConfig.getKeys(false);
      Set<String> groupsList = null;
      if(grConfig != null)
        groupsList = grConfig.getKeys(false);
     
      if (usersList != null)
        for (String player : usersList) {
          User user = wp.getUser(player);
          try {
View Full Code Here

    return lkeys;
  }

  public List<String> getKeys(String path) {
    List<String> lkeys = new ArrayList<String>();
    ConfigurationSection cs = super.getConfigurationSection(path);

    if (cs == null)
      return lkeys;

    Set<String> keys = cs.getKeys(false);

    if (keys != null)
      for (String key : keys)
        lkeys.add(key);
    return lkeys;
View Full Code Here

        boolean isFishing = type.equals("Fishing");
        boolean isShake = type.contains("Shake");
        boolean isExcavation = type.equals("Excavation");
        boolean isHylian = type.equals("Hylian_Luck");

        ConfigurationSection treasureSection = config.getConfigurationSection(type);

        if (treasureSection == null) {
            return;
        }

        // Initialize fishing HashMap
        for (Rarity rarity : Rarity.values()) {
            if (!fishingRewards.containsKey(rarity)) {
                fishingRewards.put(rarity, (new ArrayList<FishingTreasure>()));
            }
        }

        for (String treasureName : treasureSection.getKeys(false)) {
            // Validate all the things!
            List<String> reason = new ArrayList<String>();

            String[] treasureInfo = treasureName.split("[|]");
            String materialName = treasureInfo[0];
View Full Code Here

            if (!fishingEnchantments.containsKey(rarity)) {
                fishingEnchantments.put(rarity, (new ArrayList<EnchantmentTreasure>()));
            }

            ConfigurationSection enchantmentSection = config.getConfigurationSection("Enchantments_Rarity." + rarity.toString());

            if (enchantmentSection == null) {
                return;
            }

            for (String enchantmentName : enchantmentSection.getKeys(false)) {
                int level = config.getInt("Enchantments_Rarity." + rarity.toString() + "." + enchantmentName);
                Enchantment enchantment = EnchantmentUtils.getByName(enchantmentName);

                if (enchantment == null) {
                    plugin.getLogger().warning("Skipping invalid enchantment in treasures.yml: " + enchantmentName);
View Full Code Here

     */
    public boolean getDoubleDropsEnabled(SkillType skill, Material material) { return config.getBoolean("Double_Drops." + StringUtils.getCapitalized(skill.toString()) + "." + StringUtils.getPrettyItemString(material).replace(" ", "_")); }

    public boolean getDoubleDropsDisabled(SkillType skill) {
        String skillName = StringUtils.getCapitalized(skill.toString());
        ConfigurationSection section = config.getConfigurationSection("Double_Drops." + skillName);
        Set<String> keys = section.getKeys(false);
        boolean disabled = true;

        for (String key : keys) {
            if (config.getBoolean("Double_Drops." + skillName + "." + key)) {
                disabled = false;
View Full Code Here

    private void loadArmor(String armorType, List<Material> materialList) {
        if (needsUpdate) {
            return;
        }

        ConfigurationSection armorSection = config.getConfigurationSection(armorType);

        if (armorSection == null) {
            return;
        }

        Set<String> armorConfigSet = armorSection.getKeys(false);

        for (String armorName : armorConfigSet) {
            if (config.contains(armorType + "." + armorName + "." + ".ID")) {
                needsUpdate = true;
                return;
View Full Code Here

TOP

Related Classes of org.bukkit.configuration.ConfigurationSection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.