mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-26 11:07:49 +01:00
Clean-up UUID/blacklist warnings, fixes #251
This commit is contained in:
parent
65bc723a13
commit
e8a47f910f
@ -390,9 +390,9 @@ public class Quester {
|
||||
for (ItemStack e2 : getQuestData(quest).blocksBroken) {
|
||||
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
|
||||
if (e2.getAmount() < e.getAmount()) {
|
||||
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "break") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
|
||||
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "break") + " " + Items.itemByType(e2.getType(), e2.getData().getData()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
|
||||
} else {
|
||||
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "break") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
|
||||
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "break") + " " + Items.itemByType(e2.getType(), e2.getData().getData()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2014,17 +2014,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
return quester;
|
||||
}
|
||||
}
|
||||
|
||||
if (!questerBlacklist.contains(id.toString())) {
|
||||
getLogger().log(Level.WARNING, "Quester data for UUID \"" + id.toString() + "\" not stored. Attempting manual data retrieval...");
|
||||
}
|
||||
|
||||
if (quester.loadData() == false && !questerBlacklist.contains(id.toString())) {
|
||||
getLogger().info("Quester not found for UUID \"" + id.toString() + "\". Consider adding them to the Quester blacklist.");
|
||||
} else {
|
||||
if (!questerBlacklist.contains(id.toString())) {
|
||||
getLogger().log(Level.INFO, "Manual data retrieval succeeded for UUID \"" + id.toString() + "\"");
|
||||
}
|
||||
if (quester.loadData() == true) {
|
||||
questers.put(id, quester);
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,6 @@ import net.milkbowl.vault.item.Items;
|
||||
|
||||
public class ItemUtil {
|
||||
|
||||
static Quests plugin;
|
||||
|
||||
/**
|
||||
* Will compare stacks by name, amount, data, display name/lore and enchantments
|
||||
*
|
||||
@ -82,8 +80,14 @@ public class ItemUtil {
|
||||
}
|
||||
}
|
||||
|
||||
// Formats -> name-name:amount-amount:data-data:enchantment-enchantment level:displayname-displayname:lore-lore:
|
||||
// Returns null if invalid format
|
||||
/**
|
||||
* Get ItemStack from formatted string. See serialize() for reverse function.
|
||||
*
|
||||
* <p>Supplied format = name-name:amount-amount:data-data:enchantment-enchantment level:displayname-displayname:lore-lore:
|
||||
*
|
||||
* @param data formatted string
|
||||
* @return ItemStack, or null if invalid format
|
||||
*/
|
||||
public static ItemStack readItemStack(String data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
@ -94,7 +98,6 @@ public class ItemUtil {
|
||||
LinkedList<String> lore = new LinkedList<String>();
|
||||
for (String arg : args) {
|
||||
if (arg.startsWith("name-")) {
|
||||
// Attempt to match item name. Returns null if invalid format
|
||||
try {
|
||||
stack = new ItemStack(Material.matchMaterial(arg.substring(5)));
|
||||
} catch (NullPointerException npe) {
|
||||
@ -124,6 +127,14 @@ public class ItemUtil {
|
||||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get formatted string from ItemStack. See readItemStack() for reverse function.
|
||||
*
|
||||
* <p>Returned format = name-name:amount-amount:data-data:enchantment-enchantment level:displayname-displayname:lore-lore:
|
||||
*
|
||||
* @param is ItemStack
|
||||
* @return formatted string, or null if invalid stack
|
||||
*/
|
||||
public static String serialize(ItemStack is) {
|
||||
String serial;
|
||||
if (is == null) {
|
||||
@ -207,6 +218,12 @@ public class ItemUtil {
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that an ItemStack if a valid, non-AIR material
|
||||
*
|
||||
* @param is ItemStack to check
|
||||
* @return true if stack is not null or Material.AIR
|
||||
*/
|
||||
public static boolean isItem(ItemStack is) {
|
||||
if (is == null)
|
||||
return false;
|
||||
@ -215,6 +232,12 @@ public class ItemUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether an ItemStack is a Quest Journal based on book title
|
||||
*
|
||||
* @param is IemsStack to check
|
||||
* @return true if display name equals colored journal title
|
||||
*/
|
||||
public static boolean isJournal(ItemStack is) {
|
||||
if (is == null)
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user