mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-27 21:26:29 +01:00
parent
3a84b17886
commit
f537a757c5
@ -702,6 +702,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
try {
|
try {
|
||||||
data.load(new File(plugin.getDataFolder(), "quests.yml"));
|
data.load(new File(plugin.getDataFolder(), "quests.yml"));
|
||||||
ConfigurationSection questSection = data.getConfigurationSection("quests");
|
ConfigurationSection questSection = data.getConfigurationSection("quests");
|
||||||
|
if (questSection == null) {
|
||||||
|
questSection = data.createSection("quests");
|
||||||
|
}
|
||||||
int customNum = 1;
|
int customNum = 1;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (questSection.contains("custom" + customNum)) {
|
if (questSection.contains("custom" + customNum)) {
|
||||||
|
@ -1519,7 +1519,7 @@ public class Quester {
|
|||||||
String stack = getQuestData(quest).blocksBroken.toString();
|
String stack = getQuestData(quest).blocksBroken.toString();
|
||||||
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
||||||
message = message + " " + amount + "/" + amount;
|
message = message + " " + amount + "/" + amount;
|
||||||
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability());
|
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
|
||||||
if (testComplete(quest)) {
|
if (testComplete(quest)) {
|
||||||
quest.nextStage(this);
|
quest.nextStage(this);
|
||||||
}
|
}
|
||||||
@ -1528,7 +1528,7 @@ public class Quester {
|
|||||||
String stack = getQuestData(quest).blocksDamaged.toString();
|
String stack = getQuestData(quest).blocksDamaged.toString();
|
||||||
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
||||||
message = message + " " + amount + "/" + amount;
|
message = message + " " + amount + "/" + amount;
|
||||||
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability());
|
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
|
||||||
if (testComplete(quest)) {
|
if (testComplete(quest)) {
|
||||||
quest.nextStage(this);
|
quest.nextStage(this);
|
||||||
}
|
}
|
||||||
@ -1537,7 +1537,7 @@ public class Quester {
|
|||||||
String stack = getQuestData(quest).blocksPlaced.toString();
|
String stack = getQuestData(quest).blocksPlaced.toString();
|
||||||
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
||||||
message = message + " " + amount + "/" + amount;
|
message = message + " " + amount + "/" + amount;
|
||||||
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability());
|
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
|
||||||
if (testComplete(quest)) {
|
if (testComplete(quest)) {
|
||||||
quest.nextStage(this);
|
quest.nextStage(this);
|
||||||
}
|
}
|
||||||
@ -1546,7 +1546,7 @@ public class Quester {
|
|||||||
String stack = getQuestData(quest).blocksUsed.toString();
|
String stack = getQuestData(quest).blocksUsed.toString();
|
||||||
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
||||||
message = message + " " + amount + "/" + amount;
|
message = message + " " + amount + "/" + amount;
|
||||||
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability());
|
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
|
||||||
if (testComplete(quest)) {
|
if (testComplete(quest)) {
|
||||||
quest.nextStage(this);
|
quest.nextStage(this);
|
||||||
}
|
}
|
||||||
@ -1555,7 +1555,7 @@ public class Quester {
|
|||||||
String stack = getQuestData(quest).blocksCut.toString();
|
String stack = getQuestData(quest).blocksCut.toString();
|
||||||
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
|
||||||
message = message + " " + amount + "/" + amount;
|
message = message + " " + amount + "/" + amount;
|
||||||
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability());
|
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
|
||||||
if (testComplete(quest)) {
|
if (testComplete(quest)) {
|
||||||
quest.nextStage(this);
|
quest.nextStage(this);
|
||||||
}
|
}
|
||||||
@ -1563,20 +1563,22 @@ public class Quester {
|
|||||||
ItemStack is = getCurrentStage(quest).itemsToCraft.get(getCurrentStage(quest).itemsToCraft.indexOf(goal));
|
ItemStack is = getCurrentStage(quest).itemsToCraft.get(getCurrentStage(quest).itemsToCraft.indexOf(goal));
|
||||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "craft") + " <item> "
|
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "craft") + " <item> "
|
||||||
+ is.getAmount() + "/" + is.getAmount();
|
+ is.getAmount() + "/" + is.getAmount();
|
||||||
plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability());
|
plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null);
|
||||||
if (testComplete(quest)) {
|
if (testComplete(quest)) {
|
||||||
quest.nextStage(this);
|
quest.nextStage(this);
|
||||||
}
|
}
|
||||||
} else if (objective.equalsIgnoreCase("enchantItem")) {
|
} else if (objective.equalsIgnoreCase("enchantItem")) {
|
||||||
String obj = Lang.get(p, "enchantItem");
|
String obj = Lang.get(p, "enchantItem");
|
||||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
|
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
|
||||||
|
Map<Enchantment, Integer> ench = new HashMap<Enchantment, Integer>();
|
||||||
|
ench.put(enchantment, enchantment.getStartLevel());
|
||||||
for (Map<Enchantment, Material> map : getCurrentStage(quest).itemsToEnchant.keySet()) {
|
for (Map<Enchantment, Material> map : getCurrentStage(quest).itemsToEnchant.keySet()) {
|
||||||
if (map.containsKey(enchantment)) {
|
if (map.containsKey(enchantment)) {
|
||||||
message = message + " " + getCurrentStage(quest).itemsToEnchant.get(map) + "/" + getCurrentStage(quest).itemsToEnchant.get(map);
|
message = message + " " + getCurrentStage(quest).itemsToEnchant.get(map) + "/" + getCurrentStage(quest).itemsToEnchant.get(map);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), enchantment);
|
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), ench);
|
||||||
if (testComplete(quest)) {
|
if (testComplete(quest)) {
|
||||||
quest.nextStage(this);
|
quest.nextStage(this);
|
||||||
}
|
}
|
||||||
@ -1585,7 +1587,7 @@ public class Quester {
|
|||||||
obj = obj.replace("<npc>", plugin.getNPCName(getCurrentStage(quest).itemDeliveryTargets.get(getCurrentStage(quest).itemsToDeliver.indexOf(goal))));
|
obj = obj.replace("<npc>", plugin.getNPCName(getCurrentStage(quest).itemDeliveryTargets.get(getCurrentStage(quest).itemsToDeliver.indexOf(goal))));
|
||||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
|
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
|
||||||
ItemStack is = getCurrentStage(quest).itemsToDeliver.get(getCurrentStage(quest).itemsToDeliver.indexOf(goal));
|
ItemStack is = getCurrentStage(quest).itemsToDeliver.get(getCurrentStage(quest).itemsToDeliver.indexOf(goal));
|
||||||
plugin.getLocaleQuery().sendMessage(p, message, is.getType(), is.getDurability());
|
plugin.getLocaleQuery().sendMessage(p, message, is.getType(), is.getDurability(), null);
|
||||||
if (testComplete(quest)) {
|
if (testComplete(quest)) {
|
||||||
quest.nextStage(this);
|
quest.nextStage(this);
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
|
|
||||||
if (!outDir.exists()) {
|
if (!outDir.exists()) {
|
||||||
if (!outDir.mkdirs()) {
|
if (!outDir.mkdirs()) {
|
||||||
getLogger().log(Level.SEVERE, "Failed to make directories for " + outFile.getName() + " (canWrite= " + outFile.canWrite() + ")");
|
getLogger().log(Level.SEVERE, "Failed to make directories for " + outFile.getName() + " (canWrite= " + outDir.canWrite() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,9 +448,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
}
|
}
|
||||||
out.close();
|
out.close();
|
||||||
in.close();
|
in.close();
|
||||||
} /*else {
|
if (!outFile.exists()) {
|
||||||
getLogger().log(Level.WARNING, "Could not save " + outFile.getName() + " to " + outFile + " because " + outFile.getName() + " already exists.");
|
getLogger().severe("Unable to copy " + outFile.getName() + " (canWrite= " + outFile.canWrite() + ")");
|
||||||
}*/
|
}
|
||||||
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
getLogger().log(Level.SEVERE, "Could not save " + outFile.getName() + " to " + outFile, ex);
|
getLogger().log(Level.SEVERE, "Could not save " + outFile.getName() + " to " + outFile, ex);
|
||||||
}
|
}
|
||||||
@ -632,7 +633,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
for (ItemStack is : stage.blocksToBreak) {
|
for (ItemStack is : stage.blocksToBreak) {
|
||||||
if (Material.matchMaterial(serial) != null) {
|
if (Material.matchMaterial(serial) != null) {
|
||||||
if (Material.matchMaterial(serial).equals(is.getType())) {
|
if (Material.matchMaterial(serial).equals(is.getType())) {
|
||||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability(), null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -641,7 +642,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
for (ItemStack is : stage.blocksToDamage) {
|
for (ItemStack is : stage.blocksToDamage) {
|
||||||
if (Material.matchMaterial(serial) != null) {
|
if (Material.matchMaterial(serial) != null) {
|
||||||
if (Material.matchMaterial(serial).equals(is.getType())) {
|
if (Material.matchMaterial(serial).equals(is.getType())) {
|
||||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability(), null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -650,7 +651,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
for (ItemStack is : stage.blocksToPlace) {
|
for (ItemStack is : stage.blocksToPlace) {
|
||||||
if (Material.matchMaterial(serial) != null) {
|
if (Material.matchMaterial(serial) != null) {
|
||||||
if (Material.matchMaterial(serial).equals(is.getType())) {
|
if (Material.matchMaterial(serial).equals(is.getType())) {
|
||||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability(), null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -659,7 +660,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
for (ItemStack is : stage.blocksToUse) {
|
for (ItemStack is : stage.blocksToUse) {
|
||||||
if (Material.matchMaterial(serial) != null) {
|
if (Material.matchMaterial(serial) != null) {
|
||||||
if (Material.matchMaterial(serial).equals(is.getType())) {
|
if (Material.matchMaterial(serial).equals(is.getType())) {
|
||||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability(), null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -668,7 +669,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
for (ItemStack is : stage.blocksToCut) {
|
for (ItemStack is : stage.blocksToCut) {
|
||||||
if (Material.matchMaterial(serial) != null) {
|
if (Material.matchMaterial(serial) != null) {
|
||||||
if (Material.matchMaterial(serial).equals(is.getType())) {
|
if (Material.matchMaterial(serial).equals(is.getType())) {
|
||||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability(), null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -677,7 +678,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
for (ItemStack is : stage.getItemsToCraft()) {
|
for (ItemStack is : stage.getItemsToCraft()) {
|
||||||
if (Material.matchMaterial(serial) != null) {
|
if (Material.matchMaterial(serial) != null) {
|
||||||
if (Material.matchMaterial(serial).equals(is.getType())) {
|
if (Material.matchMaterial(serial).equals(is.getType())) {
|
||||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability(), null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -692,10 +693,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
if (!is.getEnchantments().isEmpty()) {
|
if (!is.getEnchantments().isEmpty()) {
|
||||||
//TODO parse multiple enchantments?
|
//TODO parse multiple enchantments?
|
||||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>").replace(enchant, "<enchantment>"),
|
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>").replace(enchant, "<enchantment>"),
|
||||||
is.getType(), is.getDurability(), is.getEnchantments().entrySet().iterator().next().getKey());
|
is.getType(), is.getDurability(), is.getEnchantments());
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability());
|
localeQuery.sendMessage(quester.getPlayer(), obj.replace(serial, "<item>"), is.getType(), is.getDurability(), null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ public class NpcListener implements Listener {
|
|||||||
text += (hand.getItemMeta().hasDisplayName() ? ")" : "");
|
text += (hand.getItemMeta().hasDisplayName() ? ")" : "");
|
||||||
}
|
}
|
||||||
text += " x " + ChatColor.DARK_AQUA + hand.getAmount() + ChatColor.GRAY;
|
text += " x " + ChatColor.DARK_AQUA + hand.getAmount() + ChatColor.GRAY;
|
||||||
plugin.getLocaleQuery().sendMessage(player, Lang.get(player, "questInvalidDeliveryItem").replace("<item>", text), hand.getType(), hand.getDurability());
|
plugin.getLocaleQuery().sendMessage(player, Lang.get(player, "questInvalidDeliveryItem").replace("<item>", text), hand.getType(), hand.getDurability(), null);
|
||||||
switch(reasonCode) {
|
switch(reasonCode) {
|
||||||
case 1:
|
case 1:
|
||||||
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "one item is null"));
|
player.sendMessage(ChatColor.GRAY + Lang.get(player, "difference").replace("<data>", "one item is null"));
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user