Browse Source

Beta Build - Almost ready for release!
Various Fixes, Please I need to check this well.
As long as there are no major issues with it, this will be pushed to master.

gamerx 7 years ago
parent
commit
ea72987014

+ 1 - 1
.gitignore

@@ -1,3 +1,3 @@
-# Updated 19.3.2012 - Domenic Horner (gamerx)
+# Updated 19.3.2012.
 /target
 /res

+ 1 - 1
pom.xml

@@ -2,7 +2,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.bukkitbackup</groupId>
     <artifactId>Backup</artifactId>
-    <version>2.0-dev</version>
+    <version>2.0</version>
     <name>Backup</name>
     <description>A Backup plugin for Bukkit's Server mod API.</description>
     <url>https://github.com/gamerx/Backup</url>

+ 1 - 1
src/main/assembly/package.xml

@@ -3,7 +3,7 @@
     <formats>
         <format>zip</format>
     </formats>
-    <includeBaseDirectory>false</includeBaseDirectory>
+    <includeBaseDirectory>true</includeBaseDirectory>
     <fileSets>
         <fileSet>
             <directory>${project.basedir}</directory>

+ 7 - 7
src/main/java/com/bukkitbackup/full/BackupFull.java

@@ -21,8 +21,7 @@ import org.bukkit.plugin.PluginManager;
 import org.bukkit.plugin.java.JavaPlugin;
 
 /**
- * BackupFull - Plugin Loader Class.
- * This extends Bukkit's JavaPlugin class.
+ * BackupFull - Plugin Loader Class. This extends Bukkit's JavaPlugin class.
  *
  * @author Domenic Horner
  */
@@ -39,7 +38,7 @@ public class BackupFull extends JavaPlugin {
     public static BackupWorlds backupWorlds;
     public static BackupPlugins backupPlugins;
     public static BackupTask backupTask;
-    
+
     @Override
     public void onLoad() {
 
@@ -54,10 +53,11 @@ public class BackupFull extends JavaPlugin {
 
         // Load configuration files.
         strings = new Strings(new File(mainDataFolder, "strings.yml"));
-        settings = new Settings(this, strings, new File(mainDataFolder, "config.yml"));
+        settings = new Settings(new File(mainDataFolder, "config.yml"), strings);
 
-        // Run version checking on strings file.
+        // Run version checking on configurations.
         strings.checkStringsVersion(settings.getStringProperty("requiredstrings", ""));
+        settings.checkSettingsVersion(this.getDescription().getVersion());
 
         // Complete initalization of LogUtils.
         LogUtils.finishInitLogUtils(settings.getBooleanProperty("displaylog", true));
@@ -81,9 +81,9 @@ public class BackupFull extends JavaPlugin {
 
         // Check backup path.
         FileUtils.checkFolderAndCreate(new File(settings.getStringProperty("backuppath", "backups")));
-        
+
         // Setup backup tasks.
-        backupEverything = new BackupEverything(settings, strings);
+        backupEverything = new BackupEverything(settings);
         backupWorlds = new BackupWorlds(pluginServer, settings, strings);
         backupPlugins = new BackupPlugins(settings, strings);
         backupTask = new BackupTask(this, settings, strings);

+ 9 - 42
src/main/java/com/bukkitbackup/full/config/Settings.java

@@ -6,7 +6,6 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import org.bukkit.configuration.file.FileConfiguration;
 import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.plugin.Plugin;
 
 /**
  * Class for loading the configuration file.
@@ -15,17 +14,14 @@ import org.bukkit.plugin.Plugin;
  */
 public final class Settings {
 
-    private Plugin plugin;
     private Strings strings;
     private File configFile;
     private FileConfiguration settings;
     public boolean useMaxSizeBackup = false;
     public boolean debugMessages;
 
+    public Settings(File configFile, Strings strings) {
 
-    public Settings(Plugin plugin, Strings strings, File configFile) {
-
-        this.plugin = plugin;
         this.strings = strings;
         this.configFile = configFile;
 
@@ -44,12 +40,8 @@ public final class Settings {
         } catch (Exception e) {
             LogUtils.exceptionLog(e, "Failed to load configuration.");
         }
-
-        // Checks configuration version, notifys the user/log.
-        checkConfigVersion(true);
     }
 
-
     /**
      * Load the properties file from the JAR and place it in the backup DIR.
      */
@@ -89,39 +81,17 @@ public final class Settings {
         }
     }
 
-    /**
-     * Checks configuration version, and return true if it requires an update.
-     *
-     * @return False for no update done, True for update done.
-     */
-    public boolean checkConfigVersion(boolean notify) {
-
-        boolean needsUpgrade = false;
-
-        // Check configuration is loaded.
-        if (settings != null) {
+    public void checkSettingsVersion(String requiredVersion) {
 
-            // Get the version information from the file.
-            String configVersion = settings.getString("version", plugin.getDescription().getVersion());
-            String pluginVersion = plugin.getDescription().getVersion();
+        // Get the version information from the file.
+        String configVersion = settings.getString("version", null);
 
-            // Check we got a version from the config file.
-            if (configVersion == null) {
-                LogUtils.sendLog(strings.getString("failedtogetpropsver"));
-                needsUpgrade = true;
-            }
-
-            // Check if the config is outdated.
-            if (!configVersion.equals(pluginVersion)) {
-                needsUpgrade = true;
-            }
-
-            // After we have checked the versions, we have determined that we need to update.
-            if (needsUpgrade && notify) {
-                LogUtils.sendLog(strings.getString("configupdate"));
-            }
+        // Check we got a version from the config file.
+        if (configVersion == null) {
+            LogUtils.sendLog(strings.getString("failedtogetpropsver"));
+        } else if (!configVersion.equals(requiredVersion)) {
+            LogUtils.sendLog(strings.getString("configupdate"));
         }
-        return needsUpgrade;
     }
 
     /**
@@ -213,9 +183,6 @@ public final class Settings {
         }
     }
 
-
-
-
     /**
      * Method that gets the amount of time between backups. - Checks string for
      * no automatic backup. - Checks for if only number (as minutes). - Checks

+ 10 - 20
src/main/java/com/bukkitbackup/full/config/Strings.java

@@ -48,26 +48,16 @@ public class Strings {
      */
     public void checkStringsVersion(String requiredVersion) {
 
-        boolean needsUpdate = false;
-
-        // Check strings are loaded.
-        if (strings != null) {
-
-            // Get the version information from the file.
-            String stringVersion = strings.getString("version", null);
-
-            // Check we got a version from the config file.
-            if (stringVersion == null) {
-                LogUtils.sendLog("Failed to get strings file verison.");
-                needsUpdate = true;
-            } else if (!stringVersion.equals(requiredVersion)) {
-                needsUpdate = true;
-            }
-            // After we have checked the versions, we have determined that we need to update.
-            if (needsUpdate) {
-                LogUtils.sendLog(this.getString("stringsupdate"));
-            }
+        // Get the version information from the file.
+        String stringVersion = strings.getString("version", null);
+
+        // Check we got a version from the config file.
+        if (stringVersion == null) {
+            LogUtils.sendLog("Failed to get strings file verison.");
+        } else if (!stringVersion.equals(requiredVersion)) {
+            LogUtils.sendLog(this.getString("stringsupdate"));
         }
+
     }
 
     /**
@@ -172,7 +162,7 @@ public class Strings {
         }
     }
 
-        /**
+    /**
      * Gets a value of the string property, and replaces options.
      *
      * @param property The identifier for the string.

+ 9 - 8
src/main/java/com/bukkitbackup/full/config/UpdateChecker.java

@@ -7,8 +7,8 @@ import java.net.URL;
 import org.bukkit.plugin.PluginDescriptionFile;
 
 /**
- * Class for checking for the latest version of Backup.
- * It will report to the user depending if it is out of date or not.
+ * Class for checking for the latest version of Backup. It will report to the
+ * user depending if it is out of date or not.
  *
  * @author Domenic Horner
  */
@@ -25,12 +25,12 @@ public class UpdateChecker implements Runnable {
     }
 
     public void run() {
-        
+
         // Read the version from the web.
         String webVersion = getVersion();
 
         // Confirm we recieved a version.
-        if(webVersion == null) {
+        if (webVersion == null) {
             LogUtils.sendLog(strings.getString("errorversioncheck"));
         } else {
 
@@ -44,7 +44,8 @@ public class UpdateChecker implements Runnable {
     }
 
     /**
-     * This method retrieves the latest version from the web site, and returns it.
+     * This method retrieves the latest version from the web site, and returns
+     * it.
      *
      * @return The latest version.
      */
@@ -53,7 +54,7 @@ public class UpdateChecker implements Runnable {
         try {
 
             // Configure the URL to pull updated from.
-            URL updateURL = new URL("http://checkin.bukkitbackup.com/?ver=" + descriptionFile.getVersion() + "&uuid="+clientID+"&name="+descriptionFile.getName()+"&fromplugin");
+            URL updateURL = new URL("http://checkin.bukkitbackup.com/?ver=" + descriptionFile.getVersion() + "&uuid=" + clientID + "&name=" + descriptionFile.getName() + "&fromplugin");
 
             // Read from the URL into a BufferedReader.
             BufferedReader bReader = new BufferedReader(new InputStreamReader(updateURL.openStream()));
@@ -66,8 +67,8 @@ public class UpdateChecker implements Runnable {
 
             // Return the version.
             return webVersion;
-         } catch (Exception e) {
+        } catch (Exception e) {
             return null;
-         }
+        }
     }
 }

+ 1 - 1
src/main/java/com/bukkitbackup/full/events/CommandHandler.java

@@ -17,7 +17,7 @@ import org.bukkit.plugin.Plugin;
 
 public class CommandHandler implements Listener, CommandExecutor {
 
-    private PrepareBackup prepareBackup = null;
+    private PrepareBackup prepareBackup;
     private Plugin plugin;
     private Server server;
     private Settings settings;

+ 11 - 12
src/main/java/com/bukkitbackup/full/events/EventListener.java

@@ -19,16 +19,16 @@ import org.bukkit.plugin.Plugin;
  * @author Domenic Horner (gamerx)
  */
 public class EventListener implements Listener {
-    
+
     private PrepareBackup prepareBackup = null;
     private Plugin plugin;
     private Settings settings;
     private Strings strings;
     private int lastBackupID;
-    
+
     /**
      * Constructor for listening for login events.
-     * 
+     *
      * @param backupTask The BackupTast to call.
      * @param plugin Plugin to link this class too.
      */
@@ -39,12 +39,12 @@ public class EventListener implements Listener {
         this.strings = strings;
         lastBackupID = -2;
     }
-    
+
     @EventHandler(priority = EventPriority.LOW)
     public void onPlayerQuit(PlayerQuitEvent event) {
         playerPart(event);
     }
-    
+
     @EventHandler(priority = EventPriority.LOW)
     public void onPlayerKick(PlayerKickEvent event) {
         playerPart(event);
@@ -60,19 +60,19 @@ public class EventListener implements Listener {
      *
      */
     private void playerPart(PlayerEvent event) {
-         int onlinePlayers = plugin.getServer().getOnlinePlayers().length;
-         // Check if it was the last player, and we need to stop backups after this last player leaves.
-         if (onlinePlayers == 1 && !settings.getBooleanProperty("backupemptyserver", false)) {
+        int onlinePlayers = plugin.getServer().getOnlinePlayers().length;
+        // Check if it was the last player, and we need to stop backups after this last player leaves.
+        if (onlinePlayers == 1 && !settings.getBooleanProperty("backupemptyserver", false)) {
             prepareBackup.setAsLastBackup(true);
             int intervalInMinutes = settings.getIntervalInMinutes("backupinterval");
             if (intervalInMinutes != 0) {
-                int interval =  intervalInMinutes * 1200;
+                int interval = intervalInMinutes * 1200;
                 lastBackupID = plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, prepareBackup, interval);
                 LogUtils.sendLog(strings.getString("schedlastbackup", Integer.toString(intervalInMinutes)));
             } else {
                 LogUtils.sendLog(strings.getString("disbaledauto"));
             }
-         }
+        }
     }
 
     /**
@@ -80,7 +80,7 @@ public class EventListener implements Listener {
      *
      */
     private void playerJoin(PlayerEvent event) {
-        if(lastBackupID != -2) {
+        if (lastBackupID != -2) {
             plugin.getServer().getScheduler().cancelTask(lastBackupID);
             lastBackupID = -2;
             prepareBackup.setAsLastBackup(false);
@@ -88,4 +88,3 @@ public class EventListener implements Listener {
         }
     }
 }
-

+ 1 - 1
src/main/java/com/bukkitbackup/full/ftp/FTPUploader.java

@@ -67,7 +67,7 @@ public class FTPUploader extends FtpClient implements Runnable {
             ftpClient.binary();
 
             // Change directory if required.
-            if(!connTargetDIR.equals("")) {
+            if (!connTargetDIR.equals("")) {
                 ftpClient.cd(connTargetDIR);
                 LogUtils.sendLog(strings.getString("ftpchangedinto", connTargetDIR));
             }

+ 17 - 20
src/main/java/com/bukkitbackup/full/threading/BackupTask.java

@@ -21,8 +21,7 @@ import org.bukkit.entity.Player;
 import org.bukkit.plugin.Plugin;
 
 /**
- * This is the main backup thread.
- * It handles backing everything up.
+ * This is the main backup thread. It handles backing everything up.
  *
  * @author Domenic Horner
  */
@@ -32,17 +31,14 @@ public class BackupTask implements Runnable {
     private Server pluginServer;
     private Settings settings;
     private Strings strings;
-
     private boolean backupEverything;
     private boolean splitBackup;
     private boolean shouldZIP;
     private boolean useTemp;
     private String dateFormat;
-
     private final String worldContainer;
     private String backupPath;
     private String tempDestination;
-
     private String thisBackupName;
     // Threads.
     private BackupWorlds worldBackupTask;
@@ -85,7 +81,7 @@ public class BackupTask implements Runnable {
         } else { // No temp folder.
             tempDestination = backupPath.concat(FILE_SEPARATOR);
         }
-        
+
     }
 
     @Override
@@ -98,11 +94,11 @@ public class BackupTask implements Runnable {
         if (backupEverything) {
 
             // Start the BackupEverything class.
-                try {
-                    everythingBackupTask.doEverything(thisBackupName);
-                } catch (Exception e) {
-                    LogUtils.exceptionLog(e, "Failed to backup worlds: Exception in BackupWorlds.");
-                }
+            try {
+                everythingBackupTask.doEverything(thisBackupName);
+            } catch (Exception e) {
+                LogUtils.exceptionLog(e, "Failed to backup worlds: Exception in BackupWorlds.");
+            }
         } else {
 
             // Check if we should be backing up worlds.
@@ -165,11 +161,11 @@ public class BackupTask implements Runnable {
         return formattedDate;
     }
 
-/**
- * Check if we need to delete old backups, and perform required operations.
- *
- * @throws Exception
- */
+    /**
+     * Check if we need to delete old backups, and perform required operations.
+     *
+     * @throws Exception
+     */
     private void deleteOldBackups() throws Exception {
 
         File backupDir = new File(backupPath);
@@ -177,7 +173,7 @@ public class BackupTask implements Runnable {
 
         if (splitBackup) { // Look inside the folders.
             // Check if we have a different container for worlds.
-                if (!worldContainer.equals(".")) { // Custom.
+            if (!worldContainer.equals(".")) { // Custom.
 
                 backupDir = new File(backupPath.concat(FILE_SEPARATOR).concat(worldContainer));
 
@@ -233,7 +229,7 @@ public class BackupTask implements Runnable {
             if (settings.useMaxSizeBackup) {
 
                 // Get total folder size.
-                int totalFolderSize =  FileUtils.getTotalFolderSize(folderToClean);
+                int totalFolderSize = FileUtils.getTotalFolderSize(folderToClean);
 
                 // If the amount of files exceeds the max backups to keep.
                 if (totalFolderSize > backupLimit) {
@@ -247,7 +243,7 @@ public class BackupTask implements Runnable {
 
                     // While the total folder size is bigger than the limit.
                     while (FileUtils.getTotalFolderSize(folderToClean) > backupLimit) {
-                        
+
                         // Create updated list.
                         filesList = FileUtils.listFilesInDir(folderToClean);
 
@@ -346,8 +342,9 @@ public class BackupTask implements Runnable {
                 }
 
                 // Delete the temp directory.
-                if(useTemp)
+                if (useTemp) {
                     FileUtils.deleteDir(new File(tempDestination));
+                }
 
                 // Notify that it has completed.
                 notifyCompleted();

+ 1 - 3
src/main/java/com/bukkitbackup/full/threading/PrepareBackup.java

@@ -5,7 +5,6 @@ import com.bukkitbackup.full.config.Settings;
 import com.bukkitbackup.full.config.Strings;
 import com.bukkitbackup.full.utils.LogUtils;
 import java.util.Arrays;
-import java.util.LinkedList;
 import java.util.List;
 import org.bukkit.Server;
 import org.bukkit.entity.Player;
@@ -16,7 +15,6 @@ public class PrepareBackup implements Runnable {
     public boolean isLastBackup;
     public boolean isManualBackup;
     public boolean backupEnabled;
-    public LinkedList<String> worldsToBackup;
     private final Server server;
     private final Settings settings;
     private Strings strings;
@@ -48,7 +46,7 @@ public class PrepareBackup implements Runnable {
         // If it is a manual doBackup, start it, otherwise, perform checks.
         if (isManualBackup) {
             prepareBackup();
-        } else if(backupEnabled) {
+        } else if (backupEnabled) {
 
             // No player checking.
             if (settings.getBooleanProperty("backupemptyserver", false)) {

+ 2 - 2
src/main/java/com/bukkitbackup/full/threading/SyncSaveAll.java

@@ -9,8 +9,8 @@ public class SyncSaveAll implements Runnable {
     private int mode;
 
     /**
-     * This class is used for synchronizing the save-all task.
-     * It is started as a new thread.
+     * This class is used for synchronizing the save-all task. It is started as
+     * a new thread.
      *
      * @param server The server object for this plugin.
      * @param mode The type of save-all we are performing.

+ 1 - 6
src/main/java/com/bukkitbackup/full/threading/tasks/BackupEverything.java

@@ -13,18 +13,13 @@ import java.io.FileFilter;
  */
 public class BackupEverything {
 
-    private final Settings settings;
-    private final Strings strings;
     private final String backupPath;
     private final boolean shouldZIP;
     private final boolean useTemp;
     private final String tempDestination;
     private FileFilter fileFilter;
 
-    public BackupEverything(final Settings settings, Strings strings) {
-
-        this.settings = settings;
-        this.strings = strings;
+    public BackupEverything(final Settings settings) {
 
         // Get the backup destination.
         backupPath = settings.getStringProperty("backuppath", "backups");

+ 8 - 11
src/main/java/com/bukkitbackup/full/threading/tasks/BackupPlugins.java

@@ -105,21 +105,21 @@ public class BackupPlugins {
 
         String thisTempDestination;
         if (splitBackup) {
-             thisTempDestination = backupPath.concat(FILE_SEPARATOR).concat("plugins").concat(FILE_SEPARATOR).concat(backupName);
+            thisTempDestination = backupPath.concat(FILE_SEPARATOR).concat("plugins").concat(FILE_SEPARATOR).concat(backupName);
         } else {
             thisTempDestination = tempDestination.concat(backupName).concat(FILE_SEPARATOR).concat("plugins");
         }
         FileUtils.checkFolderAndCreate(new File(thisTempDestination));
 
         // Perform plugin backup.
-            if (pluginList.size() > 0 && !pluginList.get(0).isEmpty()) {
-                if (pluginListMode) {
-                    LogUtils.sendLog(strings.getString("disabledplugins"));
-                } else {
-                    LogUtils.sendLog(strings.getString("enabledplugins"));
-                }
-                LogUtils.sendLog(pluginList.toString());
+        if (pluginList.size() > 0 && !pluginList.get(0).isEmpty()) {
+            if (pluginListMode) {
+                LogUtils.sendLog(strings.getString("disabledplugins"));
+            } else {
+                LogUtils.sendLog(strings.getString("enabledplugins"));
             }
+            LogUtils.sendLog(pluginList.toString());
+        }
         FileUtils.copyDirectory(pluginsFolder, new File(thisTempDestination), pluginsFileFilter, true);
 
         // Check if ZIP is required.
@@ -134,9 +134,6 @@ public class BackupPlugins {
             } catch (Exception e) {
                 LogUtils.exceptionLog(e);
             }
-
-
-            //FileUtils.doCopyAndZIP(thisTempDestination, backupPath.concat(FILE_SEPARATOR).concat("plugins").concat(FILE_SEPARATOR).concat(backupName), shouldZIP, useTemp);
         }
     }
 }

+ 4 - 6
src/main/java/com/bukkitbackup/full/threading/tasks/BackupWorlds.java

@@ -23,7 +23,6 @@ public class BackupWorlds {
     private final Server pluginServer;
     private final Settings settings;
     private final Strings strings;
-
     private final String worldContainer;
     private final String backupPath;
     private final boolean useTemp;
@@ -32,7 +31,6 @@ public class BackupWorlds {
     private final String tempDestination;
     private String thisTempDestination;
     private final List<String> ignoredWorlds;
-    
 
     /**
      * This should be the place where all the settings and paths for the backup
@@ -42,7 +40,7 @@ public class BackupWorlds {
      * @param settings
      * @param strings
      */
-    public BackupWorlds(Server server, Settings settings, Strings strings) {
+    public BackupWorlds(Server server, final Settings settings, Strings strings) {
 
         this.pluginServer = server;
         this.settings = settings;
@@ -118,9 +116,9 @@ public class BackupWorlds {
 
                 // Copy the current world into it's backup folder.
                 FileUtils.copyDirectory(worldContainer.concat(FILE_SEPARATOR).concat(currentWorldName), thisWorldBackupFolder.concat(FILE_SEPARATOR).concat(currentWorldName));
-                
+
                 // Check and ZIP folder.
-                if(useTemp || shouldZIP) {
+                if (useTemp || shouldZIP) {
                     FileUtils.doCopyAndZIP(thisWorldBackupFolder, thisWorldBackupPath.concat(FILE_SEPARATOR).concat(backupName), shouldZIP, useTemp);
                 }
 
@@ -133,7 +131,7 @@ public class BackupWorlds {
                 if (!worldContainer.equals(".")) {
                     copyDestination = tempDestination.concat(backupName).concat(FILE_SEPARATOR).concat(worldContainer).concat(FILE_SEPARATOR).concat(currentWorldName);
                 }
-                
+
                 // Create this folder.
                 FileUtils.checkFolderAndCreate(new File(copyDestination));
 

+ 11 - 15
src/main/java/com/bukkitbackup/full/utils/FileUtils.java

@@ -26,7 +26,6 @@ import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
 import java.util.zip.ZipOutputStream;
 
 /**
@@ -62,9 +61,7 @@ public class FileUtils {
     public FileUtils() {
         super();
     }
-
     public static int BUFFER_SIZE = 10240;
-
     /**
      * The number of bytes in a kilobyte.
      */
@@ -292,8 +289,8 @@ public class FileUtils {
         if (destFile.exists() && destFile.isDirectory()) {
             throw new IOException("Destination '" + destFile + "' exists but is a directory");
         }
-        if(!srcFile.exists()){
-            throw new IOException("Source file '"+srcFile+"' does not exist");
+        if (!srcFile.exists()) {
+            throw new IOException("Source file '" + srcFile + "' does not exist");
         }
         FileInputStream fis = null;
         FileOutputStream fos = null;
@@ -589,7 +586,7 @@ public class FileUtils {
      * @param sourceDIR The source directory. (ex: "backups/temp/xxxxxxxx")
      * @param finalDIR The final destination. (ex: "backups/xxxxxxxx")
      */
-    public static void doCopyAndZIP(String sourceDIR, String finalDIR, boolean shouldZIP, boolean  useTempFolder) {
+    public static void doCopyAndZIP(String sourceDIR, String finalDIR, boolean shouldZIP, boolean useTempFolder) {
 
         if (useTempFolder) {
             if (shouldZIP) {
@@ -635,19 +632,18 @@ public class FileUtils {
 
     }
 
-
     public static File[] listFilesInDir(File directory) {
         // List all the files inside this folder.
-            File[] filesList = directory.listFiles(new FileFilter() {
-                public boolean accept(File file) {
-                    return file.isFile();
-                }
-            });
-            return filesList;
-    }
+        File[] filesList = directory.listFiles(new FileFilter() {
 
+            public boolean accept(File file) {
+                return file.isFile();
+            }
+        });
+        return filesList;
+    }
 
-        public static int getTotalFolderSize(File folder) {
+    public static int getTotalFolderSize(File folder) {
         int bytes = 0;
         File[] filelist = folder.listFiles();
         for (int i = 0; i < filelist.length; i++) {

+ 1 - 2
src/main/java/com/bukkitbackup/full/utils/LogUtils.java

@@ -19,6 +19,7 @@ public class LogUtils {
             }
             LogUtils.plugin = plugin;
         }
+        LogUtils.logToConsole = true;
     }
 
     public static void finishInitLogUtils(boolean logToConsole) {
@@ -42,7 +43,6 @@ public class LogUtils {
             }
 
         } else {
-
             if (logToConsole && print) {
                 logger.log(Level.INFO, "[".concat(plugin.getDescription().getName()).concat("] ").concat(message));
             }
@@ -58,5 +58,4 @@ public class LogUtils {
         sendLog("Please provide following error with support request:");
         ste.printStackTrace(System.out);
     }
-
 }

+ 15 - 12
src/main/java/com/bukkitbackup/full/utils/MetricUtils.java

@@ -49,11 +49,11 @@ public class MetricUtils {
         guid = configuration.getString("guid");
     }
 
-
     /**
-     * Start measuring statistics. This will immediately create an async repeating task as the plugin and send
-     * the initial data to the metrics backend, and then after that it will post in increments of
-     * PING_INTERVAL * 1200 ticks.
+     * Start measuring statistics. This will immediately create an async
+     * repeating task as the plugin and send the initial data to the metrics
+     * backend, and then after that it will post in increments of PING_INTERVAL
+     * * 1200 ticks.
      *
      * @return True if statistics measuring is running, otherwise false.
      */
@@ -108,7 +108,7 @@ public class MetricUtils {
      * @return
      */
     public boolean isOptOut() {
-        synchronized(optOutLock) {
+        synchronized (optOutLock) {
             try {
                 // Reload the metrics file
                 configuration.load(configurationFile);
@@ -122,7 +122,8 @@ public class MetricUtils {
     }
 
     /**
-     * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
+     * Enables metrics for the server by setting "opt-out" to false in the
+     * config file and starting the metrics task.
      *
      * @throws IOException
      */
@@ -143,7 +144,8 @@ public class MetricUtils {
     }
 
     /**
-     * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
+     * Disables metrics for the server by setting "opt-out" to true in the
+     * config file and canceling the metrics task.
      *
      * @throws IOException
      */
@@ -220,7 +222,8 @@ public class MetricUtils {
     }
 
     /**
-     * Check if mineshafter is present. If it is, we need to bypass it to send POST requests
+     * Check if mineshafter is present. If it is, we need to bypass it to send
+     * POST requests
      *
      * @return
      */
@@ -234,8 +237,9 @@ public class MetricUtils {
     }
 
     /**
-     * <p>Encode a key/value data pair to be used in a HTTP post request. This INCLUDES a & so the first
-     * key/value pair MUST be included manually, e.g:</p>
+     * <p>Encode a key/value data pair to be used in a HTTP post request. This
+     * INCLUDES a & so the first key/value pair MUST be included manually,
+     * e.g:</p>
      * <code>
      * StringBuffer data = new StringBuffer();
      * data.append(encode("guid")).append('=').append(encode(guid));
@@ -260,5 +264,4 @@ public class MetricUtils {
     private static String encode(String text) throws UnsupportedEncodingException {
         return URLEncoder.encode(text, "UTF-8");
     }
-
-}
+}

+ 22 - 14
src/main/resources/config.yml

@@ -10,14 +10,6 @@
 # Format: [Time][M-Minutes, H-Hours, D-Days, W-Weeks]
 backupinterval: 15M
 
-## Should the backup stop the schedule after the first backup? (Default: false)
-# If enabled, one backup will be performed at the time specified under backupinterval.
-norepeat: false
-
-## Option to always perform a /save-all on backup schedule. (Default: false)
-# If false, /save-all's are only performed when a backup is required.
-alwayssaveall: false
-
 ## Enable scheduled save-all? (Default: "0" / Off)
 # (Note: -1 or 0 disables this feature.)
 # Format: [Time][M-Minutes, H-Hours, D-Days, W-Weeks]
@@ -33,6 +25,14 @@ maxbackups: 25
 # When the last player leaves the server, a final backup will be made. The automatic backup cycle will resume when a player re-joins.
 backupemptyserver: false
 
+## Should the backup stop the schedule after the first backup? (Default: false)
+# If enabled, one backup will be performed at the time specified under backupinterval.
+norepeat: false
+
+## Option to always perform a /save-all on backup schedule. (Default: false)
+# If false, /save-all's are only performed when a backup is required.
+alwayssaveall: false
+
 ## If permissions system is un-available, should everyone be able to access all commands, or just ops? (Default: true)
 # If set to false, all players will be able to perform all commands, unless you use a permissions system.
 onlyops: true
@@ -64,8 +64,7 @@ usetemp: true
 ## Name for the temp folder. (Default: none)
 # This stores tempoary files while backup is in progress.
 # Note: Path can be relative, or absolute. ('D:\temp', '/tmp', 'temp', and '~/backups/temp' are all valid)
-# if this si not set, it defaults to a temp folder under the backups folder.
-# Needs to be false to be compatible with WorldEdit.
+# If this is not set, it defaults to a temp folder under the backups folder.
 tempfoldername:
 
 ## Whether to ZIP Backups or not. (Default: true)
@@ -73,8 +72,7 @@ tempfoldername:
 # If disabled, the backup will stored in a folder with the timestamp.
 zipbackup: true
 
-## Should all the worlds be split into their own files? (Default: false)
-# Needs to be true to be compatible with WorldEdit.
+## Should all the worlds be split into their own foders? (Default: false)
 splitbackup: false
 
 ## Customize the date format for each backup. (Default: '%1$tY-%1$tm-%1$td-%1$tH-%1$tM-%1$tS' [YYYY-MM-DD-HH-MM-SS])
@@ -84,6 +82,16 @@ dateformat: '%1$tY-%1$tm-%1$td-%1$tH-%1$tM-%1$tS'
 
 #======== FTP Server Settings ==========#
 
+###########################################################
+##             !!!  Warning on FTP  !!!                  ##
+## This implementation relies on Sun's implemenentation  ##
+##  of the FTP protocol, and depending on the version    ##
+##  of Java you have installed, it may or may not work.  ##
+##     You need sun.net.ftp.FtpClient in your JRE.       ##
+##    Please tell me if this works/doesn't for you.      ##
+###########################################################
+
+
 ## Should we enable FTP uploads? (Default: false)
 # If enabled, following options must be set.
 # zipbackup must be true for this to take effect.
@@ -146,5 +154,5 @@ enableversioncheck: true
 ##   Internal Settings (Read: DO NOT EDIT)   ##
 ###############################################
 
-requiredstrings: str-101
-version: 2.0-dev
+requiredstrings: str-200
+version: 2.0

+ 1 - 1
src/main/resources/plugin.yml

@@ -1,5 +1,5 @@
 name: Backup
-version: 2.0-dev
+version: 2.0
 description: A full and simple backup plugin.
 authors: [Meldanor, gamerx, lycano]
 website: http://www.bukkitbackup.com/

+ 7 - 9
src/main/resources/strings.yml

@@ -8,19 +8,17 @@
 
 #========= In-Game Strings ==========#
 
-norights             : '[Backup] You do not have enough rights to run the backup!'
-confuptodate         : '[Backup] Config file is already Up-To-Date!'
-backupfinished       : '[Backup] Finished Backup!'
 backupstarted        : '[Backup] Started Backup...'
-updateconf           : '[Backup] Config upgrade requested, Upgrading...'
+backupfinished       : '[Backup] Finished Backup!'
+norights             : '[Backup] You do not have enough rights to run the backup!'
 reloadedok           : '[Backup] Reloaded %%ARG%% successfully!'
 gettingversions      : '[Backup] Please wait, Retrieving version information...'
 
 #========= Startup Strings ==========#
 
-stringsupdate        : Your strings file is out of date. It may stop working correctly if you do not update it.
-failedtogetpropsver  : Failed to retrieve version from config file, I suggest upgrading!
-configupdate         : Your configuration is outdated, please upgrade it. (backup upgradeconf)
+configupdate         : Your config file is outdated, please regenerate it.
+stringsupdate        : Your strings file is out of date, please regenerate it.
+failedtogetpropsver  : Failed to obtain version information from config file.
 zipdisabled          : You have disabled backup compression.
 defaultperms         : No permissions plugin detected, defaulting to OP.
 hookedperms          : Found and hooked a permissions plugin.
@@ -84,5 +82,5 @@ ftpuploadcomplete    : 'FTP: Upload Complete.'
 ###############################################
 
 stringnotfound       : 'String not found - '
-packagedwith         : 2.0-dev
-version              : str-101
+packagedwith         : 2.0
+version              : str-200