org.bukkit.util.FileUtil Java Examples

The following examples show how to use org.bukkit.util.FileUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimplePluginManager.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
private void checkUpdate(File file) {
    if (updateDirectory == null || !updateDirectory.isDirectory()) {
        return;
    }

    File updateFile = new File(updateDirectory, file.getName());
    if (updateFile.isFile() && FileUtil.copy(updateFile, file)) {
        updateFile.delete();
    }
}
 
Example #2
Source File: SettingsManager.java    From EnchantmentsEnhance with GNU General Public License v3.0 5 votes vote down vote up
private static void backupConfig() {
    Date date = new Date();
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd@HH:mm:ss");
    String timestamp = formatter.format(date);
    File dataDirectory = Main.getMain().getDataFolder();
    File playerDataDirectory = new File(dataDirectory, "config_backup");

    if (!playerDataDirectory.exists() && !playerDataDirectory.mkdirs()) {
        return;
    }

    FileUtil.copy(cfile, new File(playerDataDirectory, timestamp + "_" + cfile.getName()));
}
 
Example #3
Source File: MineCloudPlugin.java    From MineCloud with ISC License 5 votes vote down vote up
private void copyFolder(File folder, File folderContainer) {
    folderContainer.mkdirs();

    for (File f : folder.listFiles()) {
        if (f.isDirectory()) {
            File newContainer = new File(folderContainer, f.getName());
            copyFolder(f, newContainer);
        }

        FileUtil.copy(f, new File(folderContainer, f.getName()));
    }
}