mirror of
https://github.com/songoda/EpicBuckets.git
synced 2024-11-26 20:26:22 +01:00
Fixed the shop.yml saving with no contents
This commit is contained in:
parent
79bc360aca
commit
775976d69f
34
.idea/artifacts/epicbuckets_jar.xml
Normal file
34
.idea/artifacts/epicbuckets_jar.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="epicbuckets:jar">
|
||||
<output-path>$APPLICATION_HOME_DIR$/Spigot Plugins</output-path>
|
||||
<root id="archive" name="epicbuckets.jar">
|
||||
<element id="module-output" name="epicbuckets" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/us/talabrek/ultimateskyblock/LATEST/ultimateskyblock-LATEST.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/kingdoms/LATEST/kingdoms-LATEST.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/spigotmc/spigot/1.12.2/spigot-1.12.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/sk89q/worldedit/LATEST/worldedit-LATEST.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/me/ryanhamshire/GriefPrevention/LATEST/GriefPrevention-LATEST.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/br/net/fabiozumbi12/RedProtect/7.3.0/RedProtect-7.3.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/junit/junit/4.10/junit-4.10.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/avaje/ebean/2.8.1/ebean-2.8.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/wasteofplastic/askyblock/3.0.6.8/askyblock-3.0.6.8.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/guava/guava/17.0/guava-17.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/sk89q/worldguard/6.2.2/worldguard-6.2.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/milkbowl/vault/VaultAPI/1.6/VaultAPI-1.6.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/bukkit/bukkit/1.9-R0.1-SNAPSHOT/bukkit-1.9-R0.1-20160330.160319-146.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/massivecraft/Factions/LATEST/factions-LATEST.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.15/snakeyaml-1.15.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/songoda/arconix/LATEST/arconix-LATEST.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/palmergames/bukkit/towny/LATEST/towny-LATEST.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/plotsquared/RELEASE/plotsquared-RELEASE.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/songoda/epicspawners/LATEST/epicspawners-LATEST.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/me/markeh/factionsframework/1.2.0/factionsframework-1.2.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/massivecraft/factionsuuid/LATEST/factionsuuid-LATEST.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
13
.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml
Normal file
13
.idea/libraries/Maven__com_google_code_gson_gson_2_2_4.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.google.code.gson:gson:2.2.4">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.2.4/gson-2.2.4-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/code/gson/gson/2.2.4/gson-2.2.4-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__com_google_guava_guava_17_0.xml
Normal file
13
.idea/libraries/Maven__com_google_guava_guava_17_0.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: com.google.guava:guava:17.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/17.0/guava-17.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/17.0/guava-17.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/17.0/guava-17.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: javax.persistence:persistence-api:1.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/persistence/persistence-api/1.0/persistence-api-1.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/javax/persistence/persistence-api/1.0/persistence-api-1.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__net_milkbowl_vault_VaultAPI_1_6.xml
Normal file
13
.idea/libraries/Maven__net_milkbowl_vault_VaultAPI_1_6.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: net.milkbowl.vault:VaultAPI:1.6">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/milkbowl/vault/VaultAPI/1.6/VaultAPI-1.6.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/milkbowl/vault/VaultAPI/1.6/VaultAPI-1.6-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/net/milkbowl/vault/VaultAPI/1.6/VaultAPI-1.6-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml
Normal file
13
.idea/libraries/Maven__org_avaje_ebean_2_8_1.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.avaje:ebean:2.8.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/avaje/ebean/2.8.1/ebean-2.8.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/avaje/ebean/2.8.1/ebean-2.8.1-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/avaje/ebean/2.8.1/ebean-2.8.1-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.bukkit:bukkit:1.9-R0.1-SNAPSHOT">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/bukkit/1.9-R0.1-SNAPSHOT/bukkit-1.9-R0.1-20160330.160319-146.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/bukkit/1.9-R0.1-SNAPSHOT/bukkit-1.9-R0.1-20160330.160319-146-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/bukkit/bukkit/1.9-R0.1-SNAPSHOT/bukkit-1.9-R0.1-20160330.160319-146-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
13
.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml
Normal file
13
.idea/libraries/Maven__org_yaml_snakeyaml_1_15.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<component name="libraryTable">
|
||||
<library name="Maven: org.yaml:snakeyaml:1.15">
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.15/snakeyaml-1.15.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.15/snakeyaml-1.15-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/yaml/snakeyaml/1.15/snakeyaml-1.15-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
3
src/main/java/META-INF/MANIFEST.MF
Normal file
3
src/main/java/META-INF/MANIFEST.MF
Normal file
@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: com.songoda.epicbuckets.EpicBuckets
|
||||
|
@ -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();
|
||||
|
||||
}
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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());
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user