Updated to 2.1.9 (resolved some issues and patches).

This commit is contained in:
CoderMarido 2018-09-15 13:07:05 +02:00
parent 390fe59241
commit f98aac586f
10 changed files with 63 additions and 75 deletions

View File

@ -85,7 +85,7 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
legacyIDs = LegacyIDs.readResource("legacy-ids.txt");
} catch (IOException exception) {
legacyIDs = LegacyIDs.EMPTY;
severe("Unable to load legacy IDs to perform conversion from older Spigot versions");
print("Unable to load legacy IDs to perform conversion from older Spigot versions");
exception.printStackTrace();
}
this.menus = new Menus();
@ -102,7 +102,7 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
if (mainConfig.shouldCheckForUpdates()) {
checkForUpdates();
}
info("DeluxeHeads has been enabled with " + cache.getHeadCount() + " heads " + timer + ".");
print("DeluxeHeads has been enabled with " + cache.getHeadCount() + " heads " + timer + ".");
}
@Override
@ -181,7 +181,7 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
Clock timer = Clock.start();
LegacyCacheConfig legacy = new LegacyCacheConfig(legacyConfig);
cache = CacheFileConverter.convertToCacheFile("main-cache", legacy);
info("Converted legacy yaml cache file to new binary file " + timer);
print("Converted legacy yaml cache file to new binary file " + timer);
} else {
cache = new CacheFile("main-cache");
}
@ -189,9 +189,9 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
try {
Clock timer = Clock.start();
cache = CacheFile.read(file);
info("Loaded cache file " + timer);
print("Loaded cache file " + timer);
} catch (IOException e) {
severe("Unable to read heads.cache file");
print("Unable to read heads.cache file");
throw new RuntimeException("There was an exception reading the heads.cache file", e);
}
}
@ -201,7 +201,7 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
}
if (legacyConfig.getFile().exists() && !legacyConfig.getFile().delete()) {
severe("Unable to delete legacy yaml cache file");
print("Unable to delete legacy yaml cache file");
}
return cache;
@ -214,9 +214,9 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
cache.write(file);
info("Saved cache file " + timer);
print("Saved cache file " + timer);
} catch (IOException e) {
severe("Unable to save the cache to heads.cache");
print("Unable to save the cache to heads.cache");
throw new RuntimeException("There was an exception saving the cache", e);
}
}
@ -225,7 +225,7 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
try {
return ModsFileHeader.readResource("cache.mods");
} catch (IOException e) {
severe("Unable to read header of cache.mods");
print("Unable to read header of cache.mods");
throw new RuntimeException("Unable to read header of cache.mods", e);
}
}
@ -234,7 +234,7 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
try {
return ModsFile.readResource("cache.mods");
} catch (IOException e) {
severe("Unable to read mods from cache.mods");
print("Unable to read mods from cache.mods");
throw new RuntimeException("Unable to read mods from cache.mods", e);
}
}
@ -253,9 +253,9 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
int newHeads = mods.installMods(cache);
if (newHeads > 0) {
info("Added " + newHeads + " new heads from " + newMods + " addons " + timer);
print("Added " + newHeads + " new heads from " + newMods + " addons " + timer);
} else {
info("Installed " + newMods + " addons " + timer);
print("Installed " + newMods + " addons " + timer);
}
return true;
@ -280,7 +280,7 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
}
if (economy == null || economy instanceof NoEconomy) {
severe("Economy enabled in config.yml yet Vault, PlayerPoints and Item economies disabled. " + "Player's will not be able to purchase heads.");
print("Economy enabled in config.yml yet Vault, PlayerPoints and Item economies disabled. " + "Player's will not be able to purchase heads.");
economy = (economy != null ? economy : new NoEconomy());
}
@ -290,18 +290,18 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
private Economy tryHookEconomy(Economy currentlyHooked, Economy toHook) {
if (currentlyHooked != null) {
warning(toHook.getName() + " economy is not the only economy enabled in the config.yml.");
print(toHook.getName() + " economy is not the only economy enabled in the config.yml.");
if (!(currentlyHooked instanceof NoEconomy))
return currentlyHooked;
}
if (!toHook.tryHook()) {
severe(toHook.getName() + " enabled in config.yml, yet Heads was unable to hook into it.");
print(toHook.getName() + " enabled in config.yml, yet Heads was unable to hook into it.");
return new NoEconomy();
}
info("Loaded " + toHook.getName() + " economy");
print("Loaded " + toHook.getName() + " economy");
return toHook;
}
@ -314,13 +314,13 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
apiClass.getDeclaredMethod("retrieveBlockMeta", Plugin.class, Location.class, Plugin.class, String.class, Consumer.class);
info("Hooked BlockStore");
print("Hooked BlockStore");
blockStoreAvailable = true;
} catch (ClassNotFoundException | NoSuchMethodException e) {
severe("Unable to hook BlockStore, the version of BlockStore you are " + "using may be outdated. Heads requires BlockStore v1.5.0.");
severe("Please update BlockStore and report this to Sothatsit if the problem persists.");
print("Unable to hook BlockStore, the version of BlockStore you are " + "using may be outdated. Heads requires BlockStore v1.5.0.");
print("Please update BlockStore and report this to Sothatsit if the problem persists.");
}
}
}
@ -411,24 +411,13 @@ public class DeluxeHeads extends JavaPlugin implements Listener {
return instance.blockStoreAvailable;
}
public static void info(String info) {
instance.getLogger().info(info);
}
public static void warning(String warning) {
instance.getLogger().warning(warning);
}
public static void severe(String severe) {
instance.getLogger().severe(severe);
}
public static void sync(Runnable task) {
Bukkit.getScheduler().runTask(instance, task);
}
public static void print(String info) {
csender.sendMessage(ChatColor.translateAlternateColorCodes('&', info));
public static void print(String print) {
if (print != null)
csender.sendMessage(ChatColor.translateAlternateColorCodes('&', print));
}
public static FileConfigFile getVersionedConfig(String resource) {

View File

@ -97,7 +97,7 @@ public abstract class ConfigFile {
}
private Item replaceInvalid(String key, Item replacement, AtomicBoolean requiresSave) {
DeluxeHeads.warning("\"" + key + "\" not set or invalid in " + getName() + ", replacing with " + replacement);
DeluxeHeads.print("\"" + key + "\" not set or invalid in " + getName() + ", replacing with " + replacement);
removeInvalid(key, requiresSave);
replacement.save(getConfig(), key);
@ -108,7 +108,7 @@ public abstract class ConfigFile {
}
private <T> T replaceInvalid(String key, T replacement, AtomicBoolean requiresSave) {
DeluxeHeads.warning("\"" + key + "\" not set or invalid in " + getName() + ", replacing with " + replacement);
DeluxeHeads.print("\"" + key + "\" not set or invalid in " + getName() + ", replacing with " + replacement);
removeInvalid(key, requiresSave);
getConfig().set(key, replacement);

View File

@ -71,22 +71,22 @@ public class MainConfig {
AtomicBoolean shouldSave = new AtomicBoolean(false);
loadCommandInfo(config, shouldSave);
loadCommandprint(config, shouldSave);
loadCategoryCosts(config, shouldSave);
if (config.isSet("hat-mode") && config.isBoolean("hat-mode") && config.getBoolean("hat-mode")) {
DeluxeHeads.severe("--------------------------------------------------");
DeluxeHeads.severe("Until further notice, hat mode is no longer supported");
DeluxeHeads.severe("in Heads past version 1.10.0, please downgrade or");
DeluxeHeads.severe("switch the plugin out of hat-mode in your config.yml");
DeluxeHeads.severe("--------------------------------------------------");
DeluxeHeads.print("--------------------------------------------------");
DeluxeHeads.print("Until further notice, hat mode is no longer supported");
DeluxeHeads.print("in Heads past version 1.10.0, please downgrade or");
DeluxeHeads.print("switch the plugin out of hat-mode in your config.yml");
DeluxeHeads.print("--------------------------------------------------");
Bukkit.getScheduler().scheduleSyncDelayedTask(DeluxeHeads.getInstance(), () -> {
DeluxeHeads.severe("--------------------------------------------------");
DeluxeHeads.severe("Until further notice, hat mode is no longer supported");
DeluxeHeads.severe("in Heads past version 1.10.0, please downgrade or");
DeluxeHeads.severe("switch the plugin out of hat-mode in your config.yml");
DeluxeHeads.severe("--------------------------------------------------");
DeluxeHeads.print("--------------------------------------------------");
DeluxeHeads.print("Until further notice, hat mode is no longer supported");
DeluxeHeads.print("in Heads past version 1.10.0, please downgrade or");
DeluxeHeads.print("switch the plugin out of hat-mode in your config.yml");
DeluxeHeads.print("--------------------------------------------------");
Bukkit.getPluginManager().disablePlugin(DeluxeHeads.getInstance());
});
@ -113,7 +113,7 @@ public class MainConfig {
checkForUpdates = loadBoolean(config, "check-for-updates", true, shouldSave);
if (defaultHeadCost < 0) {
DeluxeHeads.info("\"economy.default-head-cost\" cannot be less than 0 in config.yml, defaulting to 0");
DeluxeHeads.print("\"economy.default-head-cost\" cannot be less than 0 in config.yml, defaulting to 0");
defaultHeadCost = 0;
}
@ -121,10 +121,10 @@ public class MainConfig {
configFile.save();
}
DeluxeHeads.info("Loaded Main Config " + timer);
DeluxeHeads.print("Loaded Main Config " + timer);
}
private void loadCommandInfo(ConfigurationSection config, AtomicBoolean shouldSave) {
private void loadCommandprint(ConfigurationSection config, AtomicBoolean shouldSave) {
reloadLabel = loadString(config, "commands.heads.sub-commands.reload", "reload", shouldSave);
addLabel = loadString(config, "commands.heads.sub-commands.add", "add", shouldSave);
handLabel = loadString(config, "commands.heads.sub-commands.hand", "hand", shouldSave);
@ -167,7 +167,7 @@ public class MainConfig {
if (config.isSet(key) && config.isString(key) && !config.getString(key).isEmpty())
return config.getString(key);
DeluxeHeads.warning("\"" + key + "\" not set or invalid in config.yml, resetting to \"" + defaultVal + "\"");
DeluxeHeads.print("\"" + key + "\" not set or invalid in config.yml, resetting to \"" + defaultVal + "\"");
config.set(key, defaultVal);
shouldSave.set(true);
@ -179,7 +179,7 @@ public class MainConfig {
if (config.isSet(key) && config.isList(key))
return config.getStringList(key).toArray(new String[0]);
DeluxeHeads.warning("\"" + key + "\" not set or invalid in config.yml, resetting to " + Arrays.toString(defaultVal));
DeluxeHeads.print("\"" + key + "\" not set or invalid in config.yml, resetting to " + Arrays.toString(defaultVal));
config.set(key, Arrays.asList(defaultVal));
shouldSave.set(true);
@ -191,7 +191,7 @@ public class MainConfig {
if (config.isSet(key) && config.isBoolean(key))
return config.getBoolean(key);
DeluxeHeads.warning("\"" + key + "\" not set or invalid in config.yml, resetting to " + defaultVal);
DeluxeHeads.print("\"" + key + "\" not set or invalid in config.yml, resetting to " + defaultVal);
config.set(key, defaultVal);
shouldSave.set(true);
@ -203,7 +203,7 @@ public class MainConfig {
if (config.isSet(key) && (config.isInt(key) || config.isDouble(key)))
return config.getDouble(key);
DeluxeHeads.warning("\"" + key + "\" not set or invalid in config.yml, resetting to " + defaultVal);
DeluxeHeads.print("\"" + key + "\" not set or invalid in config.yml, resetting to " + defaultVal);
config.set(key, defaultVal);
shouldSave.set(true);
@ -219,7 +219,7 @@ public class MainConfig {
return item;
}
DeluxeHeads.warning(key + " not set or invalid in config.yml, resetting to " + defaultItem);
DeluxeHeads.print(key + " not set or invalid in config.yml, resetting to " + defaultItem);
config.set(key, null);
defaultItem.save(config.createSection(key));
@ -269,7 +269,7 @@ public class MainConfig {
configFile.save();
DeluxeHeads.info("Saved Main Config " + timer);
DeluxeHeads.print("Saved Main Config " + timer);
}
public void setItemEcoItem(Item item) {
@ -290,7 +290,7 @@ public class MainConfig {
configFile.save();
DeluxeHeads.info("Saved Main Config " + timer);
DeluxeHeads.print("Saved Main Config " + timer);
}
public boolean isEconomyEnabled() {

View File

@ -41,7 +41,7 @@ public class LangConfig {
for (Entry<String, LangMessage> def : this.defaults.entrySet()) {
if (!this.messages.containsKey(def.getKey())) {
DeluxeHeads.warning("\"lang.yml\" is missing key \"" + def.getKey() + "\", adding it");
DeluxeHeads.print("\"lang.yml\" is missing key \"" + def.getKey() + "\", adding it");
config.set(def.getKey(), def.getValue().getConfigSaveValue());
this.messages.put(def.getKey(), def.getValue());
@ -53,7 +53,7 @@ public class LangConfig {
this.configFile.save();
}
DeluxeHeads.info("Loaded Lang File with " + this.messages.size() + " messages " + timer);
DeluxeHeads.print("Loaded Lang File with " + this.messages.size() + " messages " + timer);
}
private Map<String, LangMessage> load(ConfigurationSection sec) {
@ -74,7 +74,7 @@ public class LangConfig {
} else if (sec.isString(key)) {
map.put(pathKey, new LangMessage(sec.getString(key)));
} else {
DeluxeHeads.warning("Unable to load message at \"" + pathKey + "\", was not text or a list of text.");
DeluxeHeads.print("Unable to load message at \"" + pathKey + "\", was not text or a list of text.");
}
}

View File

@ -18,7 +18,7 @@ public class Menus {
File menusFolder = new File(DeluxeHeads.getInstance().getDataFolder(), "menus");
if (!menusFolder.exists() && !menusFolder.mkdirs()) {
DeluxeHeads.severe("Unable to create the plugins/Heads/menus folder for Heads menu configuration");
DeluxeHeads.print("Unable to create the plugins/Heads/menus folder for Heads menu configuration");
}
browseConfig.load();

View File

@ -75,7 +75,7 @@ public class Menu {
return;
}
DeluxeHeads.warning("Unknown use of value \"" + key + "\" in menu \"" + section.getCurrentPath() + "\"");
DeluxeHeads.print("Unknown use of value \"" + key + "\" in menu \"" + section.getCurrentPath() + "\"");
}
public static Menu loadMenu(String filename, ConfigurationSection section, AtomicBoolean shouldSave) {

View File

@ -48,7 +48,7 @@ public class MenuConfig {
for (String key : config.getKeys(false)) {
if (!config.isConfigurationSection(key)) {
DeluxeHeads.warning("Unknown use of value " + key + " in " + filename);
DeluxeHeads.print("Unknown use of value " + key + " in " + filename);
continue;
}
@ -66,7 +66,7 @@ public class MenuConfig {
config.set(key, defaults.getConfigurationSection(key));
DeluxeHeads.warning(key + " was missing in " + filename + ", creating it");
DeluxeHeads.print(key + " was missing in " + filename + ", creating it");
shouldSave.set(true);
}
@ -74,7 +74,7 @@ public class MenuConfig {
configFile.save();
}
DeluxeHeads.info("Loaded Menu Config with " + menus.size() + " Menus " + timer);
DeluxeHeads.print("Loaded Menu Config with " + menus.size() + " Menus " + timer);
}
private ConfigurationSection loadDefaults() {

View File

@ -183,7 +183,7 @@ public class HeadNamer implements Listener {
try {
listener.callEvent(event);
} catch (EventException exception) {
DeluxeHeads.severe("There was an exception calling BlockBreakEvent for " + listener.getPlugin().getName());
DeluxeHeads.print("There was an exception calling BlockBreakEvent for " + listener.getPlugin().getName());
exception.printStackTrace();
} finally {
countdown.countdown();

View File

@ -23,7 +23,6 @@ import nl.marido.deluxeheads.util.Stringify;
import nl.marido.deluxeheads.volatilecode.ItemNBT;
import nl.marido.deluxeheads.volatilecode.reflection.Version;
@SuppressWarnings("deprecation")
public final class Item {
private final Material type;
@ -261,7 +260,7 @@ public final class Item {
String convertedType = DeluxeHeads.getLegacyIDs().fromId(typeId);
if (convertedType == null || convertedType.isEmpty()) {
DeluxeHeads.warning("Invalid type of item " + section.getCurrentPath() + ", " + "unknown type id " + typeId);
DeluxeHeads.print("Invalid type of item " + section.getCurrentPath() + ", " + "unknown type id " + typeId);
return;
}
@ -281,7 +280,7 @@ public final class Item {
}
if (type == null) {
DeluxeHeads.warning("Invalid type of item " + section.getCurrentPath() + ", could not find type " + typeName);
DeluxeHeads.print("Invalid type of item " + section.getCurrentPath() + ", could not find type " + typeName);
return;
}
@ -294,7 +293,7 @@ public final class Item {
Material withoutData = fromLegacyType(legacyType, (byte) 0);
type = fromLegacyType(legacyType, byteData);
if (type == null) {
DeluxeHeads.warning("Invalid legacy type of item " + section.getCurrentPath() + ": " + "Could not convert " + legacyType + ":" + data + " to non-legacy format");
DeluxeHeads.print("Invalid legacy type of item " + section.getCurrentPath() + ": " + "Could not convert " + legacyType + ":" + data + " to non-legacy format");
return;
}
@ -307,7 +306,7 @@ public final class Item {
String from = typeName + (typeData != null ? ":" + typeData : "");
String to = type.name().toLowerCase() + (section.isSet("damage") ? ":" + section.get("damage") : "");
DeluxeHeads.info("1.13 Update - " + from + " converted to " + to + " for " + filename + " -> " + section.getCurrentPath());
DeluxeHeads.print("1.13 Update - " + from + " converted to " + to + " for " + filename + " -> " + section.getCurrentPath());
shouldSave.set(true);
}
@ -317,7 +316,7 @@ public final class Item {
updateLegacyTypes(filename, section, shouldSave);
if (!section.isSet("type") || !section.isString("type")) {
DeluxeHeads.warning("Invalid type of item " + section.getCurrentPath() + " in " + filename + ", " + "expected a type name");
DeluxeHeads.print("Invalid type of item " + section.getCurrentPath() + " in " + filename + ", " + "expected a type name");
return null;
}
@ -325,21 +324,21 @@ public final class Item {
Material type = Material.matchMaterial(typeName);
if (type == null) {
DeluxeHeads.warning("Invalid type of item " + section.getCurrentPath() + ", " + "unknown material for type name " + typeName);
DeluxeHeads.print("Invalid type of item " + section.getCurrentPath() + ", " + "unknown material for type name " + typeName);
return null;
}
short damage = (short) section.getInt("damage", 0);
if (damage < 0) {
DeluxeHeads.warning("Invalid damage of item " + section.getCurrentPath() + ", " + "damage must be at least 0");
DeluxeHeads.print("Invalid damage of item " + section.getCurrentPath() + ", " + "damage must be at least 0");
return null;
}
int amount = section.getInt("amount", 1);
if (amount < 1) {
DeluxeHeads.warning("Invalid amount of item " + section.getCurrentPath() + ", " + "amount must be at least 1");
DeluxeHeads.print("Invalid amount of item " + section.getCurrentPath() + ", " + "amount must be at least 1");
return null;
}

View File

@ -2,7 +2,7 @@ name: DeluxeHeads
main: nl.marido.deluxeheads.DeluxeHeads
description: Enhance your server with over 17,000 awesome unique heads with amazing features.
author: Marido
version: 2.1.8
version: 2.1.9
api-version: 1.13
softdepend: [Vault, PlayerPoints, BlockStore]
loadbefore: [DeluxeMenus]