mirror of
https://github.com/IHasName/CustomHeads.git
synced 2024-11-25 05:55:11 +01:00
Fixed Small Bug where the Plugin wouldn't load on some Servers
This commit is contained in:
parent
a2ed15a03c
commit
6f1f184b3c
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>de.mrstein.customheads</groupId>
|
||||
<artifactId>CustomHeads</artifactId>
|
||||
<version>2.9.2</version>
|
||||
<version>2.9.3</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
@ -69,7 +69,7 @@
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<!--<outputDirectory>N:\@OtherStuff\Servers\hello_pom_readers _=D\plugins</outputDirectory>-->
|
||||
<!--<outputDirectory>N:\@OtherStuff\Servers\1.88\plugins</outputDirectory>-->
|
||||
<outputDirectory>N:\@OtherStuff\Servers\1.12\plugins</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
@ -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");
|
||||
|
@ -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<ItemStack> 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
|
||||
*
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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<ItemStack> 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;
|
||||
|
@ -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()) {
|
||||
|
@ -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
|
@ -1,6 +1,6 @@
|
||||
main: de.mrstein.customheads.CustomHeads
|
||||
name: CustomHeads
|
||||
version: 2.9.2
|
||||
version: 2.9.3
|
||||
author: MrStein
|
||||
softdepend: [Vault]
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
lastUpdateCheck: 0
|
||||
configVersion: 2.9.2
|
||||
configVersion: 2.9.3
|
||||
lastVersionFetch:
|
||||
lastDescriptionFetch:
|
Loading…
Reference in New Issue
Block a user