diff --git a/pom.xml b/pom.xml
index 90c2ffb..cb6ba00 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
de.mrstein.customheads
CustomHeads
- 2.9.2
+ 2.9.3
jar
@@ -69,7 +69,7 @@
maven-jar-plugin
2.4
-
+
N:\@OtherStuff\Servers\1.12\plugins
diff --git a/src/main/java/de/mrstein/customheads/CustomHeads.java b/src/main/java/de/mrstein/customheads/CustomHeads.java
index bc2b3f1..06b1619 100644
--- a/src/main/java/de/mrstein/customheads/CustomHeads.java
+++ b/src/main/java/de/mrstein/customheads/CustomHeads.java
@@ -109,7 +109,7 @@ public class CustomHeads extends JavaPlugin {
// Vault Support (added in v2.9.2)
public static void reloadEconomy() {
- if (headsConfig.get().getBoolean("useEconomy")) {
+ if (headsConfig.get().getBoolean("economy.enable")) {
if (Bukkit.getPluginManager().isPluginEnabled("Vault")) {
Bukkit.getConsoleSender().sendMessage(chPrefix + "Trying to hook into Vault...");
economyManager = new EconomyManager();
@@ -152,7 +152,7 @@ public class CustomHeads extends JavaPlugin {
sender.sendMessage((console ? chPrefix : "") + languageManager.RELOAD_CONFIG);
headsConfig.reload();
reducedDebug = headsConfig.get().getBoolean("reducedDebug");
- keepCategoryPermissions = headsConfig.get().getBoolean("keepCategoryPermissions");
+ keepCategoryPermissions = headsConfig.get().getBoolean("economy.category.keepPermissions");
reloadEconomy();
sender.sendMessage((console ? chPrefix : "") + languageManager.RELOAD_HISTORY);
reloadHistoryData();
@@ -170,7 +170,7 @@ public class CustomHeads extends JavaPlugin {
public static boolean reload() {
headsConfig.reload();
reducedDebug = headsConfig.get().getBoolean("reducedDebug");
- keepCategoryPermissions = headsConfig.get().getBoolean("keepCategoryPermissions");
+ keepCategoryPermissions = headsConfig.get().getBoolean("economy.category.keepPermissions");
reloadHistoryData();
reloadEconomy();
PlayerWrapper.clearCache();
@@ -259,7 +259,7 @@ public class CustomHeads extends JavaPlugin {
// Load rest of the Plugin after Language Download
private void loadRest() {
reducedDebug = headsConfig.get().getBoolean("reducedDebug");
- keepCategoryPermissions = headsConfig.get().getBoolean("keepCategoryPermissions");
+ keepCategoryPermissions = headsConfig.get().getBoolean("economy.category.keepPermissions");
categoryLoaderConfig = new Configs(instance, "loadedCategories.yml", true);
tagEditor = new TagEditor("chTags");
diff --git a/src/main/java/de/mrstein/customheads/api/CustomHeadsPlayer.java b/src/main/java/de/mrstein/customheads/api/CustomHeadsPlayer.java
index e555444..1bc17c4 100644
--- a/src/main/java/de/mrstein/customheads/api/CustomHeadsPlayer.java
+++ b/src/main/java/de/mrstein/customheads/api/CustomHeadsPlayer.java
@@ -46,6 +46,29 @@ public interface CustomHeadsPlayer {
*/
boolean lockCategory(Category category);
+ /**
+ * Returns a List of Heads (Itemstacks) the Player has unlocked
+ *
+ * @return List of unlocked Heads
+ */
+ //List getUnlockedHeads();
+
+ /**
+ * Unlocks an Head from the Given ID
+ *
+ * @param id ID of the Head
+ * @return false when the ID doesnt exists
+ */
+ //boolean unlockHead(int id);
+
+ /**
+ * Locks an Head from the Given ID
+ *
+ * @param id ID of the Head
+ * @return false when the ID doesnt exists
+ */
+ //boolean lockHead(int id);
+
/**
* Gets an List of the Heads a Player saved
*
diff --git a/src/main/java/de/mrstein/customheads/loader/Looks.java b/src/main/java/de/mrstein/customheads/loader/Looks.java
index 8e9dfe5..5e747c4 100644
--- a/src/main/java/de/mrstein/customheads/loader/Looks.java
+++ b/src/main/java/de/mrstein/customheads/loader/Looks.java
@@ -15,7 +15,6 @@ import org.bukkit.Material;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
-import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -50,7 +49,7 @@ public class Looks {
CustomHeads.getInstance().getServer().getConsoleSender().sendMessage(CustomHeads.chPrefix + "Loading Looks from language/" + language + "/settings.json");
long timestamp = System.currentTimeMillis();
- JsonFile jsf = new JsonFile(new File("plugins/CustomHeads/language/" + language + "/settings.json"));
+ JsonFile jsf = new JsonFile("language/" + language + "/settings.json");
try {
// Base
diff --git a/src/main/java/de/mrstein/customheads/utils/JsonFile.java b/src/main/java/de/mrstein/customheads/utils/JsonFile.java
index a0b47b4..849d288 100644
--- a/src/main/java/de/mrstein/customheads/utils/JsonFile.java
+++ b/src/main/java/de/mrstein/customheads/utils/JsonFile.java
@@ -36,11 +36,12 @@ public class JsonFile {
}
public JsonFile(File file) {
- this(file.getName(), file.getPath().substring(0, file.getPath().lastIndexOf("\\")));
+ this.file = file;
+ reload();
}
public JsonFile(String filename, String subFolder) {
- this.file = saveInternalFile(filename, subFolder);
+ file = saveInternalFile(filename, subFolder);
reload();
}
diff --git a/src/main/java/de/mrstein/customheads/utils/PlayerWrapper.java b/src/main/java/de/mrstein/customheads/utils/PlayerWrapper.java
index ba89db8..3f03d9a 100644
--- a/src/main/java/de/mrstein/customheads/utils/PlayerWrapper.java
+++ b/src/main/java/de/mrstein/customheads/utils/PlayerWrapper.java
@@ -20,10 +20,7 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
import java.util.stream.Collectors;
public class PlayerWrapper implements CustomHeadsPlayer {
@@ -91,13 +88,13 @@ public class PlayerWrapper implements CustomHeadsPlayer {
uuidObject.add("unlockedCategories", unlockedCategories);
JsonObject historyObject = new JsonObject();
JsonArray searchHistory = new JsonArray();
- if (customHeadsPlayer.getSearchHistory().hasHistory()) {
+ if (customHeadsPlayer.getSearchHistory() != null && customHeadsPlayer.getSearchHistory().hasHistory()) {
for (String entry : customHeadsPlayer.getSearchHistory().getEntries()) {
searchHistory.add(new JsonPrimitive(entry));
}
historyObject.add("searchHistory", searchHistory);
}
- if (customHeadsPlayer.getGetHistory().hasHistory()) {
+ if (customHeadsPlayer.getGetHistory() != null && customHeadsPlayer.getGetHistory().hasHistory()) {
JsonArray getHistory = new JsonArray();
for (String entry : customHeadsPlayer.getGetHistory().getEntries()) {
getHistory.add(new JsonPrimitive(entry));
@@ -151,6 +148,18 @@ public class PlayerWrapper implements CustomHeadsPlayer {
}
}
+// public List getUnlockedHeads() {
+// return Arrays.asList(new ItemStack(Material.DEAD_BUSH, 64));
+// }
+
+// public boolean unlockHead(int id) {
+// return !true;
+// }
+
+// public boolean lockHead(int id) {
+// return Boolean.valueOf("false");
+// }
+
public boolean saveHead(String name, String texture) {
if (hasHead(name)) {
return false;
diff --git a/src/main/java/de/mrstein/customheads/utils/Utils.java b/src/main/java/de/mrstein/customheads/utils/Utils.java
index 6e3c324..31b7747 100644
--- a/src/main/java/de/mrstein/customheads/utils/Utils.java
+++ b/src/main/java/de/mrstein/customheads/utils/Utils.java
@@ -467,8 +467,7 @@ public class Utils {
public static File saveInternalFile(String filename, String... sub) {
try {
- String currentDir = System.getProperty("user.dir");
- String subfolder = sub.length > 0 ? currentDir + "/" + sub[0] : currentDir;
+ String subfolder = sub.length > 0 ? sub[0] : "";
File outFile = new File(subfolder, filename);
Files.createParentDirs(outFile);
if (!outFile.exists()) {
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index afd6e07..24229de 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -40,8 +40,13 @@ history:
seeown: false
enabled: true
overflow: 18
-keepCategoryPermissions: true
-useEconomy: false
+economy:
+ enable: false
+ category:
+ keepPermissions: true
+# heads:
+# buyable: false
+# permanentBuy: true
updateNotify: true
langFile: none
reducedDebug: true
\ No newline at end of file
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 6d8e9f6..1bff7a3 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,6 +1,6 @@
main: de.mrstein.customheads.CustomHeads
name: CustomHeads
-version: 2.9.2
+version: 2.9.3
author: MrStein
softdepend: [Vault]
diff --git a/src/main/resources/update.yml b/src/main/resources/update.yml
index 66a0c6f..fc27e35 100644
--- a/src/main/resources/update.yml
+++ b/src/main/resources/update.yml
@@ -1,4 +1,4 @@
lastUpdateCheck: 0
-configVersion: 2.9.2
+configVersion: 2.9.3
lastVersionFetch:
lastDescriptionFetch:
\ No newline at end of file