Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.core.mayodwarf.pokeballers.shop;
- import org.bukkit.Location;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.inventory.ItemStack;
- import java.io.File;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.List;
- /**
- * Created with IntelliJ IDEA.
- * User: MayoDwarf
- * Date: 1/31/14
- * Time: 5:27 PM
- * To change this template use File | Settings | File Templates.
- */
- public class Chest {
- private Main main;
- private File file = new File(main.getDataFolder(), "/plugins/PokeballersShop/Chest.yml");
- private File fold = new File(main.getDataFolder(), "/plugins/PokeballersShop");
- public Chest(Main main) {
- main = this.main;
- }
- public void createFiles() {
- if(!file.exists() && !fold.exists()) {
- try {
- file.createNewFile();
- fold.mkdir();
- } catch(IOException e) {
- e.printStackTrace();
- }
- }
- }
- //Performed when they left click it with a gold pick and are in ArrayList<String> AddChest
- public Chest(Location loc) {
- YamlConfiguration ycon = YamlConfiguration.loadConfiguration(file);
- ycon.set("Chests", loc);
- try {
- ycon.save(file);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- //Performed when they left click it with a gold pick and are in ArrayList<String> AddItem
- public void add(Location loc, List<ItemStack> items, List<Integer> price) {
- YamlConfiguration ycon = YamlConfiguration.loadConfiguration(file);
- for(int i = 0;i<items.length;i++){
- ycon.set("Chests."+loc+".items"+"."+items.get(i), price.get(i)); //This will be the list of items price for that item.
- //Will this work or how should I do it?
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment