Beispiel #1
0
 @Override
 public void reloadConfig() {
   super.reloadConfig();
   try {
     loadMsgConfig();
   } catch (IOException | InvalidConfigurationException e) {
     e.printStackTrace();
   }
 }
 @Override
 @SuppressWarnings("deprecation")
 public void reloadConfig() {
   if (configuration != null && configuration.isExtendedNames()) {
     NameCollection.unregisterPlugin(this);
   }
   super.reloadConfig();
   final FileConfiguration getConfig = getConfig();
   getConfig.options().copyDefaults(true);
   if (getConfig.isSet(BUY_PATTERN)) {
     getConfig.getConfigurationSection(BUY_SECTION).set(PATTERN, getConfig.getString(BUY_PATTERN));
     getConfig.set(BUY_PATTERN, null);
   }
   if (getConfig.isSet(SELL_PATTERN)) {
     getConfig
         .getConfigurationSection(SELL_SECTION)
         .set(PATTERN, getConfig.getString(SELL_PATTERN));
     getConfig.set(SELL_PATTERN, null);
   }
   configuration = new StandardConfig(this);
   if (configuration.isExtendedNames()) {
     NameCollection.registerPlugin(this);
   }
   showcaseListener.setStatus(configuration.isShowcaseEnabled());
   locale = new Localized(this);
   materialConfig = new MaterialConfig(this);
   try {
     if (getConfig.getBoolean(LOG_BLOCK)) {
       final Plugin logblockPlugin = getServer().getPluginManager().getPlugin("LogBlock");
       if (logblockPlugin == null || !(logblockPlugin instanceof LogBlock)) {
         getLogger().warning("Failed to find LogBlock");
         consumer = null;
       } else {
         consumer = ((LogBlock) logblockPlugin).getConsumer();
         if (consumer == null) {
           getLogger().warning("Error getting LogBlock consumer");
         } else {
           getLogger().info("Sucessfully hooked into LogBlock");
         }
       }
     } else {
       consumer = null;
       getLogger().info("Did not hook into LogBlock");
     }
   } catch (final Throwable t) {
     consumer = null;
     getLogger().log(Level.SEVERE, "Error handling LogBlock", t);
   }
 }
 public VersionUpdater(JavaPlugin instance) {
   FileConfiguration fconf = instance.getConfig();
   List<String> messages = fconf.getStringList("Messages");
   int interval = fconf.getInt("Interval");
   boolean inSec = fconf.getBoolean("InSeconds");
   boolean debug = fconf.getBoolean("Debug");
   File configFile = new File(instance.getDataFolder(), "config.yml");
   configFile.delete();
   instance.saveDefaultConfig();
   instance.reloadConfig();
   fconf = instance.getConfig();
   fconf.set("Interval", interval);
   fconf.set("InSeconds", inSec);
   fconf.set("Debug", debug);
   fconf.set("Messages", messages);
   instance.saveConfig();
 }
Beispiel #4
0
  public void loadConfig() {
    // copy default config.yml into place if it's not there
    File file = new File(getDataFolder(), "config.yml");
    if (!file.exists()) {
      jarUtil.copyConfigFromJar("config.yml", file);
    }

    if (!configLoaded) {
      super.getConfig();
      configLoaded = true;
    } else super.reloadConfig();

    logOresConfig = new LogOresConfig(this);
    logOresConfig.processConfig();

    if (blockListener != null) blockListener.reloadConfig();
    if (oreProcessor != null) oreProcessor.reloadConfig();
  }
Beispiel #5
0
 public FileConfiguration getConfig() {
   if (newConfig == null) {
     reloadConfig();
   }
   return newConfig;
 }