本文整理匯總了Java中org.bukkit.configuration.file.FileConfiguration.isSet方法的典型用法代碼示例。如果您正苦於以下問題:Java FileConfiguration.isSet方法的具體用法?Java FileConfiguration.isSet怎麽用?Java FileConfiguration.isSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.configuration.file.FileConfiguration
的用法示例。
在下文中一共展示了FileConfiguration.isSet方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getCrafts
import org.bukkit.configuration.file.FileConfiguration; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public ArrayList<CraftArray> getCrafts(){
ArrayList<CraftArray> craftlist = new ArrayList<CraftArray>();
try {
File craftfile = new File(plugin.getDataFolder(), "crafts.yml");
craftfile.createNewFile();
FileConfiguration craftconfig = YamlConfiguration.loadConfiguration(craftfile);
if(craftconfig.isSet("Crafts")) {
for(String craftpath : craftconfig.getConfigurationSection("Crafts").getKeys(false)) {
craftpath = "Crafts." + craftpath;
ArrayList<ItemStack> config_craft = (ArrayList<ItemStack>) craftconfig.getList(craftpath + ".craft");
ArrayList<ItemStack> config_resultitems = (ArrayList<ItemStack>) craftconfig.getList(craftpath + ".result.items");
ArrayList<Integer> config_resultprobs = (ArrayList<Integer>) craftconfig.getIntegerList(craftpath + ".result.probs");
HashMap<ItemStack,Integer> config_result = new HashMap<ItemStack, Integer>();
for(ItemStack resultitem : config_resultitems) {
config_result.put(resultitem, config_resultprobs.get(config_resultitems.indexOf(resultitem)));
}
ArrayList<String> config_cmds = (ArrayList<String>) craftconfig.getStringList(craftpath + ".cmds");
boolean config_redstonepower = craftconfig.getBoolean(craftpath + ".redstonepower");
int config_experience = craftconfig.getInt(craftpath + ".experience");
CraftArray specraft = new CraftArray(config_craft, config_result, config_cmds, config_redstonepower, config_experience);
craftlist.add(specraft);
}
return craftlist;
} else {
return craftlist;
}
} catch (Exception e) {
e.printStackTrace();
return craftlist;
}
}