So, this might sound a little noobish, but I'm not so familiar with the old event system. I'm trying to update a plugin from the 1.8 Beta days. This is the piece of source that is bothering me. Code: this.slot_wheel[i] = new SlotWheelEntry(material, slotMachine.getNode("wheel." + s_material)); So what's then problem? Well the getNode is really outdated and I don't know how to update it =/. Can somebody tell me where I replace it with. I already tried getString or getStringList but none of them work. Thanks - Miguel
O I'm sorry. Well this is the complete function of the method Code: public void load() { if (!this.file.exists()) { ConfigUtils.extract(this.file.getParentFile(), new String[] { this.file.getName() }); } File configFile = new File(plugin.getDataFolder() + "/config.yml");//FileConfiguration(this.file); FileConfiguration config =YamlConfiguration.loadConfiguration(configFile); config.options().copyDefaults(true); ConfigurationSection slotMachine; config.getString("slot_machine"); this.slot_price = slotMachine.getDouble("price", 45.0D); List wheel = slotMachine.getStringList("wheel"); this.slot_wheel = new SlotWheelEntry[wheel.size()]; for (int i = 0; i < wheel.size(); i++) { String s_material = (String)wheel.get(i); Material material = null; try { material = Material.valueOf(s_material.toUpperCase()); } catch (Exception exception) { material = Material.DIRT; } this.slot_wheel[i] = new SlotWheelEntry(material, slotMachine.getNode("wheel." + s_material)); } ConfigurationSection wheelFortune; config.getString("wheel_fortune"); this.wheel_price = wheelFortune.getDouble("price", 250.0D); String wheel_item = wheelFortune.getString("item", "GOLD_INGOT"); try { this.wheel_item = Material.valueOf(wheel_item.toUpperCase()); } catch (Exception exception) { this.wheel_item = Material.GOLD_INGOT; } this.wheel_item_divisor = wheelFortune.getInt("item_divisor", 500); } As you see I don't know where to replace the getNode with =/ Thanks Miguel!
Code: private File file; FileConfiguration config; private double slot_price; private SlotWheelEntry[] slot_wheel; private double wheel_price; private Material wheel_item; private int wheel_item_divisor; public ConfigLoader(File file) { this.file = file; public class SlotWheelEntry { private Material material; private Material item; private int item_count; private double money_count; public SlotWheelEntry(Material material, Configuration node) { this.material = material; String item = node.getString("item", "GOLD_INGOT"); try { this.item = Material.valueOf(item.toUpperCase()); } catch(Exception exception) { this.item = Material.COOKIE; } this.item_count = node.getInt("item_count", 4); this.money_count = node.getDouble("money_count", 250.0); } public Material getMaterial() { return this.material; } public Material getItem() { return this.item; } public int getItemCount() { return this.item_count; } public double getMoneyCount() { return this.money_count; } } This is the SlotWheelEntry Thanks again, Miguel!
you need to chace the consturctor to take an ConfigurationSection as last param, and you need to call getConfigurationSection( instead of getNode(