本文整理了Java中org.bukkit.configuration.file.YamlConfiguration.getItemStack()
方法的一些代码示例,展示了YamlConfiguration.getItemStack()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlConfiguration.getItemStack()
方法的具体详情如下:
包路径:org.bukkit.configuration.file.YamlConfiguration
类名称:YamlConfiguration
方法名:getItemStack
暂无
代码示例来源:origin: EpicEricEE/ShopChest
/**
* Decodes an {@link ItemStack} from a Base64 String
* @param string Base64 encoded String to decode
* @return Decoded {@link ItemStack}
*/
public static ItemStack decode(String string) {
YamlConfiguration config = new YamlConfiguration();
try {
config.loadFromString(new String(Base64.getDecoder().decode(string), StandardCharsets.UTF_8));
} catch (IllegalArgumentException | InvalidConfigurationException e) {
e.printStackTrace();
return null;
}
return config.getItemStack("i", null);
}
代码示例来源:origin: elBukkit/MagicPlugin
public static ItemStack getReplacement(ItemStack itemStack) {
String serialized = getMetaString(itemStack, "replacement");
if (serialized == null || serialized.isEmpty()) {
return null;
}
YamlConfiguration configuration = new YamlConfiguration();
ItemStack replacement = null;
try {
configuration.loadFromString(serialized);
replacement = configuration.getItemStack("item");
} catch (Exception ex) {
ex.printStackTrace();
}
return replacement;
}
内容来源于网络,如有侵权,请联系作者删除!