Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 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
  23. }
  24. public SpellObject deformatData(String spellName, YamlConfiguration config, File file) {
  25. try {
  26. String displayname = Utils.colorize(config.getString("DisplayName"));
  27. String lore = Utils.colorize(config.getString("Lore"));
  28. if(!config.contains("Visible")){
  29. config.createSection("Visible");
  30. config.set("Visible", true);
  31. }
  32. boolean visible = config.getBoolean("Visible");
  33. String spellnode = config.getString("SpellNode");
  34. boolean boltenabled = config.getBoolean("Bolt.Enabled");
  35. int boltradius = config.getInt("Bolt.DamageRadius");
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement