Castle Siege - YARDIM

cancan2010

Sudan Çıkmış
Mesajlar
3
En iyi cevaplar
0
Beğeniler
1
Puanları
0
Herkese merhabalar şu anda Mineplex sunucusunda olan "Castle Siege" eklentisi üzerinde çalışıyorum ancak bir sorun meydana geldi; bildiğiniz üzere minigamede "undead" takımdaki oyuncular tnt ile etrafı patlatabiliyorlar ancak harita öyle kalmıyor harita yenileniyor bende şöyle bir sistem yapmasını istiyorum mapi kopyalacak klasörün içine atacak sonra onDisable() functionı gerçekleştiğinde world klasörünü silip yenisini koyacak bunu nasıl yapabilirim ? Elimde olan kod:

Kod:
  public void restore(String msg) {
      Bukkit.getServer().getWorld("world").setAutoSave(false);
      for (Player player : Bukkit.getServer().getOnlinePlayers()) {
      player.kickPlayer(msg);
      }
              for (Chunk chunk : Bukkit.getServer().getWorld("world").getLoadedChunks()) {
             chunk.unload();
              }
              World world = Bukkit.getWorld("world");
              String worldpath = world.getWorldFolder().getAbsolutePath();
              Bukkit.getServer().getLogger().info(worldpath);
              File dir = world.getWorldFolder();
              String backupdir = "plugins/CastleSiege/Backup";
              File backup = new File(backupdir);
              try {
                try {
      copyFiles(backup, dir);
      } catch (IOException e) {
      e.printStackTrace();
      }
              } finally {      
              }            
              world.setAutoSave(true);
      }
 
          public static void copyFiles(File src, File dest)
              throws IOException{          
              if(src.isDirectory()){
              if(!dest.exists()){
                dest.mkdir();
                System.out.println("Directory copied from "  + src + "  to " + dest);
             }    
             String files[] = src.list();
              for (String file : files) {
                File srcFile = new File(src, file);
                File destFile = new File(dest, file);
                copyFiles(srcFile,destFile);
             }
              }else{
              InputStream in = new FileInputStream(src);
                      OutputStream out = new FileOutputStream(dest);
                      byte[] buffer = new byte[1024];
                      int length;
                      while ((length = in.read(buffer)) > 0){
                   out.write(buffer, 0, length);
                     }
                     in.close();
                     out.close();
                      System.out.println("File copied from " + src + " to " + dest);
             }
           }
 



Üst