public void reload() { myConfig.config = YamlConfiguration.loadConfiguration(new File(FilePath.config)); Msg.file = YamlConfiguration.loadConfiguration(new File(FilePath.messages)); ClazzLoader.classes = YamlConfiguration.loadConfiguration(new File(FilePath.classes)); Manager.cancelTask(backupTask); if (myConfig.getBackupTime() > 0) backupTask = Manager.scheduleRepeatingTask( DataFolder.backupTask(), 20L * 60L * myConfig.getBackupTime(), 20L * 60L * myConfig.getBackupTime()); }
public void onEnable() { initSupportedVersions(); String pN = Bukkit.getServer().getClass().getPackage().getName(); version = pN.substring(pN.lastIndexOf(".") + 1); if (!supportedVersions.contains(version)) { getLogger().warning("You are using an unsupported version of bukkit (" + version + ")!"); getLogger().warning("The plugin probably won't work correctly with this version!"); } mkdir(); Manager.plugin = this; cmdReg = new CommandRegister(); myConfig.init(); createMIC(); createSpellCollection(); Manager.load(); getServer().getPluginManager().registerEvents(new myListener(), this); getServer().getPluginManager().registerEvents(new DamageListener(), this); getServer().getPluginManager().registerEvents(new VillagerListener(), this); Manager.scheduleRepeatingTask(Manager.getTask(), 20L, 1L); if (myConfig.getBackupTime() > 0) backupTask = Manager.scheduleRepeatingTask( DataFolder.backupTask(), 20L * 60L * myConfig.getBackupTime(), 20L * 60L * myConfig.getBackupTime()); searchForNewVersion(); getLogger().info(getDescription().getFullName() + " enabled!"); }