Exemplo n.º 1
0
 public static void loadConfig() {
   dir = KFA.fileCopy(MyPlugin.pl, "config.yml", false);
   kf = new ConfigFile(dir + File.separator + "config.yml");
   long oldver = kf.getLong("version", 0L);
   if (oldver < 7L) {
     dir = KFA.fileCopy(MyPlugin.pl, "config.yml", true);
     kf = new ConfigFile(dir + File.separator + "config.yml");
     verchange = true;
   }
   else if (oldver == 7L) {
     kf.set("forcelangcopy", "+");
     kf.set("version", "8");
     verchange = false;
   }
   if (kf.getBoolean("forcelangcopy")) {
     KFA.lf.insert(new LangFile(KFA.getFileStream(MyPlugin.pl, "lang.lng")));
     kf.set("forcelangcopy", "-");
   }
   kf.repair_missing = true;
   opperms = kf.getBoolean("permissions.op", true);
   dfcheck = kf.getBoolean("permissions.disableflagcheck", true);
   silktouch = kf.getBoolean("creatorblock.silktouch", true);
   ProtectionCore.movecheckrate = (int)kf.getLong("movecheckrate", 10L);
   try {
     String[] tool = (kf.get("tools.wand", "271") + ":0").split("\\:");
     wandtool = KFA.srv.createItemStack(Integer.valueOf(tool[0]).intValue(), 1, Integer.valueOf(tool[1]).intValue());
     tool = (kf.get("tools.info", "268") + ":0").split("\\:");
     infotool = KFA.srv.createItemStack(Integer.valueOf(tool[0]).intValue(), 1, Integer.valueOf(tool[1]).intValue());
   }
   catch (Throwable e) {
     System.out.println("[ProtectionCore] Error in configuration, the tools aren't defined properly");
     e.printStackTrace();
   }
   limits = new int[0];
   for (String s : kf.get("regionlimits").split("\\ ")) {
     try {
       limits = ArrayUtils.add(limits, Integer.valueOf(s).intValue());
     }
     catch (Throwable e) {
       System.out.println("[ProtectionCore] Error the limit \"" + s + "\" is not number!");
     }
   }
   kf.save();
 }
Exemplo n.º 2
0
 public static boolean loadRegions() {
   boolean loaded = true;
   rf = new ConfigFile(dir + File.separator + "regions.yml");
   for (WorldServer s : MinecraftServer.getServer().worldServers) {
     rf.set(s.dimensionSetAtCreate, "\r");
   }
   rf.save();
   for (String world : rf.mainAdressList()) {
     System.out.println("Loading dimension " + world);
     Region.regions.put(Integer.valueOf(world), new ArrayList());
     Region.regnames.put(Integer.valueOf(world), new ArrayList());
     for (??? = rf.mainAdressList(world).iterator(); ((Iterator)???).hasNext(); ) { String regname = (String)((Iterator)???).next();
       String adr = world + "." + regname + ".";
       Region r = new Region(new Area(rf.get(adr + "area"), Integer.valueOf(world).intValue()), regname, 1, null);
       loaded = (loadRegion(rf, r, adr)) && (loaded);
     }
     if (!((List)Region.regnames.get(Integer.valueOf(world))).contains("{global}")) {
       System.out.println("Global region creating...");
       int min = -2147483648;
       int max = 2147483647;
       new Region(new Area(min, min, min, max, max, max, Integer.valueOf(world).intValue()), "{global}", 0, Region.getTemplate("{global}"));
     }
   }