Package org.bukkit.configuration.file

Examples of org.bukkit.configuration.file.FileConfiguration


      SettingsManager.getInstance().setup(p);
      MessageManager.getInstance().setup();
      GameManager.getInstance().setup(p);

      try { // try loading everything that uses SQL.
        FileConfiguration c = SettingsManager.getInstance().getConfig();
        if (c.getBoolean("stats.enabled")) DatabaseManager.getInstance().setup(p);
        QueueManager.getInstance().setup();
        StatsManager.getInstance().setup(p, c.getBoolean("stats.enabled"));
        dbcon = true;
      } catch (Exception e) {
        dbcon = false;
        e.printStackTrace();
        logger.severe("!!!Failed to connect to the database. Please check the settings and try again!!!");
View Full Code Here



    public boolean connect()
    {
        //log.info("Connecting to database...");
        FileConfiguration c = SettingsManager.getInstance().getConfig();
        String host =  c.getString("sql.host", "localhost");
        int port    =  c.getInt("sql.port"3306);
        String db   =  c.getString("sql.database", "SurvivalGames");
        String user =  c.getString("sql.user", "root");
        String pass =  c.getString("sql.pass""");
        return this.connectToDB(host, port, db, user,pass);
    }
View Full Code Here

    load();
  }
 
 
  public void load(){
    FileConfiguration c = SettingsManager.getInstance().getKits();
    cost = c.getDouble("kits."+name+".cost", 0);
   
    icon = ItemReader.read(c.getString("kits."+name+".icon"));
    System.out.println(icon);
    List<String>cont = c.getStringList("kits."+name+".contents");
    for(String s:cont){
      items.add(ItemReader.read(s));
    }
   
  }
View Full Code Here

      display(s1, a);
    }
  }

  public void setLobbySignsFromSelection(Player pl, int a) {
    FileConfiguration c = SettingsManager.getInstance().getSystemConfig();
    SettingsManager s = SettingsManager.getInstance();
    if (!c.getBoolean("sg-system.lobby.sign.set", false)) {
      c.set("sg-system.lobby.sign.set", true);
      s.saveSystemConfig();
    }
    WorldEditPlugin we = GameManager.getInstance().getWorldEdit();
    Selection sel = we.getSelection(pl);
    if (sel == null) {
      pl.sendMessage(ChatColor.RED + "You must make a WorldEdit Selection first");
      return;
    }
    if ((sel.getNativeMaximumPoint().getBlockX() - sel.getNativeMinimumPoint().getBlockX()) != 0 && (sel.getNativeMinimumPoint().getBlockZ() - sel.getNativeMaximumPoint().getBlockZ() != 0)) {
      pl.sendMessage(ChatColor.RED + " Must be in a straight line!");
      return;
    }
    Vector max = sel.getNativeMaximumPoint();
    Vector min = sel.getNativeMinimumPoint();
    int i = c.getInt("sg-system.lobby.signno", 0) + 1;
    c.set("sg-system.lobby.signno", i);
    c.set("sg-system.lobby.signs." + i + ".id", a);
    c.set("sg-system.lobby.signs." + i + ".world", pl.getWorld().getName());
    c.set("sg-system.lobby.signs." + i + ".x1", max.getBlockX());
    c.set("sg-system.lobby.signs." + i + ".y1", max.getBlockY());
    c.set("sg-system.lobby.signs." + i + ".z1", max.getBlockZ());
    c.set("sg-system.lobby.signs." + i + ".x2", min.getBlockX());
    c.set("sg-system.lobby.signs." + i + ".y2", min.getBlockY());
    c.set("sg-system.lobby.signs." + i + ".z2", min.getBlockZ());
    pl.sendMessage(ChatColor.GREEN + "Added Lobby Wall"); //TODO
    s.saveSystemConfig();
    loadSign(i);
  }
View Full Code Here

        /* ****************************************** *
         *           Test saving/loading
         * ****************************************** */
        assertTrue(core.saveMVConfigs());
        // change a value here
        FileConfiguration config = YamlConfiguration.loadConfiguration(new File(core.getDataFolder(), "worlds.yml"));
        WorldProperties worldObj = (WorldProperties) config.get("worlds.world");
        assertTrue(worldObj.setColor("GREEN"));
        config.set("worlds.world", worldObj);
        config.save(new File(core.getDataFolder(), "worlds.yml"));
        // load
        core.loadConfigs();

        mvWorld = worldManager.getMVWorld("world");
        assertEquals(true, mvWorld.isHidden());
View Full Code Here

  private static HashMap<String, List<Waypoint> > waypoints = new HashMap<String, List<Waypoint>>();

  public void read() {
    Spout.getInstance().reloadConfig();
    FileConfiguration configuration = Spout.getInstance().getConfig();
    configuration.options().copyDefaults(true);

    kickMessage = configuration.getString("ForceClientKickMessage");
    authTicks = configuration.getInt("ClientCheckTicks", 200);
    buildCheck = configuration.getBoolean("ServerVersionCheck", true);
    /*allowSkyCheat = configuration.getBoolean("AllowSkyCheat", false);
    allowClearWaterCheat = configuration.getBoolean("AllowClearWaterCheat", false);
    allowStarsCheat = configuration.getBoolean("AllowStarsCheat", false);
    allowWeatherCheat = configuration.getBoolean("AllowWeatherCheat", false);
    allowTimeCheat = configuration.getBoolean("AllowTimeCheat", false);
    allowCoordsCheat = configuration.getBoolean("AllowCoordsCheat", false);
    allowEntityLabelCheat = configuration.getBoolean("AllowEntityLabelCheat", false);
    allowVoidFogCheat = configuration.getBoolean("AllowVoidFogCheat", false);*/
    chunkDataCache = configuration.getBoolean("ChunkDataCache", true);
    allowClientCache = configuration.getBoolean("AllowClientCache", true);
    teleportSmoothing = configuration.getBoolean("TeleportSmoothing", true);
    runDeadlockMonitor = configuration.getBoolean("DeadlockMonitor", false);

    loadWaypoints(configuration);

    Spout.getInstance().saveConfig();
  }
View Full Code Here

    }
  }

  public void addWaypoint(String name, Location location) {
    Spout.getInstance().reloadConfig();
    FileConfiguration configuration = Spout.getInstance().getConfig();
    configuration.set("waypoints." + location.getWorld().getName().toLowerCase() + "." + name + ".x", location.getX());
    configuration.set("waypoints." + location.getWorld().getName().toLowerCase() + "." + name + ".y", location.getY());
    configuration.set("waypoints." + location.getWorld().getName().toLowerCase() + "." + name + ".z", location.getZ());
    Spout.getInstance().saveConfig();
    for (Player p : location.getWorld().getPlayers()) {
      if (p instanceof SpoutPlayer) {
        ((SpoutPlayer)p).addWaypoint(name, location.getX(), location.getY(), location.getZ());
      }
View Full Code Here

    public MVPortal removePortal(String portalName, boolean removeFromConfigs) {
        if (!isPortal(portalName)) {
            return null;
        }
        if (removeFromConfigs) {
            FileConfiguration config = this.plugin.getPortalsConfig();
            config.set("portals." + portalName, null);
            this.plugin.savePortalsConfig();
        }

        MVPortal removed = this.portals.remove(portalName);
        MultiverseWorld world = this.plugin.getCore().getMVWorldManager().getMVWorld(removed.getWorld());
View Full Code Here

//      schematicsFolder = findFolder(pluginFolder, "Schematics for " + generator.worldName);
     
   
    // add/get the configuration
    CityWorld plugin = generator.getPlugin();
    FileConfiguration config = plugin.getConfig();
    config.options().header("CityWorld Plugin Options");
    config.options().copyDefaults(true);
   
    // get the right section
    ConfigurationSection section = null;
   
    // see if we can find the specific world
    if (config.isConfigurationSection(worldname))
      section = config.getConfigurationSection(worldname);
   
    // if not then create it
    if (section == null)
      section = config.createSection(worldname);
   
    /* Create a config in the world's folder
     * Find the generation section
     * Does the global config contain a world section?
     *   Load from that world section
View Full Code Here

   * @param arena
   * @param section
   * @return
   */
  public Cuboid configToCuboid(String arena, String section) {
    FileConfiguration conf = SimpleSpleef.getPlugin().getConfig();
    arena = arena.toLowerCase();
    section = section.toLowerCase();
    String confbase = "arenas." + arena + "." + section; // shorten stuff later on
    // is arena protected? If not, ignore to save resources
    if (!conf.getBoolean("arenas." + arena + ".protectArena", true)) return null;
    // get arena cube, if possible
    if (!conf.isConfigurationSection(confbase) ||
        !conf.getBoolean("arenas." + arena + ".arena.enabled", false)) return null;
    // do we have a world guard region here?
    if (conf.getString(confbase + ".worldguardRegion") != null && conf.getString(confbase + ".worldguardWorld") != null && SimpleSpleef.getPlugin().getWorldGuard() != null) {
      // get world guard region
      World world = SimpleSpleef.getPlugin().getServer().getWorld(conf.getString(confbase + ".worldguardWorld"));
      // get region manager
      RegionManager regionManager = world!=null?SimpleSpleef.getPlugin().getWorldGuard().getRegionManager(world):null;
      // error?
      if (world == null || regionManager == null) return null;
      // get region
      ProtectedRegion region = regionManager.getRegion(conf.getString(confbase + ".worldguardRegion"));
      if (region == null) return null;
      return new CuboidWorldGuard(region, world); // create world guard cuboid - very cool!
    } else { // normal, non WorldGuard coordinates
      // now, check sane coords
      String firstWorldString = conf.getString(confbase + ".a.world");
      String secondWorldString = conf.getString(confbase + ".b.world");
      World firstWorld = firstWorldString!=null?SimpleSpleef.getPlugin().getServer().getWorld(firstWorldString):null;
      World secondWorld = secondWorldString!=null?SimpleSpleef.getPlugin().getServer().getWorld(secondWorldString):null;
      if (firstWorld == null || secondWorld == null || firstWorld != secondWorld) return null; // non-sane worlds
      int firstX = conf.getInt(confbase + ".a.x", 0);
      int firstY = conf.getInt(confbase + ".a.y", 0);
      int firstZ = conf.getInt(confbase + ".a.z", 0);
      int secondX = conf.getInt(confbase + ".b.x", 0);
      int secondY = conf.getInt(confbase + ".b.y", 0);
      int secondZ = conf.getInt(confbase + ".b.z", 0);
      if (firstX == 0 && firstY == 0 && firstZ == 0 && secondX == 0 && secondY == 0 && secondZ == 0) return null;
      // create cube
      return new CuboidImpl(firstWorld, (firstX<secondX?firstX:secondX), (firstY<secondY?firstY:secondY), (firstZ<secondZ?firstZ:secondZ),
          (firstX>secondX?firstX:secondX), (firstY>secondY?firstY:secondY), (firstZ>secondZ?firstZ:secondZ));
    }
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.