diff --git a/.idea/artifacts/epicbuckets_jar.xml b/.idea/artifacts/epicbuckets_jar.xml
new file mode 100644
index 0000000..e7083be
--- /dev/null
+++ b/.idea/artifacts/epicbuckets_jar.xml
@@ -0,0 +1,34 @@
+
+
+ $APPLICATION_HOME_DIR$/Spigot Plugins
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml b/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml
new file mode 100644
index 0000000..4533c1b
--- /dev/null
+++ b/.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__com_google_guava_guava_17_0.xml b/.idea/libraries/Maven__com_google_guava_guava_17_0.xml
new file mode 100644
index 0000000..2a9069c
--- /dev/null
+++ b/.idea/libraries/Maven__com_google_guava_guava_17_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml b/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml
new file mode 100644
index 0000000..e60370e
--- /dev/null
+++ b/.idea/libraries/Maven__javax_persistence_persistence_api_1_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__net_milkbowl_vault_VaultAPI_1_6.xml b/.idea/libraries/Maven__net_milkbowl_vault_VaultAPI_1_6.xml
new file mode 100644
index 0000000..fa96a55
--- /dev/null
+++ b/.idea/libraries/Maven__net_milkbowl_vault_VaultAPI_1_6.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml b/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml
new file mode 100644
index 0000000..91f161a
--- /dev/null
+++ b/.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml b/.idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml
new file mode 100644
index 0000000..2fb4911
--- /dev/null
+++ b/.idea/libraries/Maven__org_bukkit_bukkit_1_9_R0_1_SNAPSHOT.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml b/.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml
new file mode 100644
index 0000000..02d9152
--- /dev/null
+++ b/.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..33b1838
--- /dev/null
+++ b/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: com.songoda.epicbuckets.EpicBuckets
+
diff --git a/src/main/java/com/songoda/epicbuckets/EpicBuckets.java b/src/main/java/com/songoda/epicbuckets/EpicBuckets.java
index 2193afa..7047f3f 100644
--- a/src/main/java/com/songoda/epicbuckets/EpicBuckets.java
+++ b/src/main/java/com/songoda/epicbuckets/EpicBuckets.java
@@ -13,10 +13,13 @@ import net.milkbowl.vault.permission.Permission;
import org.apache.commons.lang.ArrayUtils;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
+import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
+import java.io.File;
+
public class EpicBuckets extends JavaPlugin {
private static CommandSender console = Bukkit.getConsoleSender();
@@ -24,7 +27,7 @@ public class EpicBuckets extends JavaPlugin {
private static Permission permission = null;
private static Economy economy = null;
private static Chat chat = null;
- public ShopFile shopFile;
+ public YamlConfiguration shopFile;
private Locale locale;
@@ -61,6 +64,21 @@ public class EpicBuckets extends JavaPlugin {
console.sendMessage(ChatUtil.colorString("&a============================="));
}
+ private void save(String folder, String file) {
+ File f = null;
+ if(folder != null && !folder.equals(""))
+ f = new File(getDataFolder() + File.separator + folder + File.separator, file);
+ else
+ f = new File(getDataFolder() + File.separator, file);
+ if(!f.exists()) {
+ f.getParentFile().mkdirs();
+ saveResource(folder != null && !folder.equals("") ? folder + File.separator + file : file, false);
+ }
+ if(file.equals("shops.yml")) {
+ shopFile = YamlConfiguration.loadConfiguration(f);
+ }
+ }
+
@Override
public void onDisable() {
console.sendMessage(ChatUtil.colorString("&a============================="));
@@ -76,11 +94,8 @@ public class EpicBuckets extends JavaPlugin {
getLogger().warning("Folder not found, generating files!");
saveResource("shops.yml", false);
saveDefaultConfig();
-
}
- shopFile = new ShopFile();
-
-
+ save(null, "shops.yml");
}
public double getBalance(Player player) {
@@ -113,7 +128,6 @@ public class EpicBuckets extends JavaPlugin {
public void reloadFiles() {
this.locale.reloadMessages();
- shopFile.load();
reloadConfig();
}
diff --git a/src/main/java/com/songoda/epicbuckets/genbuckets/GenbucketItem.java b/src/main/java/com/songoda/epicbuckets/genbuckets/GenbucketItem.java
index 0cdefb1..eec4aad 100644
--- a/src/main/java/com/songoda/epicbuckets/genbuckets/GenbucketItem.java
+++ b/src/main/java/com/songoda/epicbuckets/genbuckets/GenbucketItem.java
@@ -35,7 +35,7 @@ public class GenbucketItem {
public GenbucketItem(String shopName, String key) {
- FileConfiguration config = EpicBuckets.getInstance().shopFile.config;
+ FileConfiguration config = EpicBuckets.getInstance().shopFile;
this.itemName = ChatUtil.colorString(config.getString("shops." + shopName + "." + key + ".name"));
diff --git a/src/main/java/com/songoda/epicbuckets/inventories/InventoryManager.java b/src/main/java/com/songoda/epicbuckets/inventories/InventoryManager.java
index 5e27110..54eeacc 100644
--- a/src/main/java/com/songoda/epicbuckets/inventories/InventoryManager.java
+++ b/src/main/java/com/songoda/epicbuckets/inventories/InventoryManager.java
@@ -57,7 +57,7 @@ public class InventoryManager {
public void loadSubInventory(Player player, String shopName) {
- FileConfiguration config = EpicBuckets.getInstance().shopFile.config;
+ FileConfiguration config = EpicBuckets.getInstance().shopFile;
String inventoryName = ChatUtil.colorString(config.getString("shops." + shopName + ".inventory-name"));
@@ -97,7 +97,7 @@ public class InventoryManager {
private void setBucketInSubGUI(Inventory inventory, String shopName, String key) {
- FileConfiguration config = EpicBuckets.getInstance().shopFile.config;
+ FileConfiguration config = EpicBuckets.getInstance().shopFile;
String name = ChatUtil.colorString(config.getString("shops." + shopName + "." + key + ".name"));
diff --git a/src/main/java/com/songoda/epicbuckets/listeners/GenbucketPlaceListener.java b/src/main/java/com/songoda/epicbuckets/listeners/GenbucketPlaceListener.java
index f21cd34..60ad34e 100644
--- a/src/main/java/com/songoda/epicbuckets/listeners/GenbucketPlaceListener.java
+++ b/src/main/java/com/songoda/epicbuckets/listeners/GenbucketPlaceListener.java
@@ -41,7 +41,7 @@ public class GenbucketPlaceListener implements Listener {
@EventHandler
public void onPlayerBucketEmptyEvent(PlayerBucketEmptyEvent event) {
- FileConfiguration config = plugin.shopFile.config;
+ FileConfiguration config = plugin.shopFile;
final Player player = event.getPlayer();
@@ -99,7 +99,7 @@ public class GenbucketPlaceListener implements Listener {
Block clickedBlock = event.getClickedBlock();
- FileConfiguration config = plugin.shopFile.config;
+ FileConfiguration config = plugin.shopFile;
boolean foundGenbucket = false;
diff --git a/src/main/java/com/songoda/epicbuckets/listeners/InventoryClickListener.java b/src/main/java/com/songoda/epicbuckets/listeners/InventoryClickListener.java
index 5744375..0e7c400 100644
--- a/src/main/java/com/songoda/epicbuckets/listeners/InventoryClickListener.java
+++ b/src/main/java/com/songoda/epicbuckets/listeners/InventoryClickListener.java
@@ -93,7 +93,7 @@ public class InventoryClickListener implements Listener {
@EventHandler
public void onClickSubInventory(InventoryClickEvent event) {
- FileConfiguration config = plugin.shopFile.config;
+ FileConfiguration config = plugin.shopFile;
String clickedInventory = ChatUtil.stripColor(event.getInventory().getTitle());
diff --git a/target/classes/com/songoda/epicbuckets/genbuckets/GenbucketItem.class b/target/classes/com/songoda/epicbuckets/genbuckets/GenbucketItem.class
index 7c9109c..547dcdd 100644
Binary files a/target/classes/com/songoda/epicbuckets/genbuckets/GenbucketItem.class and b/target/classes/com/songoda/epicbuckets/genbuckets/GenbucketItem.class differ
diff --git a/target/classes/com/songoda/epicbuckets/inventories/InventoryManager.class b/target/classes/com/songoda/epicbuckets/inventories/InventoryManager.class
index 0b133e8..97bea70 100644
Binary files a/target/classes/com/songoda/epicbuckets/inventories/InventoryManager.class and b/target/classes/com/songoda/epicbuckets/inventories/InventoryManager.class differ