本文整理了Java中org.bukkit.configuration.file.YamlConfiguration.getString()
方法的一些代码示例,展示了YamlConfiguration.getString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlConfiguration.getString()
方法的具体详情如下:
包路径:org.bukkit.configuration.file.YamlConfiguration
类名称:YamlConfiguration
方法名:getString
暂无
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public String getString(Key key) {
if (cache.containsKey(key)) {
return cache.get(key).toString();
}
String string = config.getString(key.path, key.def.toString());
cache.put(key, string);
return string;
}
代码示例来源:origin: GlowstoneMC/Glowstone
@Override
public String getString(Key key) {
if (parameters.containsKey(key)) {
return parameters.get(key).toString();
}
String string = config.getString(key.path, key.def.toString());
parameters.put(key, string);
return string;
}
代码示例来源:origin: stackoverflow.com
YamlConfiguration configuracion = YamlConfiguration.loadConfiguration(configFile);
String defpermisos = "";
String textpermisos = configuracion.getString("Configuration.NoPermissionsMessage", defpermisos);
String permisos = ChatColor.translateAlternateColorCodes('&', textpermisos);
String defprefix = "";
String textprefix = configuracion.getString("Configuration.Prefix", defprefix);
String prefix = ChatColor.translateAlternateColorCodes('&', textprefix);
代码示例来源:origin: stackoverflow.com
YamlConfiguration configuracion = YamlConfiguration.loadConfiguration(configFile);
String textpermisos = configuracion.getString("Configuration.NoPermissionsMessage");
String permisos = null;
if (textpermisos != null)
permisos = ChatColor.translateAlternateColorCodes('&', textpermisos);
String prefixtext = configuracion.getString("Configuration.Prefix");
String prefix = null;
if (prefixtext != null)
prefix = ChatColor.translateAlternateColorCodes('&', prefixtext);
代码示例来源:origin: com.greatmancode/tools
@Override
public String getString(String path) {
return configFile.getString(path);
}
代码示例来源:origin: DevLeoko/AdvancedBan
@Override
public String getString(Object file, String path) {
return ((YamlConfiguration) file).getString(path);
}
代码示例来源:origin: BentoBoxWorld/BentoBox
private AddonDescription asDescription(YamlConfiguration data) {
AddonDescription.Builder builder = new AddonDescription.Builder(data.getString("main"), data.getString("name"), data.getString("version"))
.authors(data.getString("authors"))
.metrics(data.getBoolean("metrics"));
if (data.getString("depend") != null) {
builder.dependencies(Arrays.asList(data.getString("depend").split("\\s*,\\s*")));
}
if (data.getString("softdepend") != null) {
builder.softDependencies(Arrays.asList(data.getString("softdepend").split("\\s*,\\s*")));
}
return builder.build();
}
代码示例来源:origin: drtshock/PlayerVaults
@Override
public String toString() {
if (this == TITLE) {
return ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def)) + " ";
}
return ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def));
}
代码示例来源:origin: BentoBoxWorld/BentoBox
/**
* Get text from the yml file for this locale
* @param reference - the YAML node where the text is
* @return Text for this locale reference or the reference if nothing has been found
*/
public String get(String reference) {
if (config.contains(reference)) {
return config.getString(reference);
}
return reference; // return reference in case nothing has been found
}
代码示例来源:origin: ProSavage/SavageFactions
@Override
public String toString() {
return ChatColor.translateAlternateColorCodes('&', LANG.getString(this.path, def)) + (this == TITLE ? " ":"");
}
代码示例来源:origin: mcMMO-Dev/mcMMO
/**
* Load formula file.
*/
public void loadFormula() {
if (!formulaFile.exists()) {
previousFormula = FormulaType.UNKNOWN;
return;
}
previousFormula = FormulaType.getFormulaType(YamlConfiguration.loadConfiguration(formulaFile).getString("Previous_Formula", "UNKNOWN"));
}
代码示例来源:origin: BentoBoxWorld/BentoBox
public BentoBoxLocale(Locale locale, YamlConfiguration config) {
this.locale = locale;
this.config = config;
// Load the banner from the configuration
banner = ItemParser.parse(config.getString("meta.banner"));
// Load authors from the configuration
authors = new LinkedList<>();
updateAuthors(config);
}
代码示例来源:origin: drtshock/PlayerVaults
/**
* Gets an inventory without storing references to it. Used for dropping a players inventories on death.
*
* @param holder The holder of the vault.
* @param number The vault number.
* @return The inventory of the specified holder and vault number. Can be null.
*/
public Inventory getVault(String holder, int number) {
YamlConfiguration playerFile = getPlayerVaultFile(holder, true);
String serialized = playerFile.getString(String.format(VAULTKEY, number));
return Base64Serialization.fromBase64(serialized);
}
代码示例来源:origin: NyaaCat/RPGItems-reloaded
public static String getProperty(Power p, String property, Field field) {
YamlConfiguration configuration = new YamlConfiguration();
try {
saveProperty(p, configuration, property, field);
} catch (IllegalAccessException e) {
RPGItems.plugin.getLogger().log(Level.WARNING, "Error getting property " + property + " from " + field + " in " + p, e);
return null;
}
return configuration.getString(property);
}
代码示例来源:origin: sgtcaze/NametagEdit
public static PlayerData fromFile(String key, YamlConfiguration file) {
if (!file.contains("Players." + key)) return null;
PlayerData data = new PlayerData();
data.setUuid(UUID.fromString(key));
data.setName(file.getString("Players." + key + ".Name"));
data.setPrefix(file.getString("Players." + key + ".Prefix", ""));
data.setSuffix(file.getString("Players." + key + ".Suffix", ""));
data.setSortPriority(file.getInt("Players." + key + ".SortPriority", -1));
return data;
}
代码示例来源:origin: sgtcaze/NametagEdit
private void loadGroups() {
List<GroupData> groupData = new ArrayList<>();
for (String groupName : groups.getConfigurationSection("Groups").getKeys(false)) {
GroupData data = new GroupData();
data.setGroupName(groupName);
data.setPermission(groups.getString("Groups." + groupName + ".Permission", "nte.default"));
data.setPrefix(groups.getString("Groups." + groupName + ".Prefix", ""));
data.setSuffix(groups.getString("Groups." + groupName + ".Suffix", ""));
data.setSortPriority(groups.getInt("Groups." + groupName + ".SortPriority", -1));
groupData.add(data);
}
handler.assignGroupData(groupData);
}
代码示例来源:origin: Bkm016/TabooLib
public static List<String> asStringList(String path, String... args) {
try {
return asStringList(path, Ref.getCallerClass(3).orElse(Main.class), args);
} catch (Exception e) {
TLib.getTLib().getLogger().error(Strings.replaceWithOrder(TLib.getInternalLanguage().getString("LOCALE-ERROR-REASON"), e.getMessage()));
return Collections.singletonList("§4<" + path + "§4>");
}
}
代码示例来源:origin: Bkm016/TabooLib
public static String asString(String path, String... args) {
try {
return asString(path, Ref.getCallerClass(3).orElse(Main.class), args);
} catch (Exception e) {
TLib.getTLib().getLogger().error(Strings.replaceWithOrder(TLib.getInternalLanguage().getString("FETCH-LOCALE-ERROR"), path));
TLib.getTLib().getLogger().error(Strings.replaceWithOrder(TLib.getInternalLanguage().getString("LOCALE-ERROR-REASON"), e.getMessage()));
return "§4<" + path + "§4>";
}
}
代码示例来源:origin: io.github.bedwarsrel/BedwarsRel-Common
@Override
public String getString(String path) {
if (super.get(path) == null) {
BedwarsRel.getInstance().getServer().getConsoleSender()
.sendMessage(ChatWriter
.pluginMessage(ChatColor.GOLD + "No translation found for: \"" + path + "\""));
return "LOCALE_NOT_FOUND";
}
return ChatColor.translateAlternateColorCodes('&', super.getString(path));
}
代码示例来源:origin: BedwarsRel/BedwarsRel
@Override
public String getString(String path) {
if (super.get(path) == null) {
BedwarsRel.getInstance().getServer().getConsoleSender()
.sendMessage(ChatWriter
.pluginMessage(ChatColor.GOLD + "No translation found for: \"" + path + "\""));
return "LOCALE_NOT_FOUND";
}
return ChatColor.translateAlternateColorCodes('&', super.getString(path));
}
内容来源于网络,如有侵权,请联系作者删除!