public void loadCarpets() {
   File carpetDat = carpetsFile();
   if (!carpetDat.exists()) {
     return;
   }
   log.info("Loading carpets...");
   try {
     FileInputStream file = new FileInputStream(carpetDat);
     ObjectInputStream in = new ObjectInputStream(file);
     carpets = (CarpetStorage) in.readObject();
     carpets.attach(this);
     in.close();
   } catch (IOException e) {
     log.warning("Error loading carpets.dat; carpets data has not been loaded.");
   } catch (ClassNotFoundException e) {
     log.severe("CarpetStorage class not found! This should never happen!");
   }
   carpets.checkCarpets();
 }
 public void saveCarpets() {
   File carpetDat = carpetsFile();
   log.info("Saving carpets...");
   if (!carpetDat.exists()) {
     try {
       carpetDat.createNewFile();
     } catch (IOException e) {
       log.severe("Unable to create carpets.dat; IOException");
     }
   }
   try {
     FileOutputStream file = new FileOutputStream(carpetDat);
     ObjectOutputStream out = new ObjectOutputStream(file);
     out.writeObject(carpets);
     out.close();
   } catch (IOException e) {
     log.warning("Error writing to carpets.dat; carpets data has not been saved!");
   }
   carpets.clear();
 }
 @Override
 public void onEnable() {
   log = getLogger();
   if (!getDataFolder().exists()) {
     getDataFolder().mkdirs();
   }
   config = getConfig();
   configFile = new File(getDataFolder(), "config.yml");
   if (configFile.exists()) {
     loadSettings();
   } else {
     saveSettings();
   }
   if (saveCarpets) {
     loadCarpets();
   }
   registerEvents(magicListener);
   registerCommands();
   getWorldGuard();
   getVault();
   startStats();
   log.info("is now enabled!");
 }