Advertisement
Guest User

reloadFile() method

a guest
Dec 29th, 2012
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. public void reloadFile() {
  2.     if (!theFile.exists()) {
  3.         try {
  4.             theFile.mkdirs();
  5.             if (!theFile.createNewFile()) {
  6.                 throw new IOException("Failed to create the file.");
  7.             }
  8.         } catch (IOException e) {
  9.             Logger.getLogger("Minecraft").severe("Failed to create the file.");
  10.         }
  11.     }
  12.     theFileConfiguration = YamlConfiguration.loadConfiguration(theFile);
  13.  
  14.     InputStream defConfigStream = plugin.getResource("file.yml");
  15.     if (defConfigStream != null) {
  16.         YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
  17.         theFileConfiguration.setDefaults(defConfig);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement