Package org.bukkit.configuration.file

Examples of org.bukkit.configuration.file.FileConfiguration


    }



    public void calcPoints(){
        FileConfiguration c = SettingsManager.getInstance().getConfig();
        int kpoints = kills * c.getInt("stats.points.kill");
        int ppoints = pppoints * c.getInt("stats.points.position");
        int kspoints = ksbon;

        points = kpoints + ppoints + kspoints + ksbon;
        //System.out.println(player+"  "+kpoints +" "+ppoints+" "+kspoints);

        if(position == 1){
            points = points + c.getInt("stats.points.win");
        }

    }
View Full Code Here


      kits.add(new Kit(s));
    }
  }

  public void LoadGames() {
    FileConfiguration c = SettingsManager.getInstance().getSystemConfig();
    games.clear();
    int no = c.getInt("sg-system.arenano", 0);
    int loaded = 0;
    int a = 1;
    while (loaded < no) {
      if (c.isSet("sg-system.arenas." + a + ".x1")) {
        //c.set("sg-system.arenas."+a+".enabled",c.getBoolean("sg-system.arena."+a+".enabled", true));
        if (c.getBoolean("sg-system.arenas." + a + ".enabled")) {
          //SurvivalGames.$(c.getString("sg-system.arenas."+a+".enabled"));
          //c.set("sg-system.arenas."+a+".vip",c.getBoolean("sg-system.arenas."+a+".vip", false));
          SurvivalGames.$("Loading Arena: " + a);
          loaded++;
          games.add(new Game(a));
View Full Code Here

  public WorldEditPlugin getWorldEdit() {
    return p.getWorldEdit();
  }

  public void createArenaFromSelection(Player pl) {
    FileConfiguration c = SettingsManager.getInstance().getSystemConfig();
    //SettingsManager s = SettingsManager.getInstance();

    WorldEditPlugin we = p.getWorldEdit();
    Selection sel = we.getSelection(pl);
    if (sel == null) {
      msgmgr.sendMessage(PrefixType.WARNING, "You must make a WorldEdit Selection first!", pl);
      return;
    }
    Location max = sel.getMaximumPoint();
    Location min = sel.getMinimumPoint();

    /* if(max.getWorld()!=SettingsManager.getGameWorld() || min.getWorld()!=SettingsManager.getGameWorld()){
            pl.sendMessage(ChatColor.RED+"Wrong World!");
            return;
        }*/

    int no = c.getInt("sg-system.arenano") + 1;
    c.set("sg-system.arenano", no);
    if (games.size() == 0) {
      no = 1;
    } else no = games.get(games.size() - 1).getID() + 1;
    SettingsManager.getInstance().getSpawns().set(("spawns." + no), null);
    c.set("sg-system.arenas." + no + ".world", max.getWorld().getName());
    c.set("sg-system.arenas." + no + ".x1", max.getBlockX());
    c.set("sg-system.arenas." + no + ".y1", max.getBlockY());
    c.set("sg-system.arenas." + no + ".z1", max.getBlockZ());
    c.set("sg-system.arenas." + no + ".x2", min.getBlockX());
    c.set("sg-system.arenas." + no + ".y2", min.getBlockY());
    c.set("sg-system.arenas." + no + ".z2", min.getBlockZ());
    c.set("sg-system.arenas." + no + ".enabled", true);

    SettingsManager.getInstance().saveSystemConfig();
    hotAddArena(no);
    pl.sendMessage(ChatColor.GREEN + "Arena ID " + no + " Succesfully added");

View Full Code Here

  }*/


  public void runHook(String hook, String... args){
    //System.out.println("RUNNING HOOK");
    FileConfiguration c = SettingsManager.getInstance().getConfig();
    //System.out.println(c.getStringList("hooks."+hook));

    for(String str: c.getStringList("hooks."+hook)){
      //System.out.println(str);
      String[] split = str.split("!");
      String p = MessageUtil.replaceVars(split[0], args);
      String[] commands = MessageUtil.replaceVars(split[1], args).split(";");
      if(checkConditions(split[2], args)){
View Full Code Here

        if(args.length != 1){
            MessageManager.getInstance().sendFMessage(PrefixType.ERROR, "error.notspecified", player, "input-Arena");
            return true;
        }
       
        FileConfiguration s = SettingsManager.getInstance().getSystemConfig();
        //FileConfiguration spawn = SettingsManager.getInstance().getSpawns();
        int arena = Integer.parseInt(args[0]);
        Game g = GameManager.getInstance().getGame(arena);
       
        if(g == null){
            MessageManager.getInstance().sendFMessage(PrefixType.ERROR, "error.gamedoesntexist", player, "arena-" + arena);
            return true;
        }
       
        g.disable();
        s.set("sg-system.arenas."+arena+".enabled", false);
        s.set("sg-system.arenano", s.getInt("sg-system.arenano") - 1);
        //spawn.set("spawns."+arena, null);
        MessageManager.getInstance().sendFMessage(PrefixType.INFO, "info.deleted", player, "input-Arena");
        SettingsManager.getInstance().saveSystemConfig();
        GameManager.getInstance().hotRemoveArena(arena);
        //LobbyManager.getInstance().clearAllSigns();
View Full Code Here

  public static MessageManager getInstance() {
    return instance;
  }
 
  public void setup() {
    FileConfiguration f = SettingsManager.getInstance().getMessageConfig();
    prefix.put(PrefixType.MAIN, MessageUtil.replaceColors(f.getString("prefix.main")));
    prefix.put(PrefixType.INFO, MessageUtil.replaceColors(f.getString("prefix.states.info")));
    prefix.put(PrefixType.WARNING, MessageUtil.replaceColors(f.getString("prefix.states.warning")));
    prefix.put(PrefixType.ERROR, MessageUtil.replaceColors(f.getString("prefix.states.error")));
   
  }
View Full Code Here

        loadSigns();
    }

    public void loadSigns() {

        FileConfiguration c = SettingsManager.getInstance().getSystemConfig();
        try {
            if (!c.getBoolean("sg-system.lobby.sign.set")) return;
        } catch (Exception e) {
            return;
        }
        boolean usingx = false;
        int hdiff = 0;
        int x1 = c.getInt("sg-system.lobby.sign.x1");
        int y1 = c.getInt("sg-system.lobby.sign.y1");
        int z1 = c.getInt("sg-system.lobby.sign.z1");
        int x2 = c.getInt("sg-system.lobby.sign.x2");
        int y2 = c.getInt("sg-system.lobby.sign.y2");
        int z2 = c.getInt("sg-system.lobby.sign.z2");
        int inc = 0;
        Location l;
        //  System.out.println(x1+"  "+y1+"  "+z1);
        byte temp = ((Sign) new Location(p.getServer().getWorld(c.getString("sg-system.lobby.sign.world")), x1, y1, z1).getBlock().getState()).getData().getData();
        //  System.out.println("facing "+temp);
        if (temp == 3 || temp == 4) {
            l = new Location(Bukkit.getWorld(c.getString("sg-system.lobby.sign.world")), x1, y1, z1);
            inc = -1;
        } else {
            l = new Location(Bukkit.getWorld(c.getString("sg-system.lobby.sign.world")), x2, y1, z2);
            inc = 1;
        }


        usingx = ((x2 - x1) != 0) ? true : false;
View Full Code Here

    }



    public void setLobbySignsFromSelection(Player pl) {
        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 = p.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.getNativeMaximumPoint().getBlockX()) != 0 && (sel.getNativeMaximumPoint().getBlockZ() - sel.getNativeMaximumPoint().getBlockZ() != 0)) {
            pl.sendMessage(ChatColor.RED + " Must be in a straight line!");
            return;
        }

        Vector max = sel.getNativeMaximumPoint();
        Vector min = sel.getNativeMinimumPoint();

        c.set("sg-system.lobby.sign.world", pl.getWorld().getName());
        c.set("sg-system.lobby.sign.x1", max.getBlockX());
        c.set("sg-system.lobby.sign.y1", max.getBlockY());
        c.set("sg-system.lobby.sign.z1", max.getBlockZ());
        c.set("sg-system.lobby.sign.x2", min.getBlockX());
        c.set("sg-system.lobby.sign.y2", min.getBlockY());
        c.set("sg-system.lobby.sign.z2", min.getBlockZ());

        pl.sendMessage(ChatColor.GREEN + "Lobby Status wall successfuly created");
        s.saveSystemConfig();
        loadSigns();
View Full Code Here

    return instance;
  }
 
  public void setup(){

    FileConfiguration conf = SettingsManager.getInstance().getChest();

    for(int clevel = 1; clevel <= 16; clevel++){
      ArrayList<ItemStack> lvl = new ArrayList<ItemStack>();
      List<String>list = conf.getStringList("chest.lvl"+clevel);

      if(!list.isEmpty()){
        for(int b = 0; b<list.size();b++){
          ItemStack i = ItemReader.read(list.get(b));
          lvl.add(i);
        }
        lvlstore.put(clevel, lvl);
      } else {
        maxlevel = clevel-1;
        break;
      }
    }
   
    ratio = conf.getInt("chest.ratio", ratio);
   
  }
View Full Code Here

  }

  public void setup(){

    FileConfiguration conf = SettingsManager.getInstance().getChest();

    for(int a = 1; a<5;a++){
      ArrayList<ItemStack> lvl = new ArrayList<ItemStack>();
      List<String>list = conf.getStringList("chest.lvl"+a);

      for(int b = 0; b<list.size();b++){
        ItemStack i = ItemReader.read(list.get(b));
       

        lvl.add(i);

      }

      lvlstore.put(a, lvl);

    }

    ratio = conf.getInt("chest.ratio") + 1;

  }
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.