Package org.bukkit.configuration

Examples of org.bukkit.configuration.ConfigurationSection


  private ConfigurationSection findNode(String entityName) {
    if (config.isLowerCased(basePath)) {
      entityName = entityName.toLowerCase();
    }
    ConfigurationSection section = findExistingNode(entityName, true);
    if (section != null) {
      return section;
    }

    // Silly workaround for empty nodes
View Full Code Here


    return entityName;
  }

  @Override
  public boolean setIdentifier(String identifier) {
    ConfigurationSection section = findExistingNode(identifier, false);
    if (section != null) {
      return false;
    }
    String caseCorrectedIdentifier = config.isLowerCased(basePath) ? identifier.toLowerCase() : identifier;
    String oldNodePath = this.nodePath;
View Full Code Here

    if (commonPermissions != null) {
      allPermissions.put(null, Collections.unmodifiableList(commonPermissions));
    }

    //World-specific permissions
    ConfigurationSection worldsSection = this.node.getConfigurationSection("worlds");
    if (worldsSection != null) {
      for (String world : worldsSection.getKeys(false)) {
        List<String> worldPermissions = this.node.getStringList(FileBackend.buildPath("worlds", world, "permissions"));
        if (commonPermissions != null) {
          allPermissions.put(world, Collections.unmodifiableList(worldPermissions));
        }
      }
View Full Code Here

    return Collections.unmodifiableMap(allPermissions);
  }

  @Override
  public Set<String> getWorlds() {
    ConfigurationSection worldsSection = this.node.getConfigurationSection("worlds");

    if (worldsSection == null) {
      return Collections.emptySet();
    }

    return Collections.unmodifiableSet(worldsSection.getKeys(false));
  }
View Full Code Here

    save();
  }

  @Override
  public Map<String, String> getOptions(String worldName) {
    ConfigurationSection optionsSection = this.node.getConfigurationSection(formatPath(worldName, "options"));

    if (optionsSection == null) {
      return Collections.emptyMap();
    }
View Full Code Here

  @Override
  public void loadFromString(String contents) throws InvalidConfigurationException {
    synchronized (lock) {
      super.loadFromString(contents);
      for (String sectionKey : lowerCaseSections) {
        ConfigurationSection section = getConfigurationSection(sectionKey);
        if (section != null) {
          for (Map.Entry<String, Object> entry : section.getValues(false).entrySet()) {
            final String lowerString = entry.getKey().toLowerCase();
            if (!lowerString.equals(entry.getKey())) {
              section.set(entry.getKey(), null);
              if (entry.getValue() instanceof  ConfigurationSection) {
                section.createSection(lowerString, ((ConfigurationSection) entry.getValue()).getValues(false));
              } else {
                section.set(lowerString, entry.getValue());
              }
            }
          }
        }
      }
View Full Code Here

    }
    return Collections.unmodifiableSet(ret);
  }

  protected final void setupAliases() {
    ConfigurationSection aliases = getConfig().getConfigurationSection("aliases");

    if (aliases == null) {
      return;
    }

    tableNames = aliases.getValues(false);
  }
View Full Code Here

        // Find each type of notable
        for (String key : DenizenAPI.getCurrentInstance().notableManager().getNotables().getKeys(false)) {

            Class<? extends dObject> clazz = reverse_objects.get(key);

            ConfigurationSection section = DenizenAPI.getCurrentInstance().notableManager().getNotables()
                    .getConfigurationSection(key);

            if (section == null)
                continue;

            for (String notable : section.getKeys(false)) {
                Notable obj = (Notable) ObjectFetcher.getObjectFrom(clazz, section.getString(notable));
                if (obj != null) {
                    obj.makeUnique(notable.replace("DOT", "."));
                }
                else {
                    dB.echoError("Notable '" + section.getString(notable).replace("DOT", ".") + "' failed to load!");
                }
            }

        }
View Full Code Here

        // Delete the contents of the scoreboardMap and viewerMap
        scoreboardMap.clear();
        viewerMap.clear();

        ConfigurationSection rootSection = DenizenAPI.getCurrentInstance()
                .getScoreboards().getConfigurationSection("Scoreboards");

        // Go no further if we have no scoreboards saved
        if (rootSection == null) return;

        Scoreboard board = null;

        // Iterate through scoreboards
        for (String id : rootSection.getKeys(false)) {
            // Create a scoreboard with this id
            board = createScoreboard(id);

            // Get the list of viewers
            List<String> viewerList = rootSection.getStringList(id + ".Viewers");

            // Iterate through viewers, store them in the viewerMap,
            // and make them see this scoreboard if they are online
            for (String viewer : viewerList) {
                if (dPlayer.matches(viewer)) {
                    dPlayer player = dPlayer.valueOf(viewer);
                    viewerMap.put(player.getName(), id);

                    if (player.isOnline())
                        player.getPlayerEntity().setScoreboard(board);
                }
            }

            ConfigurationSection objSection = rootSection
                    .getConfigurationSection(id + ".Objectives");

            // Go no further if we have no objectives saved
            if (objSection == null) return;

            // Iterate through objectives
            for (String obj : objSection.getKeys(false)) {
                // Get display slot and criteria for this objective
                String displaySlot = objSection.getString(obj + ".Display slot");
                String criteria = objSection.getString(obj + ".Criteria");

                // Use default criteria if necessary
                if (criteria == null)
                    criteria = "dummy";
                // Use default display slot if necessary
                if (displaySlot == null)
                    displaySlot = "NONE";

                // Register the objective and set it up
                Objective o = board.registerNewObjective(obj, criteria);
                o.setDisplayName(obj);

                // Only set display slot if it's valid
                if (Argument.valueOf(displaySlot).matchesEnum(DisplaySlot.values())) {
                    o.setDisplaySlot(DisplaySlot.valueOf(displaySlot.toUpperCase()));
                }

                ConfigurationSection scoreSection = objSection
                        .getConfigurationSection(obj + ".Scores");

                if (scoreSection != null) {
                    // Iterate through scores and add them to this objective
                    for (String scoreName : scoreSection.getKeys(false)) {
                        int scoreInt = scoreSection.getInt(scoreName);
                        addScore(o, ScoreboardCommand.getOfflinePlayer(scoreName), scoreInt);
                    }
                }
            }
        }
View Full Code Here

        }
    }

    public static void reloadEntities() {
        entities.clear();
        ConfigurationSection entity_scripts = DenizenAPI.getCurrentInstance()
                .getEntities().getConfigurationSection("entities.scripts");
        if (entity_scripts == null)
            return;
        for (String Path: entity_scripts.getKeys(false)) {
            UUID id = UUID.fromString(Path);
            String scriptname = entity_scripts.getString(Path + ".scriptname");
            entities.put(id, scriptname);
        }
    }
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.