View difference between Paste ID: FjfYCuPb and GVaBSfH1
SHOW: | | - or go back to the newest paste.
1
package com.core.mayodwarf.pokeballers.shop;
2
3
import org.bukkit.Location;
4
import org.bukkit.configuration.file.YamlConfiguration;
5
import org.bukkit.inventory.ItemStack;
6
7
import java.io.File;
8
import java.io.IOException;
9
import java.util.ArrayList;
10
import java.util.List;
11
12
/**
13
 * Created with IntelliJ IDEA.
14
 * User: MayoDwarf
15
 * Date: 1/31/14
16
 * Time: 5:27 PM
17
 * To change this template use File | Settings | File Templates.
18
 */
19
public class Chest {
20
    private Main main;
21
    private File file = new File(main.getDataFolder(), "/plugins/PokeballersShop/Chest.yml");
22
    private File fold = new File(main.getDataFolder(), "/plugins/PokeballersShop");
23
    public Chest(Main main) {
24
        main = this.main;
25
    }
26
    public void createFiles() {
27
        if(!file.exists() && !fold.exists()) {
28
        try {
29
            file.createNewFile();
30
            fold.mkdir();
31
            } catch(IOException e) {
32
            e.printStackTrace();
33
            }
34
        }
35
    }
36
    //Performed when they left click it with a gold pick and are in ArrayList<String> AddChest
37
    public Chest(Location loc) {
38
        YamlConfiguration ycon = YamlConfiguration.loadConfiguration(file);
39
        ycon.set("Chests", loc);
40
        try {
41
            ycon.save(file);
42
        } catch (IOException e) {
43
            e.printStackTrace();
44
        }
45
    }
46
    //Performed when they left click it with a gold pick and are in ArrayList<String> AddItem
47-
    public void add(Location loc, ItemStack item, String price) {
47+
    public void add(Location loc, List<ItemStack> items, List<Integer> price) {
48
        YamlConfiguration ycon = YamlConfiguration.loadConfiguration(file);
49-
        ycon.set("Chests."+loc+".items", item);   //This will be a list of items.
49+
	for(int i = 0;i<items.length;i++){
50-
        ycon.set("Chests."+loc+".items"+"."+item, price); //This will be the list of items price for that item.
50+
		ycon.set("Chests."+loc+".items"+"."+items.get(i), price.get(i)); //This will be the list of items price for that item.
51
        //Will this work or how should I do it?
52
	}
53
    }
54
}