Package com.bergerkiller.bukkit.common.config

Examples of com.bergerkiller.bukkit.common.config.FileConfiguration


      }
    }
  }

  public static void init(String filename) {
    FileConfiguration config = new FileConfiguration(filename);
    config.load();
    for (String key : config.getKeys()) {
      String dur = config.get(key, String.class, null);
      if (dur != null) {
        TimeSign t = getTimer(key);
        t.duration = ParseUtil.parseTime(dur);
        t.startTime = System.currentTimeMillis();
      }
View Full Code Here


      }
    }
  }

  public static void save(String filename) {
    FileConfiguration config = new FileConfiguration(filename);
    for (TimeSign sign : timerSigns.values()) {
      config.set(sign.name, sign.getDuration());
    }
    config.save();
  }
View Full Code Here

  public static boolean canBreak(Material type) {
    return plugin.allowedBlockBreakTypes.contains(type);
  }

  public void loadConfig() {
    config = new FileConfiguration(this);
    config.load();
    config.setHeader("This is the configuration file of TrainCarts");
    config.addHeader("In here you can tweak TrainCarts to what you want");
    config.addHeader("For more information, you can visit the following websites:");
    config.addHeader("http://www.minecraftwiki.net/wiki/Bukkit/TrainCarts");
View Full Code Here

  /**
   * Loads all Train Properties and defaults from disk
   */
  public static void load() {
    loadDefaults();
    FileConfiguration config = new FileConfiguration(TrainCarts.plugin, propertiesFile);
    config.load();
    if (fixDeprecation(config)) {
      config.save();
    }
    for (ConfigurationNode node : config.getNodes()) {
      TrainProperties prop = new TrainProperties(node.getName());
      prop.load(node);
      trainProperties.put(prop.getTrainName(), prop);
    }
  }
View Full Code Here

  /**
   * Loads the default Train Properties from file
   */
  public static void loadDefaults() {
    defconfig = new FileConfiguration(TrainCarts.plugin, defaultPropertiesFile);
    defconfig.load();
    boolean changed = false;
    if (!defconfig.contains("default")) {
      ConfigurationNode node = defconfig.getNode("default");
      TrainProperties.EMPTY.saveAsDefault(node);
View Full Code Here

  /**
   * Saves all Train Properties to disk
   */
  public static void save() {
    FileConfiguration config = new FileConfiguration(TrainCarts.plugin, propertiesFile);
    for (TrainProperties prop : trainProperties.values()) {
      //does this train even exist?!
      if (prop.hasHolder() || OfflineGroupManager.contains(prop.getTrainName())) {
        prop.save(config.getNode(prop.getTrainName()));
      } else {
        config.remove(prop.getTrainName());
      }
    }
    config.save();
  }
View Full Code Here

    return worldConfigs.containsKey(worldname);
  }

  public static void init() {
    // Default configuration
    defaultProperties = new FileConfiguration(MyWorlds.plugin, "defaultproperties.yml");
    defaultProperties.setHeader("This file contains the default world properties applied when loading or creating completely new worlds");
    defaultProperties.addHeader("All the nodes found in the worlds.yml can be set here");
    defaultProperties.addHeader("To set environment/worldtype-specific settings, add a new node with this name");
    if (defaultProperties.exists()) {
      defaultProperties.load();
    } else {
      // Generate new properties
      WorldConfig defConfig = new WorldConfig(null);
      defConfig.gameMode = Bukkit.getDefaultGameMode();
      defConfig.saveDefault(defaultProperties);
      ConfigurationNode defEnv = defaultProperties.getNode("normal");
      defEnv.set("gamemode", "NONE");
      defEnv.setHeader("\nAll settings applied to worlds with the normal environment");
      defEnv.addHeader("You can add all the same world settings here and they will override the main defaults");
      defEnv.addHeader("You can use multiple environments, of which nether, the_end and even nether_flat");
      defaultProperties.save();
    }

    // Worlds configuration
    worldConfigs.clear();
    FileConfiguration config = new FileConfiguration(MyWorlds.plugin, "worlds.yml");
    config.load();
    for (ConfigurationNode node : config.getNodes()) {
      String worldname = node.get("name", node.getName());
      if (WorldManager.worldExists(worldname)) {
        WorldConfig wc = create(worldname);
        wc.load(node);
        if (node.get("loaded", false)) {
View Full Code Here

      get(world).onWorldLoad(world);
    }
  }

  public static void saveAll() {
    FileConfiguration cfg = new FileConfiguration(MyWorlds.plugin, "worlds.yml");
    for (WorldConfig wc : all()) {
      if (wc.isExisting()) {
        wc.save(cfg.getNode(wc.getConfigName()));
      }
    }
    cfg.save();
  }
View Full Code Here

    // Soft Dependency evaluation beforehands
    isSpoutPluginEnabled = CommonUtil.isPluginEnabled("Spout");
    isMultiverseEnabled = CommonUtil.isPluginEnabled(MULTIVERSE_NAME);

    // Continue loading the configuration(s)
    FileConfiguration config = new FileConfiguration(this);
    config.load();

    config.setHeader("This is the configuration of MyWorlds");
    config.addHeader("For more information, you can visit the following websites:");
    config.addHeader("http://dev.bukkit.org/server-mods/my-worlds/");
    config.addHeader("http://forums.bukkit.org/threads/myworlds.31718");

    config.setHeader("teleportInterval", "\nThe interval in miliseconds a player has to wait before being teleported again");
    teleportInterval = config.get("teleportInterval", 2000);

    config.setHeader("useWaterTeleport", "\nWhether water stream portals are allowed");
    useWaterTeleport = config.get("useWaterTeleport", true);

    config.setHeader("timeLockInterval", "\nThe tick interval at which time is kept locked");
    timeLockInterval = config.get("timeLockInterval", 20);

    config.setHeader("useWorldInventories", "\nWhether or not world inventories are being separated using the settings");
    useWorldInventories = config.get("useWorldInventories", false);

    useWorldEnterPermissions = config.get("useWorldEnterPermissions", false);
    usePortalEnterPermissions = config.get("usePortalEnterPermissions", false);
    useWorldBuildPermissions = config.get("useWorldBuildPermissions", false);
    useWorldUsePermissions = config.get("useWorldUsePermissions", false);
    useWorldChatPermissions = config.get("useWorldChatPermissions", false);

    config.setHeader("onlyPlayerTeleportation", "\nWhether only players are allowed to teleport through portals");
    onlyPlayerTeleportation = config.get("onlyPlayerTeleportation", true);

    config.setHeader("allowPortalNameOverride", "\nWhether portals can be replaced by other portals with the same name on the same world");
    allowPortalNameOverride = config.get("allowPortalNameOverride", true);

    config.setHeader("useWorldOperators", "\nWhether each world has it's own operator list");
    useWorldOperators = config.get("useWorldOperators", false);

    config.setHeader("onlyObsidianPortals", "\nWhether only portal blocks surrounded by obsidian can teleport players");
    onlyObsidianPortals = config.get("onlyObsidianPortals", false);

    config.setHeader("calculateWorldSize", "\nWhether the world info command will calculate the world size on disk");
    config.addHeader("calculateWorldSize", "If this process takes too long, disable it to prevent possible server freezes");
    calculateWorldSize = config.get("calculateWorldSize", true);

    config.setHeader("mainWorld", "\nThe main world in which new players spawn");
    config.addHeader("mainWorld", "If left empty, the main world defined in the server.properties is used");
    mainWorld = config.get("mainWorld", "");

    config.setHeader("forceMainWorldSpawn", "\nWhether all players respawn on the main world at all times");
    forceMainWorldSpawn = config.get("forceMainWorldSpawn", false);

    config.setHeader("alwaysInstantPortal", "\nWhether survival players instantly teleport when entering a nether portal");
    alwaysInstantPortal = config.get("alwaysInstantPortal", true);

    config.setHeader("maxPortalSignDistance", "\nThe maximum distance to look for a portal sign when entering a portal");
    maxPortalSignDistance = config.get("maxPortalSignDistance", 5.0);

    config.setHeader("enablePortals", "\nTurns portal usage on or off on a global level");
    config.addHeader("enablePortals", "When disabled, portal teleportation will not be handled by MyWorlds whatsoever");
    enablePortals = config.get("enablePortals", true);

    config.setHeader("allowPersonalPortals", "\nWhether individually placed nether/end portals create their own destination portal");
    config.addHeader("allowPersonalPortals", "False: Players are teleported to the spawn point of the world");
    config.addHeader("allowPersonalPortals", "True: Players are teleported to their own portal on the other world");
    allowPersonalPortals = config.get("allowPersonalPortals", true);

    config.setHeader("ignoreEggSpawns", "\nWhether egg-spawned entities are allowed to spawn, even if worlds have these entities blacklisted");
    ignoreEggSpawns = config.get("ignoreEggSpawns", true);

    config.setHeader("overridePortalPhysics", "\nWhether Vanilla portal physics are overrided to allow them to be built/stacked");
    overridePortalPhysics = config.get("overridePortalPhysics", true);

    config.setHeader("importFromMultiVerse", "\nWhether to automatically import the world configuration of MultiVerse for new (unknown) worlds");
    config.addHeader("importFromMultiverse", "Note that default world properties are then no longer applied, as MultiVerse takes that over");
    config.addHeader("importFromMultiverse", "This setting is only active if MultiVerse-Core is installed.");
    importFromMultiVerse = config.get("importFromMultiVerse", true);

    config.save();

    // World configurations have to be loaded first
    WorldConfig.init();

    // Portals
View Full Code Here

    return new WorldInventory(worldName).add(worldName);
  }

  public static void load() {
    inventories.clear();
    FileConfiguration config = new FileConfiguration(MyWorlds.plugin, "inventories.yml");
    config.load();
    for (ConfigurationNode node : config.getNodes()) {
      String sharedWorld = node.get("folder", String.class, null);
      if (sharedWorld == null) {
        continue;
      }
      List<String> worlds = node.getList("worlds", String.class);
View Full Code Here

TOP

Related Classes of com.bergerkiller.bukkit.common.config.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.