public void reloadConfig() { if (storage != null) { storage.onPluginDeactivation(); } for (ProtectConfig protectConfig : ProtectConfig.values()) { if (protectConfig.isList()) { settingsList.put( protectConfig, ess.getSettings().getProtectList(protectConfig.getConfigName())); } else if (protectConfig.isString()) { settingsString.put( protectConfig, ess.getSettings().getProtectString(protectConfig.getConfigName())); } else { settingsBoolean.put( protectConfig, ess.getSettings() .getProtectBoolean( protectConfig.getConfigName(), protectConfig.getDefaultValueBoolean())); } } if (getSettingString(ProtectConfig.datatype).equalsIgnoreCase("mysql")) { try { storage = new ProtectedBlockMySQL( getSettingString(ProtectConfig.mysqlDB), getSettingString(ProtectConfig.dbUsername), getSettingString(ProtectConfig.dbPassword)); } catch (PropertyVetoException ex) { LOGGER.log(Level.SEVERE, null, ex); } } else { try { storage = new ProtectedBlockSQLite("jdbc:sqlite:plugins/Essentials/EssentialsProtect.db"); } catch (PropertyVetoException ex) { LOGGER.log(Level.SEVERE, null, ex); } } if (getSettingBool(ProtectConfig.memstore)) { storage = new ProtectedBlockMemory(storage, this); } }
public void onDisable() { if (storage != null) { storage.onPluginDeactivation(); } }