Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. File location = new File(MageSpells.getInstance().getDataFolder() + "/Spells/");
  2. if (location.exists()) {
  3. MageSpells.getInstance().logger.info("Loading Spells...");
  4. for (File fileData : location.listFiles()) {
  5. try {
  6. if(!fileData.isHidden()) {
  7. YamlConfiguration config = YamlConfiguration.loadConfiguration(fileData);
  8. String spellName = FilenameUtils.getBaseName(fileData.getName());
  9. SpellObject spellData = deformatData(spellName, config, fileData);
  10. if(spellData!= null) {
  11. MageSpells.getMageSpellsManager().getSpellManager().addSpellObject(spellData);
  12. // main.logger.info(spellData.getName() + " loaded.");
  13. }else{
  14. MageSpells.getInstance().logger.info("Error loading " + spellName);
  15. }
  16. }
  17. } catch (Exception e) {
  18. System.out.println("Error with file " + fileData.getName());
  19. e.printStackTrace();
  20. }
  21. }
  22. //deformats, saves to pregamedata
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement