Package org.bukkit.configuration.file

Examples of org.bukkit.configuration.file.FileConfiguration


            return String.valueOf(value);
        }
    }

    public static void load(File configuration) {
        FileConfiguration config = YamlConfiguration.loadConfiguration(configuration);

        for(Nodes n: Nodes.values())
            if(!n.getNode().isEmpty())
                if(config.get(n.getNode()) != null)
                    n.setValue(config.get(n.getNode()));
    }
View Full Code Here


            Bukkit.getScheduler().cancelTask(viewer.getTask());
        }

        viewers.clear();

        FileConfiguration saves = DenizenAPI.getCurrentInstance().getSaves();

        if (saves.contains("Viewers"))
            for (final String id : saves.getConfigurationSection("Viewers").getKeys(false)) {
                Viewer viewer = new Viewer(id, saves.getString("Viewers." + id.toLowerCase() + ".content"), dLocation.valueOf(saves.getString("Viewers." + id.toLowerCase() + ".location")));
                viewers.put(id, viewer);
                if (viewer.getContent().startsWith("LOCATION")) {
                    int task = Bukkit.getScheduler().scheduleSyncRepeatingTask(DenizenAPI.getCurrentInstance(), new Runnable() {
                        public void run() {
                            Player player = Bukkit.getPlayer(UUID.fromString(viewers.get(id).getContent().split("; ")[1]));
View Full Code Here

        private int getTask() {
            return this.task;
        }

        void save() {
            FileConfiguration saves = DenizenAPI.getCurrentInstance().getSaves();

            // Save content
            saves.set("Viewers." + id.toLowerCase() + ".content", content);
            // Save location
            saves.set("Viewers." + id.toLowerCase() + ".location", location.identify());
        }
View Full Code Here

            // Save location
            saves.set("Viewers." + id.toLowerCase() + ".location", location.identify());
        }

        void remove() {
            FileConfiguration saves = DenizenAPI.getCurrentInstance().getSaves();

            saves.set("Viewers." + id.toLowerCase(), null);
        }
View Full Code Here

    String nodeName = args.get("node");
    if (nodeName == null || nodeName.isEmpty()) {
      return;
    }

    FileConfiguration config = plugin.getConfig();

    if (args.get("value") != null) {
      config.set(nodeName, this.parseValue(args.get("value")));
      try {
        config.save(new File(plugin.getDataFolder(), "config.yml"));
      } catch (Throwable e) {
        sender.sendMessage(ChatColor.RED + "[PermissionsEx] Failed to save configuration: " + e.getMessage());
      }
    }

    Object node = config.get(nodeName);
    if (node instanceof Map) {
      sender.sendMessage("Node \"" + nodeName + "\": ");
      for (Map.Entry<?, ?> entry : ((Map<?, ?>) node).entrySet()) {
        sender.sendMessage("  " + entry.getKey() + " = " + entry.getValue());
      }
View Full Code Here

    /**
     * Called on by '/denizen save'.
     */
    private static void _saveNotables() {

        FileConfiguration notables = DenizenAPI.getCurrentInstance().notableManager().getNotables();
        for (String key: notables.getKeys(false)) {
            notables.set(key, null);
        }

        for (Map.Entry<String, Notable> notable : notableObjects.entrySet()) {

            // If the object is serializable, save that info... fetching the objects back
            // will require this information TODO: make this do something?..
      //      if (notable.getValue().getSaveObject() instanceof ConfigurationSerializable)
      //          DenizenAPI.getCurrentInstance().notableManager().getNotables()
      //                  .set(getClassId(notable.getValue().getClass()) + "." + "_serializable", true);

            notables.set(getClassId(getClass(notable.getValue())) + "." + notable.getKey().toLowerCase().replace(".", "DOT"),
                    notable.getValue().getSaveObject());
        }

    }
View Full Code Here

            entities.put(id, scriptname);
        }
    }

    public static void saveEntities() {
        FileConfiguration entityScripts = DenizenAPI.getCurrentInstance().getEntities();
        entityScripts.set("entities.scripts", null);
        for (Map.Entry<UUID, String> entry: entities.entrySet()) {
            entityScripts.set("entities.scripts." + entry.getKey() + ".scriptname", entry.getValue());
        }
    }
View Full Code Here

        if (!file.exists()) {
            plugin.saveResource("magicspells.yml", false);
            Messenger.info("magicspells.yml created.");
        }
        try {
            FileConfiguration config = new YamlConfiguration();
            config.load(file);
            setupSpells(config);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

  @Override
  public void onEnable() {
    log = this.getLogger();

    FileConfiguration config = getConfig();
    DigSettings.setConfig(config);

    List<String> modesEnabled = Arrays.asList(config.getString("modesEnabled").split(","));

    if (modesEnabled.contains("digging")) {
      getServer().getPluginManager().registerEvents(new DigEventListener(), this);
      //      System.out.println("Digging enabled");
    }
View Full Code Here

    if (sender instanceof Player) {
      player = (Player) sender;
    }

    FileConfiguration config = getConfig();

    List<String> sizeList = Arrays.asList(config.getString("sizeList").split(","));
    int maxDepth = config.getInt("maxDepth");
    int maxTrackLength = config.getInt("maxTrackLength");

    if (cmd.getName().equalsIgnoreCase("bigdig")) {
      if (args.length > 0) {

        // ====================Dig Settings====================
View Full Code Here

TOP

Related Classes of org.bukkit.configuration.file.FileConfiguration

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.