gpt4 book ai didi

com.avairebot.config.YamlConfiguration.getString()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 00:51:31 27 4
gpt4 key购买 nike

本文整理了Java中com.avairebot.config.YamlConfiguration.getString()方法的一些代码示例,展示了YamlConfiguration.getString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlConfiguration.getString()方法的具体详情如下:
包路径:com.avairebot.config.YamlConfiguration
类名称:YamlConfiguration
方法名:getString

YamlConfiguration.getString介绍

暂无

代码示例

代码示例来源:origin: avaire/avaire

/**
 * Gets the version of the plugin.
 *
 * @return The version of the plugin.
 */
public String getVersion() {
  return configuration.getString("version");
}

代码示例来源:origin: avaire/avaire

PluginLoader(File file, File dataFolder) throws InvalidPluginException, IOException {
  this.file = file;
  this.dataFolder = dataFolder;
  if (!file.exists()) {
    throw new InvalidPluginException(file.getPath() + " does not exists");
  }
  jarFile = new JarFile(file);
  configuration = YamlConfiguration.loadConfiguration(new InputStreamReader(getResource("plugin.yml")));
  checkIfPluginYamlIsValid();
  if (configuration.contains("authors")) {
    authors.addAll(configuration.getStringList("authors"));
  } else if (configuration.contains("author")) {
    authors.add(configuration.getString("author"));
  }
  classLoader = new PluginClassLoader(this, AvaIre.class.getClassLoader(), dataFolder, file);
}

代码示例来源:origin: avaire/avaire

/**
 * Gets the name of the plugin.
 *
 * @return The name of the plugin.
 */
public String getName() {
  return configuration.getString("name");
}

代码示例来源:origin: avaire/avaire

/**
 * Gets the full class package path to the main class for the plugin.
 *
 * @return The full class package path to th main class for the plugin.
 */
public String getMain() {
  return configuration.getString("main");
}

代码示例来源:origin: avaire/avaire

/**
 * Gets the description of the plugin.
 *
 * @return Possibly-null, the description of the plugin.
 */
@Nullable
public String getDescription() {
  return configuration.getString("description");
}

代码示例来源:origin: avaire/avaire

/**
 * Gets the given string from the guilds selected language, if not string
 * was found for the guilds selected language, the default language
 * will be used instead, if no matches was found there either,
 * then <code>NULL</code> will be returned instead.
 *
 * @param guild  The JDA guild instance that should be used for loading the language.
 * @param string The string that should be loaded from the language files.
 * @return The language string from the given guilds selected language, or the default
 * language if it doesn't exists in the guilds selected language, or
 * <code>NULL</code> if it doesn't exist anywhere.
 */
@Nullable
public static String getString(@Nullable Guild guild, String string) {
  if (string == null) {
    return null;
  }
  return get(guild).getString(string, defaultLanguage.getConfig().getString(string, null));
}

代码示例来源:origin: avaire/avaire

@Override
@CheckReturnValue
public String i18nRaw(@Nonnull String key) {
  if (getI18n().contains(key)) {
    return getI18n().getString(key)
      .replace("\\n", "\n")
      .replace("\\t", "\t");
  } else {
    log.warn("Missing language entry for key {} in language {}", key, I18n.getLocale(getGuild()).getLanguage().getCode());
    return I18n.getDefaultLanguage().getConfig().getString(key)
      .replace("\\n", "\n")
      .replace("\\t", "\t");
  }
}

代码示例来源:origin: avaire/avaire

private void checkIfPluginYamlIsValid() throws InvalidPluginException {
  if (!configuration.contains("name")) {
    throw new InvalidPluginException(file.getName() + ": Invalid plugin.yml file, the plugin must have a name value at root!");
  }
  if (!configuration.contains("main")) {
    throw new InvalidPluginException(getName() + ": Invalid plugin.yml file, the plugin must have a main value at root!");
  }
  if (!configuration.contains("version")) {
    throw new InvalidPluginException(getName() + ": Invalid plugin.yml file, the plugin must have a version value at root!");
  }
  if (configuration.contains("requires") && !compareVersion(configuration.getString("requires"))) {
    throw new InvalidPluginException(getName() + ": Invalid plugin.yml file, the plugin requires AvaIre version %s or higher to work correctly!",
      configuration.getString("requires")
    );
  }
}

代码示例来源:origin: avaire/avaire

.getConfig().getString("music.internal.endedDueToInactivity", "The music has ended due to inactivity."))
.queue();

代码示例来源:origin: avaire/avaire

@Test
public void testLanguagesDoesNotReturnNull() {
  Set<String> defaultStrings = getKeys(I18n.getDefaultLanguage());
  for (LanguageContainer entry : I18n.languages) {
    for (String str : defaultStrings) {
      assertNotNull(entry.getConfig().getString(str), str + " in the " + entry.getLanguage().getEnglishName() + " language files was not found!");
    }
  }
}

代码示例来源:origin: avaire/avaire

MessageFactory.makeWarning(message, I18n.get(message.getGuild()).getString(
  "music.internal.musicChannel",
  "You can only use music commands in the :channel channel."

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com