Package org.bukkit.configuration

Examples of org.bukkit.configuration.ConfigurationSection


      Player p = (Player) sender;
      String pName = p.getName();
      if (quizWinners.containsKey(pName)) {
        // load all items for this player's reward
        FileConfiguration f = CommandsEX.getConf();
        ConfigurationSection configGroups = f.getConfigurationSection("quizDiff." + quizWinners.get(pName));
        Set<String> s = configGroups.getKeys(false);
       
        // first of all, count all rewards and see if they'd fit into player's inventory
        Integer allBlocks = 0;
        Inventory pi = p.getInventory();
        Integer maxStackSize = pi.getMaxStackSize();
View Full Code Here


        }
   
    try {
      // start new quiz
      FileConfiguration f = CommandsEX.getConf();
      ConfigurationSection configGroups = f.getConfigurationSection("quizzes");
      Set<String> s = configGroups.getKeys(false);
      Integer len = s.size();
      String quizName = null;
     
      if (len > 0) {
        // pick a random one
View Full Code Here

     
      // select a random reward
      FileConfiguration f = CommandsEX.getConf();
     
      try {
        ConfigurationSection configGroups = f.getConfigurationSection("quizDiff." + quizDifficulty);
        Set<String> s = configGroups.getKeys(false);
        s.remove("caseSentisive");
        Integer len = s.size();
        String rewardName = null;
     
        if (len > 0) {
View Full Code Here

   */
  public static void list(CommandSender sender, String[] args) {
    // show all kits available to us
    List<String> available = new ArrayList<String>();
    FileConfiguration f = CommandsEX.getConf();
    ConfigurationSection configGroups = f.getConfigurationSection("kits");
    if (configGroups != null){
      Set<String> kitGroups = configGroups.getKeys(false);
     
      for (String group : kitGroups) {
        if (group.equals("*") || ((sender instanceof Player) && Permissions.checkPermEx(((Player)sender), "cex.kits." + group)) || !(sender instanceof Player)) {
          ConfigurationSection kits = f.getConfigurationSection("kits." + group);
          Set<String> kitNames = kits.getKeys(false);
         
          for (String kit : kitNames) {
            available.add(kit);
          }
        }
View Full Code Here

    Integer stamp = Utils.getUnixTimestamp(0L);

    if (!Utils.checkCommandSpam(sendingPlayer, "kits-give")) {
      // check if we can use the kit in question
      FileConfiguration f = CommandsEX.getConf();
      ConfigurationSection kitConfigGroups = f.getConfigurationSection("kits");
      if (kitConfigGroups != null){
        Set<String> kitGroups = kitConfigGroups.getKeys(false);

        for (String group : kitGroups) {
          if (group.equals("*") || Permissions.checkPermEx(sendingPlayer, "cex.kits." + group)) {
            ConfigurationSection kits = f.getConfigurationSection("kits." + group);
            Set<String> kitNames = kits.getKeys(false);

            for (String kit : kitNames) {
              if (kit.equalsIgnoreCase(args[0])) {
                if (f.getBoolean("kits." + group + "." + kit + ".onetime", false) && usedOneTimeKits.containsKey(pName)) {
                  // a one-time kit that was used by this player already
                  oneTimeKitWarning = true;
                } else if ((f.getInt("kits." + group + "." + kit + ".cooldown", 0) > 0) && !Permissions.checkPermEx(player, "cex.kits.cooldown.bypass") && kitCooldowns.containsKey(pName) && ((stamp - kitCooldowns.get(pName)) < f.getInt("kits." + group + "." + kit + ".cooldown"))) {
                  // kit on a cooldown
                  cooldownWarning = true;
                } else {
                  // one-time kit?
                  if (f.getBoolean("kits." + group + "." + kit + ".onetime", false)) {
                    // store one-time usage into database - if this returns error, the record already exists, so we just return a warning
                    if (CommandsEX.sqlEnabled) {
                      SQLManager.omitErrorLogs = true;
                      if (!SQLManager.query("INSERT INTO "+ SQLManager.prefix +"kits_usage VALUES (?, ?)", pName, kit)) {
                        oneTimeKitWarning = true;
                      } else {
                        usedOneTimeKits.put(pName, kit);
                      }
                      SQLManager.omitErrorLogs = false;
                    }
                  }

                  // cooldown kit?
                  if (f.getInt("kits." + group + "." + kit + ".cooldown", 0) > 0) {
                    kitCooldowns.put(pName, Utils.getUnixTimestamp(0L));
                  }

                  // if we don't have a one-time kit warning from database, give items to the player
                  if (!oneTimeKitWarning) {
                    // load all items for this player's reward
                    ConfigurationSection configGroups = f.getConfigurationSection("kits." + group + "." + kit);
                    Set<String> s = configGroups.getKeys(false);
                    // remove onetime and cooldown keys
                    s.remove("onetime");
                    s.remove("cooldown");
                    s.remove("onjoin");

View Full Code Here

  public void giveInitialKits(PlayerJoinEvent e) {
    Player player = e.getPlayer();
    if (player.hasPlayedBefore()) return;

    FileConfiguration f = CommandsEX.getConf();
    ConfigurationSection kitConfigGroups = f.getConfigurationSection("kits");
    if (kitConfigGroups == null) return;
   
    Set<String> kitGroups = kitConfigGroups.getKeys(false);
   
    for (String group : kitGroups) {
      if (group.equals("*") || Permissions.checkPermEx(player, "cex.kits." + group)) {
        ConfigurationSection kits = f.getConfigurationSection("kits." + group);
        Set<String> kitNames = kits.getKeys(false);
       
        for (String kit : kitNames) {
          if (f.getBoolean("kits." + group + "." + kit + ".onjoin", false)) {
            // we have an on-join kit, give it out
            give(player, new String[] {kit}, true);
View Full Code Here

   * Used in 2 places - delayed task and Quit event.
   */
  public static void checkTimedPromotions(Player...players) {
    // load up settings from config file
    FileConfiguration f = CommandsEX.getConf();
    ConfigurationSection configGroups = f.getConfigurationSection("timedPromote");
    boolean promoteSet = CommandsEX.getConf().getBoolean("promoteSet");
   
    // no groups defined
    if (configGroups == null) {
      return;
    }
   
    Map<String, Integer> settings = new HashMap<String, Integer>();
    List<?> exclusions = CommandsEX.getConf().getList("timedPromoteExclude", new ArrayList<String>());
    Set<String> keys = configGroups.getKeys(true);
   
    if (keys.size() > 0) {
      for (String s : keys) {
        // ignore default group with time 0, since that one is an example record
        if (s.equals("default") && (f.getInt("timedPromote." + s) == 0)) continue;
View Full Code Here

   * Used in 2 places - delayed task and Quit event.
   */
  public static void checkEcoPromotions(Player...players) {
    // load up settings from config file
    FileConfiguration f = CommandsEX.getConf();
    ConfigurationSection configGroups = f.getConfigurationSection("ecoPromote");
    boolean promoteSet = CommandsEX.getConf().getBoolean("promoteSet");
   
    // no groups defined
    if (configGroups == null) {
      return;
    }
   
    Map<String, Double> settings = new HashMap<String, Double>();
    List<?> exclusions = CommandsEX.getConf().getList("ecoPromoteExclude", new ArrayList<String>());
    Boolean checkDemotions = f.getBoolean("ecoPromoteAutoDemote");
    Set<String> keys = configGroups.getKeys(true);
   
    if (keys.size() > 0) {
      for (String s : configGroups.getKeys(true)) {
        // ignore default group with wealth of 0, since that one is an example record
        if (s.equals("default") && (f.getInt("ecoPromote." + s) == 0)) continue;
        settings.put(s, f.getDouble("ecoPromote." + s));
      }
    }
View Full Code Here

      return true;
    }
   
    // load up settings from config file
    FileConfiguration f = CommandsEX.getConf();
    ConfigurationSection configGroups = f.getConfigurationSection("timedPromote");
    Player p = (Player)sender;
    Long currentGroupTime = f.getLong("timedPromote." + Vault.perms.getPrimaryGroup(p));
    Long nextGroupTime = 9223372036854775807L; // maximum value of LONG in Java
    String nextRankName = "?";
    for (String s : configGroups.getKeys(true)) {
      // ignore default group with time 0, since that one is an example record
      Long t = f.getLong("timedPromote." + s);
      if (s.equals("default") && (t == 0)) continue;
     
      // check if this group has more time set than current one and set it as the next group's time
View Full Code Here

            featureGraph.addPlotter(new Metrics.Plotter("Kits Set") {
            @Override
            public int getValue() {
              int count = 0;
              FileConfiguration f = CommandsEX.getConf();
              ConfigurationSection configGroups = f.getConfigurationSection("kits");
              if (configGroups != null){
                Set<String> kitGroups = configGroups.getKeys(false);

                for (String group : kitGroups) {
                  ConfigurationSection kits = f.getConfigurationSection("kits." + group);
                  Set<String> kitNames = kits.getKeys(false);
                  count = count + kitNames.size();
                }
              }
             
              return count;
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.