mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-28 21:56:28 +01:00
Finished Updating to 1.7.2
Added number of times completed of redoable Quests in /quests stats
This commit is contained in:
parent
69b883b408
commit
f68521c691
BIN
lib/Heroes.jar
BIN
lib/Heroes.jar
Binary file not shown.
@ -38,6 +38,7 @@ public class Quester {
|
||||
Quests plugin;
|
||||
public LinkedList<String> completedQuests = new LinkedList<String>();
|
||||
Map<String, Long> completedTimes = new HashMap<String, Long>();
|
||||
Map<String, Integer> amountsCompleted = new HashMap<String, Integer>();
|
||||
Map<Material, Integer> blocksDamaged = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Material, Integer> blocksBroken = new EnumMap<Material, Integer>(Material.class);
|
||||
Map<Material, Integer> blocksPlaced = new EnumMap<Material, Integer>(Material.class);
|
||||
@ -78,15 +79,18 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
public void takeQuest(Quest q) {
|
||||
public void takeQuest(Quest q, boolean override) {
|
||||
|
||||
Player player = plugin.getServer().getPlayer(name);
|
||||
|
||||
if (q.testRequirements(player) == true) {
|
||||
if (q.testRequirements(player) == true || override) {
|
||||
|
||||
currentQuest = q;
|
||||
currentStage = q.orderedStages.getFirst();
|
||||
addEmpties();
|
||||
|
||||
if(!override){
|
||||
|
||||
if (q.moneyReq > 0) {
|
||||
Quests.economy.withdrawPlayer(name, q.moneyReq);
|
||||
}
|
||||
@ -99,6 +103,10 @@ public class Quester {
|
||||
|
||||
player.sendMessage(ChatColor.GREEN + "Quest accepted: " + q.name);
|
||||
player.sendMessage("");
|
||||
|
||||
}
|
||||
|
||||
|
||||
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
|
||||
for (String s : getObjectives()) {
|
||||
player.sendMessage(s);
|
||||
@ -124,6 +132,8 @@ public class Quester {
|
||||
if(currentStage.startEvent != null)
|
||||
currentStage.startEvent.fire(this);
|
||||
|
||||
saveData();
|
||||
|
||||
} else {
|
||||
|
||||
player.sendMessage(q.failRequirements);
|
||||
@ -992,7 +1002,7 @@ public class Quester {
|
||||
|
||||
} else if (objective.equalsIgnoreCase("deliverItem")) {
|
||||
|
||||
String message = ChatColor.GREEN + "(Completed) Deliver " + ItemUtil.getString(currentStage.itemsToDeliver.get(currentStage.itemsToDeliver.indexOf(itemstack))) + " " + ItemUtil.getName(itemstack) + " to " + plugin.getNPCName(currentStage.itemDeliveryTargets.get(currentStage.itemsToDeliver.indexOf(itemstack)));
|
||||
String message = ChatColor.GREEN + "(Completed) Deliver " + ItemUtil.getString(currentStage.itemsToDeliver.get(currentStage.itemsToDeliver.indexOf(itemstack))) + " to " + plugin.getNPCName(currentStage.itemDeliveryTargets.get(currentStage.itemsToDeliver.indexOf(itemstack)));
|
||||
p.sendMessage(message);
|
||||
if (testComplete()) {
|
||||
currentQuest.nextStage(this);
|
||||
@ -1529,23 +1539,6 @@ public class Quester {
|
||||
|
||||
FileConfiguration data = new YamlConfiguration();
|
||||
|
||||
if (completedTimes.isEmpty() == false) {
|
||||
|
||||
List<String> questTimeNames = new LinkedList<String>();
|
||||
List<Long> questTimes = new LinkedList<Long>();
|
||||
|
||||
for (String s : completedTimes.keySet()) {
|
||||
|
||||
questTimeNames.add(s);
|
||||
questTimes.add(completedTimes.get(s));
|
||||
|
||||
}
|
||||
|
||||
data.set("completedRedoableQuests", questTimeNames);
|
||||
data.set("completedQuestTimes", questTimes);
|
||||
|
||||
}
|
||||
|
||||
if (currentQuest != null) {
|
||||
|
||||
data.set("currentQuest", currentQuest.name);
|
||||
@ -1871,6 +1864,40 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
if (completedTimes.isEmpty() == false) {
|
||||
|
||||
List<String> questTimeNames = new LinkedList<String>();
|
||||
List<Long> questTimes = new LinkedList<Long>();
|
||||
|
||||
for (String s : completedTimes.keySet()) {
|
||||
|
||||
questTimeNames.add(s);
|
||||
questTimes.add(completedTimes.get(s));
|
||||
|
||||
}
|
||||
|
||||
data.set("completedRedoableQuests", questTimeNames);
|
||||
data.set("completedQuestTimes", questTimes);
|
||||
|
||||
}
|
||||
|
||||
if (amountsCompleted.isEmpty() == false) {
|
||||
|
||||
List<String> list1 = new LinkedList<String>();
|
||||
List<Integer> list2 = new LinkedList<Integer>();
|
||||
|
||||
for(Entry<String, Integer> entry : amountsCompleted.entrySet()){
|
||||
|
||||
list1.add(entry.getKey());
|
||||
list2.add(entry.getValue());
|
||||
|
||||
}
|
||||
|
||||
data.set("amountsCompletedQuests", list1);
|
||||
data.set("amountsCompleted", list2);
|
||||
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
}
|
||||
@ -1907,6 +1934,21 @@ public class Quester {
|
||||
|
||||
}
|
||||
|
||||
amountsCompleted.clear();
|
||||
|
||||
if (data.contains("amountsCompletedQuests")) {
|
||||
|
||||
List<String> list1 = data.getStringList("amountsCompletedQuests");
|
||||
List<Integer> list2 = data.getIntegerList("amountsCompleted");
|
||||
|
||||
for(int i = 0; i < list1.size(); i++){
|
||||
|
||||
amountsCompleted.put(list1.get(i), list2.get(i));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
questPoints = data.getInt("quest-points");
|
||||
|
||||
if (data.isList("completed-Quests")) {
|
||||
|
@ -335,7 +335,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
if (s.equalsIgnoreCase("Yes")) {
|
||||
|
||||
getQuester(player.getName()).takeQuest(getQuest(getQuester(player.getName()).questToTake));
|
||||
getQuester(player.getName()).takeQuest(getQuest(getQuester(player.getName()).questToTake), false);
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
||||
} else if (s.equalsIgnoreCase("No")) {
|
||||
@ -983,10 +983,14 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
completed = PURPLE + "";
|
||||
for (String s : quester.completedQuests) {
|
||||
|
||||
completed += s;
|
||||
|
||||
if (quester.amountsCompleted.containsKey(s) && quester.amountsCompleted.get(s) > 1){
|
||||
completed += PINK + " (x" + quester.amountsCompleted.get(s) + ")";
|
||||
}
|
||||
|
||||
if (quester.completedQuests.indexOf(s) < (quester.completedQuests.size() - 1)) {
|
||||
completed = completed + s + ", ";
|
||||
} else {
|
||||
completed = completed + s;
|
||||
completed += ", ";
|
||||
}
|
||||
|
||||
}
|
||||
@ -1387,16 +1391,18 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
} catch (IOException e) {
|
||||
|
||||
if (failCount < 4) {
|
||||
if (failCount < 10) {
|
||||
cs.sendMessage(RED + "Error reading " + DARKAQUA + f.getName() + RED + ", skipping..");
|
||||
failCount++;
|
||||
} else if (suppressed == false) {
|
||||
cs.sendMessage(RED + "Error reading " + DARKAQUA + f.getName() + RED + ", suppressing further errors.");
|
||||
suppressed = true;
|
||||
}
|
||||
|
||||
} catch (InvalidConfigurationException e) {
|
||||
if (failCount < 4) {
|
||||
if (failCount < 10) {
|
||||
cs.sendMessage(RED + "Error reading " + DARKAQUA + f.getName() + RED + ", skipping..");
|
||||
failCount++;
|
||||
} else if (suppressed == false) {
|
||||
cs.sendMessage(RED + "Error reading " + DARKAQUA + f.getName() + RED + ", suppressing further errors.");
|
||||
suppressed = true;
|
||||
@ -1506,20 +1512,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
} else {
|
||||
|
||||
Quester quester = getQuester(target.getName());
|
||||
|
||||
quester.resetObjectives();
|
||||
|
||||
quester.currentQuest = questToGive;
|
||||
quester.currentStage = questToGive.orderedStages.getFirst();
|
||||
quester.addEmpties();
|
||||
cs.sendMessage(GREEN + target.getName() + GOLD + " has forcibly started the Quest " + PURPLE + questToGive.name + GOLD + ".");
|
||||
target.sendMessage(GREEN + cs.getName() + GOLD + " has forced you to take the Quest " + PURPLE + questToGive.name + GOLD + ".");
|
||||
target.sendMessage(GOLD + "---(Objectives)---");
|
||||
for (String s : quester.getObjectives()) {
|
||||
target.sendMessage(s);
|
||||
}
|
||||
|
||||
quester.saveData();
|
||||
target.sendMessage(GREEN + "You have been forced to take the Quest " + PURPLE + questToGive.name + GOLD + ".");
|
||||
quester.takeQuest(questToGive, true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -750,7 +750,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
}
|
||||
|
||||
if (list.isEmpty()) {
|
||||
text += GRAY + "(None)";
|
||||
text += GRAY + "(None)\n";
|
||||
} else {
|
||||
|
||||
Collections.sort(list);
|
||||
@ -818,7 +818,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
}
|
||||
|
||||
if (list.isEmpty()) {
|
||||
text += GRAY + "(None)";
|
||||
text += GRAY + "(None)\n";
|
||||
} else {
|
||||
|
||||
Collections.sort(list);
|
||||
|
@ -957,7 +957,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
}
|
||||
|
||||
if (list.isEmpty()) {
|
||||
text += GRAY + "(None)";
|
||||
text += GRAY + "(None)\n";
|
||||
} else {
|
||||
|
||||
Collections.sort(list);
|
||||
|
Loading…
Reference in New Issue
Block a user