mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-22 17:17:38 +01:00
Rework code for displaying objectives, fixes #575. Bump version number
This commit is contained in:
parent
d715de35e9
commit
40ac77261e
2
pom.xml
2
pom.xml
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
<groupId>me.blackvein.quests</groupId>
|
<groupId>me.blackvein.quests</groupId>
|
||||||
<artifactId>quests</artifactId>
|
<artifactId>quests</artifactId>
|
||||||
<version>3.5.4</version>
|
<version>3.5.5</version>
|
||||||
<name>quests</name>
|
<name>quests</name>
|
||||||
<url>https://github.com/FlyingPikachu/Quests/</url>
|
<url>https://github.com/FlyingPikachu/Quests/</url>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
@ -114,7 +114,7 @@ public class Event {
|
|||||||
Quests.addItem(player, is);
|
Quests.addItem(player, is);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
plugin.getLogger().severe("Unable to add null item to inventory of "
|
plugin.getLogger().severe("Unable to add null item to inventory of "
|
||||||
+ player.getName() + " during quest " + quest.name + " event " + name);
|
+ player.getName() + " during quest " + quest.getName() + " event " + name);
|
||||||
player.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
player.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
||||||
+ "Please contact an administrator.");
|
+ "Please contact an administrator.");
|
||||||
}
|
}
|
||||||
|
@ -324,9 +324,9 @@ public class EventFactory implements ConversationAbandonedListener {
|
|||||||
for (Event evt : quests.events) {
|
for (Event evt : quests.events) {
|
||||||
if (evt.name.equalsIgnoreCase(input)) {
|
if (evt.name.equalsIgnoreCase(input)) {
|
||||||
for (Quest quest : quests.getQuests()) {
|
for (Quest quest : quests.getQuests()) {
|
||||||
for (Stage stage : quest.orderedStages) {
|
for (Stage stage : quest.getStages()) {
|
||||||
if (stage.finishEvent != null && stage.finishEvent.name.equalsIgnoreCase(evt.name)) {
|
if (stage.finishEvent != null && stage.finishEvent.name.equalsIgnoreCase(evt.name)) {
|
||||||
used.add(quest.name);
|
used.add(quest.getName());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -632,7 +632,7 @@ public class EventFactory implements ConversationAbandonedListener {
|
|||||||
if (modifiedName != null) {
|
if (modifiedName != null) {
|
||||||
modName = modifiedName;
|
modName = modifiedName;
|
||||||
for (Quest q : quests.getQuests()) {
|
for (Quest q : quests.getQuests()) {
|
||||||
for (Stage s : q.orderedStages) {
|
for (Stage s : q.getStages()) {
|
||||||
if (s.finishEvent != null && s.finishEvent.name != null) {
|
if (s.finishEvent != null && s.finishEvent.name != null) {
|
||||||
if (s.finishEvent.name.equalsIgnoreCase(modifiedName)) {
|
if (s.finishEvent.name.equalsIgnoreCase(modifiedName)) {
|
||||||
modified.add(q.getName());
|
modified.add(q.getName());
|
||||||
|
@ -59,7 +59,7 @@ public class NpcListener implements Listener {
|
|||||||
final Quester quester = plugin.getQuester(player.getUniqueId());
|
final Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
boolean delivery = false;
|
boolean delivery = false;
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "deliverItem") && player.getItemInHand() != null) {
|
if (quester.containsObjective(quest, "deliverItem") && player.getItemInHand() != null) {
|
||||||
ItemStack hand = player.getItemInHand();
|
ItemStack hand = player.getItemInHand();
|
||||||
ItemStack found = null;
|
ItemStack found = null;
|
||||||
for (ItemStack is : quester.getCurrentStage(quest).itemsToDeliver) {
|
for (ItemStack is : quester.getCurrentStage(quest).itemsToDeliver) {
|
||||||
@ -112,7 +112,7 @@ public class NpcListener implements Listener {
|
|||||||
if (plugin.questNPCs.contains(evt.getNPC()) && delivery == false) {
|
if (plugin.questNPCs.contains(evt.getNPC()) && delivery == false) {
|
||||||
boolean hasObjective = false;
|
boolean hasObjective = false;
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "talkToNPC")) {
|
if (quester.containsObjective(quest, "talkToNPC")) {
|
||||||
if (quester.getQuestData(quest) != null && quester.getQuestData(quest).citizensInteracted.containsKey(evt.getNPC().getId()) && quester.getQuestData(quest).citizensInteracted.get(evt.getNPC().getId()) == false) {
|
if (quester.getQuestData(quest) != null && quester.getQuestData(quest).citizensInteracted.containsKey(evt.getNPC().getId()) && quester.getQuestData(quest).citizensInteracted.get(evt.getNPC().getId()) == false) {
|
||||||
hasObjective = true;
|
hasObjective = true;
|
||||||
}
|
}
|
||||||
@ -125,11 +125,11 @@ public class NpcListener implements Listener {
|
|||||||
if (quester.currentQuests.containsKey(q))
|
if (quester.currentQuests.containsKey(q))
|
||||||
continue;
|
continue;
|
||||||
if (q.npcStart != null && q.npcStart.getId() == evt.getNPC().getId()) {
|
if (q.npcStart != null && q.npcStart.getId() == evt.getNPC().getId()) {
|
||||||
if (plugin.ignoreLockedQuests && (quester.completedQuests.contains(q.name) == false || q.cooldownPlanner > -1)) {
|
if (plugin.ignoreLockedQuests && (quester.completedQuests.contains(q.getName()) == false || q.cooldownPlanner > -1)) {
|
||||||
if (q.testRequirements(quester)) {
|
if (q.testRequirements(quester)) {
|
||||||
npcQuests.add(q);
|
npcQuests.add(q);
|
||||||
}
|
}
|
||||||
} else if (quester.completedQuests.contains(q.name) == false || q.cooldownPlanner > -1) {
|
} else if (quester.completedQuests.contains(q.getName()) == false || q.cooldownPlanner > -1) {
|
||||||
npcQuests.add(q);
|
npcQuests.add(q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,9 +145,9 @@ public class NpcListener implements Listener {
|
|||||||
c.begin();
|
c.begin();
|
||||||
} else if (npcQuests.size() == 1) {
|
} else if (npcQuests.size() == 1) {
|
||||||
Quest q = npcQuests.get(0);
|
Quest q = npcQuests.get(0);
|
||||||
if (!quester.completedQuests.contains(q.name)) {
|
if (!quester.completedQuests.contains(q.getName())) {
|
||||||
if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
||||||
quester.questToTake = q.name;
|
quester.questToTake = q.getName();
|
||||||
String s = extracted(quester);
|
String s = extracted(quester);
|
||||||
for (String msg : s.split("<br>")) {
|
for (String msg : s.split("<br>")) {
|
||||||
player.sendMessage(msg);
|
player.sendMessage(msg);
|
||||||
@ -161,15 +161,15 @@ public class NpcListener implements Listener {
|
|||||||
} else if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
} else if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
||||||
if (quester.getDifference(q) > 0) {
|
if (quester.getDifference(q) > 0) {
|
||||||
String early = Lang.get(player, "questTooEarly");
|
String early = Lang.get(player, "questTooEarly");
|
||||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
early = early.replaceAll("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
||||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||||
player.sendMessage(ChatColor.YELLOW + early);
|
player.sendMessage(ChatColor.YELLOW + early);
|
||||||
} else if (q.cooldownPlanner < 0) {
|
} else if (q.cooldownPlanner < 0) {
|
||||||
String completed = Lang.get(player, "questAlreadyCompleted");
|
String completed = Lang.get(player, "questAlreadyCompleted");
|
||||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
||||||
player.sendMessage(ChatColor.YELLOW + completed);
|
player.sendMessage(ChatColor.YELLOW + completed);
|
||||||
} else {
|
} else {
|
||||||
quester.questToTake = q.name;
|
quester.questToTake = q.getName();
|
||||||
String s = extracted(quester);
|
String s = extracted(quester);
|
||||||
for (String msg : s.split("<br>")) {
|
for (String msg : s.split("<br>")) {
|
||||||
player.sendMessage(msg);
|
player.sendMessage(msg);
|
||||||
@ -214,7 +214,7 @@ public class NpcListener implements Listener {
|
|||||||
if (okay) {
|
if (okay) {
|
||||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "killNPC")) {
|
if (quester.containsObjective(quest, "killNPC")) {
|
||||||
quester.killNPC(quest, evt.getNPC());
|
quester.killNPC(quest, evt.getNPC());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,7 +231,7 @@ public class NpcListener implements Listener {
|
|||||||
Player player = (Player) damager;
|
Player player = (Player) damager;
|
||||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "killNPC")) {
|
if (quester.containsObjective(quest, "killNPC")) {
|
||||||
quester.killNPC(quest, evt.getNPC());
|
quester.killNPC(quest, evt.getNPC());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,16 +112,16 @@ public class PlayerListener implements Listener {
|
|||||||
String msg = Lang.get(player, "questMaxAllowed");
|
String msg = Lang.get(player, "questMaxAllowed");
|
||||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||||
player.sendMessage(ChatColor.YELLOW + msg);
|
player.sendMessage(ChatColor.YELLOW + msg);
|
||||||
} else if (quester.completedQuests.contains(quest.name) && quest.cooldownPlanner < 0) {
|
} else if (quester.completedQuests.contains(quest.getName()) && quest.cooldownPlanner < 0) {
|
||||||
String completed = Lang.get(player, "questAlreadyCompleted");
|
String completed = Lang.get(player, "questAlreadyCompleted");
|
||||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
|
completed = completed.replaceAll("<quest>", ChatColor.AQUA + quest.getName() + ChatColor.YELLOW);
|
||||||
player.sendMessage(ChatColor.YELLOW + completed);
|
player.sendMessage(ChatColor.YELLOW + completed);
|
||||||
} else {
|
} else {
|
||||||
boolean takeable = true;
|
boolean takeable = true;
|
||||||
if (quester.completedQuests.contains(quest.name)) {
|
if (quester.completedQuests.contains(quest.getName())) {
|
||||||
if (quester.getDifference(quest) > 0) {
|
if (quester.getDifference(quest) > 0) {
|
||||||
String early = Lang.get(player, "questTooEarly");
|
String early = Lang.get(player, "questTooEarly");
|
||||||
early = early.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
|
early = early.replaceAll("<quest>", ChatColor.AQUA + quest.getName() + ChatColor.YELLOW);
|
||||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(quest)) + ChatColor.YELLOW);
|
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(quest)) + ChatColor.YELLOW);
|
||||||
player.sendMessage(ChatColor.YELLOW + early);
|
player.sendMessage(ChatColor.YELLOW + early);
|
||||||
takeable = false;
|
takeable = false;
|
||||||
@ -141,7 +141,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
if (inRegion == false) {
|
if (inRegion == false) {
|
||||||
String invalidLoc = Lang.get(player, "questInvalidLocation");
|
String invalidLoc = Lang.get(player, "questInvalidLocation");
|
||||||
invalidLoc = invalidLoc.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
|
invalidLoc = invalidLoc.replaceAll("<quest>", ChatColor.AQUA + quest.getName() + ChatColor.YELLOW);
|
||||||
player.sendMessage(ChatColor.YELLOW + invalidLoc);
|
player.sendMessage(ChatColor.YELLOW + invalidLoc);
|
||||||
takeable = false;
|
takeable = false;
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ public class PlayerListener implements Listener {
|
|||||||
final Player player = evt.getPlayer();
|
final Player player = evt.getPlayer();
|
||||||
boolean hasObjective = false;
|
boolean hasObjective = false;
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "useBlock")) {
|
if (quester.containsObjective(quest, "useBlock")) {
|
||||||
ItemStack i = new ItemStack(evt.getClickedBlock().getType(), 1, evt.getClickedBlock().getState().getData().toItemStack().getDurability());
|
ItemStack i = new ItemStack(evt.getClickedBlock().getType(), 1, evt.getClickedBlock().getState().getData().toItemStack().getDurability());
|
||||||
quester.useBlock(quest, i);
|
quester.useBlock(quest, i);
|
||||||
hasObjective = true;
|
hasObjective = true;
|
||||||
@ -250,21 +250,21 @@ public class PlayerListener implements Listener {
|
|||||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||||
player.sendMessage(ChatColor.YELLOW + msg);
|
player.sendMessage(ChatColor.YELLOW + msg);
|
||||||
} else {
|
} else {
|
||||||
if (quester.completedQuests.contains(q.name)) {
|
if (quester.completedQuests.contains(q.getName())) {
|
||||||
if (q.cooldownPlanner > -1 && (quester.getDifference(q)) > 0) {
|
if (q.cooldownPlanner > -1 && (quester.getDifference(q)) > 0) {
|
||||||
String early = Lang.get(player, "questTooEarly");
|
String early = Lang.get(player, "questTooEarly");
|
||||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
early = early.replaceAll("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
||||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||||
player.sendMessage(ChatColor.YELLOW + early);
|
player.sendMessage(ChatColor.YELLOW + early);
|
||||||
return;
|
return;
|
||||||
} else if (quester.completedQuests.contains(q.name) && q.cooldownPlanner < 0) {
|
} else if (quester.completedQuests.contains(q.getName()) && q.cooldownPlanner < 0) {
|
||||||
String completed = Lang.get(player, "questAlreadyCompleted");
|
String completed = Lang.get(player, "questAlreadyCompleted");
|
||||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
||||||
player.sendMessage(ChatColor.YELLOW + completed);
|
player.sendMessage(ChatColor.YELLOW + completed);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
quester.questToTake = q.name;
|
quester.questToTake = q.getName();
|
||||||
String s = ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n" + "\n" + ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
String s = ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n" + "\n" + ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
||||||
for (String msg : s.split("<br>")) {
|
for (String msg : s.split("<br>")) {
|
||||||
player.sendMessage(msg);
|
player.sendMessage(msg);
|
||||||
@ -320,7 +320,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (quester.hasObjective(quest, "password")) {
|
if (quester.containsObjective(quest, "password")) {
|
||||||
quester.sayPass(quest, evt);
|
quester.sayPass(quest, evt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,7 +361,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "damageBlock")) {
|
if (quester.containsObjective(quest, "damageBlock")) {
|
||||||
ItemStack i = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
|
ItemStack i = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
|
||||||
quester.damageBlock(quest, i);
|
quester.damageBlock(quest, i);
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "placeBlock")) {
|
if (quester.containsObjective(quest, "placeBlock")) {
|
||||||
if (evt.isCancelled() == false) {
|
if (evt.isCancelled() == false) {
|
||||||
ItemStack i = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
|
ItemStack i = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
|
||||||
quester.placeBlock(quest, i);
|
quester.placeBlock(quest, i);
|
||||||
@ -391,13 +391,13 @@ public class PlayerListener implements Listener {
|
|||||||
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "breakBlock")) {
|
if (quester.containsObjective(quest, "breakBlock")) {
|
||||||
if (evt.getPlayer().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH) == false && evt.isCancelled() == false) {
|
if (evt.getPlayer().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH) == false && evt.isCancelled() == false) {
|
||||||
ItemStack i = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
|
ItemStack i = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
|
||||||
quester.breakBlock(quest, i);
|
quester.breakBlock(quest, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (quester.hasObjective(quest, "placeBlock")) {
|
if (quester.containsObjective(quest, "placeBlock")) {
|
||||||
for (ItemStack is : quester.getQuestData(quest).blocksPlaced) {
|
for (ItemStack is : quester.getQuestData(quest).blocksPlaced) {
|
||||||
if (is.getAmount() > 0) {
|
if (is.getAmount() > 0) {
|
||||||
if (evt.isCancelled() == false) {
|
if (evt.isCancelled() == false) {
|
||||||
@ -408,7 +408,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (evt.getPlayer().getItemInHand().getType().equals(Material.SHEARS) && quester.hasObjective(quest, "cutBlock")) {
|
if (evt.getPlayer().getItemInHand().getType().equals(Material.SHEARS) && quester.containsObjective(quest, "cutBlock")) {
|
||||||
ItemStack i = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
|
ItemStack i = new ItemStack(evt.getBlock().getType(), 1, evt.getBlock().getState().getData().toItemStack().getDurability());
|
||||||
quester.cutBlock(quest, i);
|
quester.cutBlock(quest, i);
|
||||||
}
|
}
|
||||||
@ -421,7 +421,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (evt.getEntity().getType() == EntityType.SHEEP && quester.hasObjective(quest, "shearSheep")) {
|
if (evt.getEntity().getType() == EntityType.SHEEP && quester.containsObjective(quest, "shearSheep")) {
|
||||||
Sheep sheep = (Sheep) evt.getEntity();
|
Sheep sheep = (Sheep) evt.getEntity();
|
||||||
quester.shearSheep(quest, sheep.getColor());
|
quester.shearSheep(quest, sheep.getColor());
|
||||||
}
|
}
|
||||||
@ -436,7 +436,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (plugin.checkQuester(p.getUniqueId()) == false) {
|
if (plugin.checkQuester(p.getUniqueId()) == false) {
|
||||||
Quester quester = plugin.getQuester(p.getUniqueId());
|
Quester quester = plugin.getQuester(p.getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "tameMob")) {
|
if (quester.containsObjective(quest, "tameMob")) {
|
||||||
quester.tameMob(quest, evt.getEntityType());
|
quester.tameMob(quest, evt.getEntityType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -449,7 +449,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (plugin.checkQuester(evt.getEnchanter().getUniqueId()) == false) {
|
if (plugin.checkQuester(evt.getEnchanter().getUniqueId()) == false) {
|
||||||
Quester quester = plugin.getQuester(evt.getEnchanter().getUniqueId());
|
Quester quester = plugin.getQuester(evt.getEnchanter().getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "enchantItem")) {
|
if (quester.containsObjective(quest, "enchantItem")) {
|
||||||
for (Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
for (Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
||||||
quester.enchantItem(quest, e, evt.getItem().getType());
|
quester.enchantItem(quest, e, evt.getItem().getType());
|
||||||
}
|
}
|
||||||
@ -507,7 +507,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (CitizensAPI.getNPCRegistry().isNPC(target)) {
|
if (CitizensAPI.getNPCRegistry().isNPC(target)) {
|
||||||
Quester quester = plugin.getQuester(damager.getUniqueId());
|
Quester quester = plugin.getQuester(damager.getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "killNPC")) {
|
if (quester.containsObjective(quest, "killNPC")) {
|
||||||
quester.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
|
quester.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -516,7 +516,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
Quester quester = plugin.getQuester(damager.getUniqueId());
|
Quester quester = plugin.getQuester(damager.getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "killMob")) {
|
if (quester.containsObjective(quest, "killMob")) {
|
||||||
quester.killMob(quest, target.getLocation(), target.getType());
|
quester.killMob(quest, target.getLocation(), target.getType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -602,7 +602,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (target instanceof Player && !CitizensAPI.getNPCRegistry().isNPC(target)) {
|
if (target instanceof Player && !CitizensAPI.getNPCRegistry().isNPC(target)) {
|
||||||
Quester quester = plugin.getQuester(damager.getUniqueId());
|
Quester quester = plugin.getQuester(damager.getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "killPlayer")) {
|
if (quester.containsObjective(quest, "killPlayer")) {
|
||||||
quester.killPlayer(quest, (Player)target);
|
quester.killPlayer(quest, (Player)target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -616,7 +616,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (plugin.checkQuester(player.getUniqueId()) == false) {
|
if (plugin.checkQuester(player.getUniqueId()) == false) {
|
||||||
Quester quester = plugin.getQuester(player.getUniqueId());
|
Quester quester = plugin.getQuester(player.getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "catchFish") && evt.getState().equals(State.CAUGHT_FISH)) {
|
if (quester.containsObjective(quest, "catchFish") && evt.getState().equals(State.CAUGHT_FISH)) {
|
||||||
quester.catchFish(quest);
|
quester.catchFish(quest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -664,8 +664,8 @@ public class PlayerListener implements Listener {
|
|||||||
for (String s : quester.completedQuests) {
|
for (String s : quester.completedQuests) {
|
||||||
Quest q = plugin.getQuest(s);
|
Quest q = plugin.getQuest(s);
|
||||||
if (q != null) {
|
if (q != null) {
|
||||||
if (quester.completedTimes.containsKey(q.name) == false && q.cooldownPlanner > -1) {
|
if (quester.completedTimes.containsKey(q.getName()) == false && q.cooldownPlanner > -1) {
|
||||||
quester.completedTimes.put(q.name, System.currentTimeMillis());
|
quester.completedTimes.put(q.getName(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -731,7 +731,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
Quester quester = plugin.getQuester(evt.getPlayer().getUniqueId());
|
||||||
for (Quest quest : quester.currentQuests.keySet()) {
|
for (Quest quest : quester.currentQuests.keySet()) {
|
||||||
if (quester.hasObjective(quest, "reachLocation")) {
|
if (quester.containsObjective(quest, "reachLocation")) {
|
||||||
quester.reachLocation(quest, evt.getTo());
|
quester.reachLocation(quest, evt.getTo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ public class Quest {
|
|||||||
public String region = null;
|
public String region = null;
|
||||||
public ItemStack guiDisplay = null;
|
public ItemStack guiDisplay = null;
|
||||||
public int parties = 0;
|
public int parties = 0;
|
||||||
public LinkedList<Stage> orderedStages = new LinkedList<Stage>();
|
private LinkedList<Stage> orderedStages = new LinkedList<Stage>();
|
||||||
NPC npcStart;
|
NPC npcStart;
|
||||||
Location blockStart;
|
Location blockStart;
|
||||||
Quests plugin;
|
Quests plugin;
|
||||||
@ -89,6 +89,14 @@ public class Quest {
|
|||||||
List<Double> heroesAmounts = new LinkedList<Double>();
|
List<Double> heroesAmounts = new LinkedList<Double>();
|
||||||
List<String> phatLootRewards = new LinkedList<String>();
|
List<String> phatLootRewards = new LinkedList<String>();
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public Stage getStage(int index) {
|
public Stage getStage(int index) {
|
||||||
try {
|
try {
|
||||||
return orderedStages.get(index);
|
return orderedStages.get(index);
|
||||||
@ -96,6 +104,10 @@ public class Quest {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LinkedList<Stage> getStages() {
|
||||||
|
return orderedStages;
|
||||||
|
}
|
||||||
|
|
||||||
public void nextStage(Quester q) {
|
public void nextStage(Quester q) {
|
||||||
String stageCompleteMessage = q.getCurrentStage(this).completeMessage;
|
String stageCompleteMessage = q.getCurrentStage(this).completeMessage;
|
||||||
@ -192,10 +204,6 @@ public class Quest {
|
|||||||
return targetLocation != null;
|
return targetLocation != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean testRequirements(Quester quester) {
|
public boolean testRequirements(Quester quester) {
|
||||||
return testRequirements(quester.getPlayer());
|
return testRequirements(quester.getPlayer());
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
for (Quest q : plugin.quests) {
|
for (Quest q : plugin.quests) {
|
||||||
if (q.name.equalsIgnoreCase(input)) {
|
if (q.getName().equalsIgnoreCase(input)) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNameExists"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("questEditorNameExists"));
|
||||||
return new QuestNamePrompt();
|
return new QuestNamePrompt();
|
||||||
}
|
}
|
||||||
@ -403,7 +403,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
public Prompt acceptInput(ConversationContext context, String input) {
|
||||||
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
|
||||||
for (Quest q : plugin.quests) {
|
for (Quest q : plugin.quests) {
|
||||||
if (q.name.equalsIgnoreCase(input)) {
|
if (q.getName().equalsIgnoreCase(input)) {
|
||||||
String s = null;
|
String s = null;
|
||||||
if (context.getSessionData(CK.ED_QUEST_EDIT) != null) {
|
if (context.getSessionData(CK.ED_QUEST_EDIT) != null) {
|
||||||
s = (String) context.getSessionData(CK.ED_QUEST_EDIT);
|
s = (String) context.getSessionData(CK.ED_QUEST_EDIT);
|
||||||
@ -532,7 +532,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
if (quest.guiDisplay != null) {
|
if (quest.guiDisplay != null) {
|
||||||
if (ItemUtil.compareItems(stack, quest.guiDisplay, false) == 0) {
|
if (ItemUtil.compareItems(stack, quest.guiDisplay, false) == 0) {
|
||||||
String error = Lang.get("questGUIError");
|
String error = Lang.get("questGUIError");
|
||||||
error = error.replaceAll("<quest>", ChatColor.DARK_PURPLE + quest.name + ChatColor.RED);
|
error = error.replaceAll("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.RED);
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + error);
|
context.getForWhom().sendRawMessage(ChatColor.RED + error);
|
||||||
failed = true;
|
failed = true;
|
||||||
break;
|
break;
|
||||||
@ -1295,8 +1295,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void loadQuest(ConversationContext cc, Quest q) {
|
public static void loadQuest(ConversationContext cc, Quest q) {
|
||||||
cc.setSessionData(CK.ED_QUEST_EDIT, q.name);
|
cc.setSessionData(CK.ED_QUEST_EDIT, q.getName());
|
||||||
cc.setSessionData(CK.Q_NAME, q.name);
|
cc.setSessionData(CK.Q_NAME, q.getName());
|
||||||
if (q.npcStart != null) {
|
if (q.npcStart != null) {
|
||||||
cc.setSessionData(CK.Q_START_NPC, q.npcStart.getId());
|
cc.setSessionData(CK.Q_START_NPC, q.npcStart.getId());
|
||||||
}
|
}
|
||||||
@ -1415,7 +1415,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
//
|
//
|
||||||
// Stages
|
// Stages
|
||||||
int index = 1;
|
int index = 1;
|
||||||
for (Stage stage : q.orderedStages) {
|
for (Stage stage : q.getStages()) {
|
||||||
final String pref = "stage" + index;
|
final String pref = "stage" + index;
|
||||||
index++;
|
index++;
|
||||||
cc.setSessionData(pref, Boolean.TRUE);
|
cc.setSessionData(pref, Boolean.TRUE);
|
||||||
@ -1655,7 +1655,7 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
String text = ChatColor.GOLD + Lang.get("questDeleteTitle") + "\n";
|
String text = ChatColor.GOLD + Lang.get("questDeleteTitle") + "\n";
|
||||||
for (Quest quest : plugin.quests) {
|
for (Quest quest : plugin.quests) {
|
||||||
text += ChatColor.AQUA + quest.name + ChatColor.YELLOW + ",";
|
text += ChatColor.AQUA + quest.getName() + ChatColor.YELLOW + ",";
|
||||||
}
|
}
|
||||||
text = text.substring(0, text.length() - 1) + "\n";
|
text = text.substring(0, text.length() - 1) + "\n";
|
||||||
text += ChatColor.YELLOW + Lang.get("questEditorEnterQuestName");
|
text += ChatColor.YELLOW + Lang.get("questEditorEnterQuestName");
|
||||||
@ -1669,12 +1669,12 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
Quest found = plugin.findQuest(input);
|
Quest found = plugin.findQuest(input);
|
||||||
if (found != null) {
|
if (found != null) {
|
||||||
for (Quest q : plugin.quests) {
|
for (Quest q : plugin.quests) {
|
||||||
if (q.neededQuests.contains(q.name) || q.blockQuests.contains(q.name)) {
|
if (q.neededQuests.contains(q.getName()) || q.blockQuests.contains(q.getName())) {
|
||||||
used.add(q.name);
|
used.add(q.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (used.isEmpty()) {
|
if (used.isEmpty()) {
|
||||||
context.setSessionData(CK.ED_QUEST_DELETE, found.name);
|
context.setSessionData(CK.ED_QUEST_DELETE, found.getName());
|
||||||
return new DeletePrompt();
|
return new DeletePrompt();
|
||||||
} else {
|
} else {
|
||||||
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questEditorQuestAsRequirement1") + " \"" + ChatColor.DARK_PURPLE + context.getSessionData(CK.ED_QUEST_DELETE) + ChatColor.RED + "\" " + Lang.get("questEditorQuestAsRequirement2"));
|
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questEditorQuestAsRequirement1") + " \"" + ChatColor.DARK_PURPLE + context.getSessionData(CK.ED_QUEST_DELETE) + ChatColor.RED + "\" " + Lang.get("questEditorQuestAsRequirement2"));
|
||||||
|
@ -255,15 +255,15 @@ public class Quester {
|
|||||||
int currentLines = 0;
|
int currentLines = 0;
|
||||||
String page = "";
|
String page = "";
|
||||||
for (Quest quest : currentQuests.keySet()) {
|
for (Quest quest : currentQuests.keySet()) {
|
||||||
if ((currentLength + quest.name.length() > 240) || (currentLines + ((quest.name.length() % 19) == 0 ? (quest.name.length() / 19) : ((quest.name.length() / 19) + 1))) > 13) {
|
if ((currentLength + quest.getName().length() > 240) || (currentLines + ((quest.getName().length() % 19) == 0 ? (quest.getName().length() / 19) : ((quest.getName().length() / 19) + 1))) > 13) {
|
||||||
book.addPage(page);
|
book.addPage(page);
|
||||||
page += ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + quest.name + "\n";
|
page += ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + quest.getName() + "\n";
|
||||||
currentLength = quest.name.length();
|
currentLength = quest.getName().length();
|
||||||
currentLines = (quest.name.length() % 19) == 0 ? (quest.name.length() / 19) : (quest.name.length() + 1);
|
currentLines = (quest.getName().length() % 19) == 0 ? (quest.getName().length() / 19) : (quest.getName().length() + 1);
|
||||||
} else {
|
} else {
|
||||||
page += ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + quest.name + "\n";
|
page += ChatColor.DARK_PURPLE + "" + ChatColor.BOLD + quest.getName() + "\n";
|
||||||
currentLength += quest.name.length();
|
currentLength += quest.getName().length();
|
||||||
currentLines += (quest.name.length() / 19);
|
currentLines += (quest.getName().length() / 19);
|
||||||
}
|
}
|
||||||
if (getObjectives(quest, false) != null) {
|
if (getObjectives(quest, false) != null) {
|
||||||
for (String obj : getObjectives(quest, false)) {
|
for (String obj : getObjectives(quest, false)) {
|
||||||
@ -280,7 +280,7 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
plugin.getLogger().severe("Quest Journal: objectives were null for " + quest.name);
|
plugin.getLogger().severe("Quest Journal: objectives were null for " + quest.getName());
|
||||||
}
|
}
|
||||||
if (currentLines < 13)
|
if (currentLines < 13)
|
||||||
page += "\n";
|
page += "\n";
|
||||||
@ -340,7 +340,7 @@ public class Quester {
|
|||||||
long nextEnd = nextStart + questLength;
|
long nextEnd = nextStart + questLength;
|
||||||
if (System.currentTimeMillis() < nextStart) {
|
if (System.currentTimeMillis() < nextStart) {
|
||||||
String early = Lang.get("plnTooEarly");
|
String early = Lang.get("plnTooEarly");
|
||||||
early = early.replace("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
early = early.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
||||||
early = early.replace("<time>", ChatColor.DARK_PURPLE
|
early = early.replace("<time>", ChatColor.DARK_PURPLE
|
||||||
+ Quests.getTime(nextStart - System.currentTimeMillis()) + ChatColor.YELLOW);
|
+ Quests.getTime(nextStart - System.currentTimeMillis()) + ChatColor.YELLOW);
|
||||||
player.sendMessage(ChatColor.YELLOW + early);
|
player.sendMessage(ChatColor.YELLOW + early);
|
||||||
@ -350,7 +350,7 @@ public class Quester {
|
|||||||
if (System.currentTimeMillis() > nextEnd) {
|
if (System.currentTimeMillis() > nextEnd) {
|
||||||
if (System.currentTimeMillis() > end) {
|
if (System.currentTimeMillis() > end) {
|
||||||
String late = Lang.get("plnTooLate");
|
String late = Lang.get("plnTooLate");
|
||||||
late = late.replace("<quest>", ChatColor.AQUA + q.name + ChatColor.RED);
|
late = late.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.RED);
|
||||||
late = late.replace("<time>", ChatColor.DARK_PURPLE
|
late = late.replace("<time>", ChatColor.DARK_PURPLE
|
||||||
+ Quests.getTime(System.currentTimeMillis() - end) + ChatColor.RED);
|
+ Quests.getTime(System.currentTimeMillis() - end) + ChatColor.RED);
|
||||||
player.sendMessage(ChatColor.RED + late);
|
player.sendMessage(ChatColor.RED + late);
|
||||||
@ -363,7 +363,7 @@ public class Quester {
|
|||||||
if (q.startPlanner != null) {
|
if (q.startPlanner != null) {
|
||||||
if (System.currentTimeMillis() < start) {
|
if (System.currentTimeMillis() < start) {
|
||||||
String early = Lang.get("plnTooEarly");
|
String early = Lang.get("plnTooEarly");
|
||||||
early = early.replace("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
early = early.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
||||||
early = early.replace("<time>", ChatColor.DARK_PURPLE
|
early = early.replace("<time>", ChatColor.DARK_PURPLE
|
||||||
+ Quests.getTime(start - System.currentTimeMillis()) + ChatColor.YELLOW);
|
+ Quests.getTime(start - System.currentTimeMillis()) + ChatColor.YELLOW);
|
||||||
player.sendMessage(ChatColor.YELLOW + early);
|
player.sendMessage(ChatColor.YELLOW + early);
|
||||||
@ -374,7 +374,7 @@ public class Quester {
|
|||||||
if (q.endPlanner != null) {
|
if (q.endPlanner != null) {
|
||||||
if (System.currentTimeMillis() > end) {
|
if (System.currentTimeMillis() > end) {
|
||||||
String late = Lang.get("plnTooLate");
|
String late = Lang.get("plnTooLate");
|
||||||
late = late.replace("<quest>", ChatColor.AQUA + q.name + ChatColor.RED);
|
late = late.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.RED);
|
||||||
late = late.replace("<time>", ChatColor.DARK_PURPLE
|
late = late.replace("<time>", ChatColor.DARK_PURPLE
|
||||||
+ Quests.getTime(System.currentTimeMillis() - end) + ChatColor.RED);
|
+ Quests.getTime(System.currentTimeMillis() - end) + ChatColor.RED);
|
||||||
player.sendMessage(ChatColor.RED + late);
|
player.sendMessage(ChatColor.RED + late);
|
||||||
@ -386,7 +386,7 @@ public class Quester {
|
|||||||
try {
|
try {
|
||||||
currentQuests.put(q, 0);
|
currentQuests.put(q, 0);
|
||||||
} catch (NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
plugin.getLogger().severe("Unable to add quest" + q.name + " for player " + player.getName()
|
plugin.getLogger().severe("Unable to add quest" + q.getName() + " for player " + player.getName()
|
||||||
+ ". Consider resetting player data or report on Github");
|
+ ". Consider resetting player data or report on Github");
|
||||||
}
|
}
|
||||||
Stage stage = q.getStage(0);
|
Stage stage = q.getStage(0);
|
||||||
@ -402,18 +402,18 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String accepted = Lang.get(getPlayer(), "questAccepted");
|
String accepted = Lang.get(getPlayer(), "questAccepted");
|
||||||
accepted = accepted.replace("<quest>", q.name);
|
accepted = accepted.replace("<quest>", q.getName());
|
||||||
player.sendMessage(ChatColor.GREEN + accepted);
|
player.sendMessage(ChatColor.GREEN + accepted);
|
||||||
player.sendMessage("");
|
player.sendMessage("");
|
||||||
if (plugin.showQuestTitles) {
|
if (plugin.showQuestTitles) {
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
||||||
+ " title " + "{\"text\":\"" + Lang.get(getPlayer(), "quest") + " " + Lang.get(getPlayer(), "accepted") + "\",\"color\":\"gold\"}");
|
+ " title " + "{\"text\":\"" + Lang.get(getPlayer(), "quest") + " " + Lang.get(getPlayer(), "accepted") + "\",\"color\":\"gold\"}");
|
||||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
||||||
+ " subtitle " + "{\"text\":\"" + q.name + "\",\"color\":\"yellow\"}");
|
+ " subtitle " + "{\"text\":\"" + q.getName() + "\",\"color\":\"yellow\"}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String msg = Lang.get(getPlayer(), "questObjectivesTitle");
|
String msg = Lang.get(getPlayer(), "questObjectivesTitle");
|
||||||
msg = msg.replace("<quest>", q.name);
|
msg = msg.replace("<quest>", q.getName());
|
||||||
getPlayer().sendMessage(ChatColor.GOLD + msg);
|
getPlayer().sendMessage(ChatColor.GOLD + msg);
|
||||||
plugin.showObjectives(q, this, false);
|
plugin.showObjectives(q, this, false);
|
||||||
String stageStartMessage = stage.startMessage;
|
String stageStartMessage = stage.startMessage;
|
||||||
@ -717,7 +717,7 @@ public class Quester {
|
|||||||
try {
|
try {
|
||||||
display = display.replace("%" + key + "%", ((String) datamap.get(key)));
|
display = display.replace("%" + key + "%", ((String) datamap.get(key)));
|
||||||
} catch (NullPointerException ne) {
|
} catch (NullPointerException ne) {
|
||||||
plugin.getLogger().severe("Unable to fetch display for " + co.getName() + " on " + quest.name);
|
plugin.getLogger().severe("Unable to fetch display for " + co.getName() + " on " + quest.getName());
|
||||||
ne.printStackTrace();
|
ne.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -741,14 +741,41 @@ public class Quester {
|
|||||||
return objectives;
|
return objectives;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if player's current stage has the specified objective<p>
|
||||||
|
*
|
||||||
|
* Accepted strings are: breakBlock, damageBlock, placeBlock, useBlock,
|
||||||
|
* cutBlock, catchFish, enchantItem, killMob, deliverItem, killPlayer,
|
||||||
|
* talkToNPC, killNPC, tameMob, shearSheep, password, reachLocations
|
||||||
|
*
|
||||||
|
* @deprecated Use containsObjective() instead
|
||||||
|
* @param quest The quest to check objectives of
|
||||||
|
* @param s The type of objective to check for
|
||||||
|
* @return true if quest contains specified objective
|
||||||
|
*/
|
||||||
public boolean hasObjective(Quest quest, String s) {
|
public boolean hasObjective(Quest quest, String s) {
|
||||||
|
return containsObjective(quest, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if player's current stage has the specified objective<p>
|
||||||
|
*
|
||||||
|
* Accepted strings are: breakBlock, damageBlock, placeBlock, useBlock,
|
||||||
|
* cutBlock, catchFish, enchantItem, killMob, deliverItem, killPlayer,
|
||||||
|
* talkToNPC, killNPC, tameMob, shearSheep, password, reachLocations
|
||||||
|
*
|
||||||
|
* @param quest The quest to check objectives of
|
||||||
|
* @param s The type of objective to check for
|
||||||
|
* @return true if quest contains specified objective
|
||||||
|
*/
|
||||||
|
public boolean containsObjective(Quest quest, String s) {
|
||||||
if (getCurrentStage(quest) == null) {
|
if (getCurrentStage(quest) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (s.equalsIgnoreCase("damageBlock")) {
|
if (s.equalsIgnoreCase("breakBlock")) {
|
||||||
return !getCurrentStage(quest).blocksToDamage.isEmpty();
|
|
||||||
} else if (s.equalsIgnoreCase("breakBlock")) {
|
|
||||||
return !getCurrentStage(quest).blocksToBreak.isEmpty();
|
return !getCurrentStage(quest).blocksToBreak.isEmpty();
|
||||||
|
} else if (s.equalsIgnoreCase("damageBlock")) {
|
||||||
|
return !getCurrentStage(quest).blocksToDamage.isEmpty();
|
||||||
} else if (s.equalsIgnoreCase("placeBlock")) {
|
} else if (s.equalsIgnoreCase("placeBlock")) {
|
||||||
return !getCurrentStage(quest).blocksToPlace.isEmpty();
|
return !getCurrentStage(quest).blocksToPlace.isEmpty();
|
||||||
} else if (s.equalsIgnoreCase("useBlock")) {
|
} else if (s.equalsIgnoreCase("useBlock")) {
|
||||||
@ -773,12 +800,12 @@ public class Quester {
|
|||||||
return !getCurrentStage(quest).mobsToTame.isEmpty();
|
return !getCurrentStage(quest).mobsToTame.isEmpty();
|
||||||
} else if (s.equalsIgnoreCase("shearSheep")) {
|
} else if (s.equalsIgnoreCase("shearSheep")) {
|
||||||
return !getCurrentStage(quest).sheepToShear.isEmpty();
|
return !getCurrentStage(quest).sheepToShear.isEmpty();
|
||||||
} else if (s.equalsIgnoreCase("craftItem")) {
|
|
||||||
return !getCurrentStage(quest).itemsToCraft.isEmpty();
|
|
||||||
} else if (s.equalsIgnoreCase("password")) {
|
} else if (s.equalsIgnoreCase("password")) {
|
||||||
return !getCurrentStage(quest).passwordPhrases.isEmpty();
|
return !getCurrentStage(quest).passwordPhrases.isEmpty();
|
||||||
} else {
|
} else if (s.equalsIgnoreCase("reachLocations")) {
|
||||||
return !getCurrentStage(quest).locationsToReach.isEmpty();
|
return !getCurrentStage(quest).locationsToReach.isEmpty();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1179,7 +1206,7 @@ public class Quester {
|
|||||||
int amount = getQuestData(quest).itemsDelivered.get(found);
|
int amount = getQuestData(quest).itemsDelivered.get(found);
|
||||||
if (getCurrentStage(quest).itemsToDeliver.indexOf(found) < 0) {
|
if (getCurrentStage(quest).itemsToDeliver.indexOf(found) < 0) {
|
||||||
plugin.getLogger().severe("Index out of bounds while delivering " + found.getType() + " x " + found.getAmount() + " for quest "
|
plugin.getLogger().severe("Index out of bounds while delivering " + found.getType() + " x " + found.getAmount() + " for quest "
|
||||||
+ quest.name + " with " + i.getType() + " x " + i.getAmount() + " already delivered. Int -amount- reports value of " +
|
+ quest.getName() + " with " + i.getType() + " x " + i.getAmount() + " already delivered. Int -amount- reports value of " +
|
||||||
+ amount + ". Please report this error on Github issue #448");
|
+ amount + ". Please report this error on Github issue #448");
|
||||||
player.sendMessage("Quests had a problem delivering your item, please contact an administrator!");
|
player.sendMessage("Quests had a problem delivering your item, please contact an administrator!");
|
||||||
return;
|
return;
|
||||||
@ -1696,11 +1723,11 @@ public class Quester {
|
|||||||
public long getDifference(Quest q) {
|
public long getDifference(Quest q) {
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
long lastTime;
|
long lastTime;
|
||||||
if (completedTimes.containsKey(q.name) == false) {
|
if (completedTimes.containsKey(q.getName()) == false) {
|
||||||
lastTime = System.currentTimeMillis();
|
lastTime = System.currentTimeMillis();
|
||||||
completedTimes.put(q.name, System.currentTimeMillis());
|
completedTimes.put(q.getName(), System.currentTimeMillis());
|
||||||
} else {
|
} else {
|
||||||
lastTime = completedTimes.get(q.name);
|
lastTime = completedTimes.get(q.getName());
|
||||||
}
|
}
|
||||||
long comparator = q.cooldownPlanner;
|
long comparator = q.cooldownPlanner;
|
||||||
long difference = (comparator - (currentTime - lastTime));
|
long difference = (comparator - (currentTime - lastTime));
|
||||||
@ -1714,7 +1741,7 @@ public class Quester {
|
|||||||
ArrayList<String> questNames = new ArrayList<String>();
|
ArrayList<String> questNames = new ArrayList<String>();
|
||||||
ArrayList<Integer> questStages = new ArrayList<Integer>();
|
ArrayList<Integer> questStages = new ArrayList<Integer>();
|
||||||
for (Quest quest : currentQuests.keySet()) {
|
for (Quest quest : currentQuests.keySet()) {
|
||||||
questNames.add(quest.name);
|
questNames.add(quest.getName());
|
||||||
questStages.add(currentQuests.get(quest));
|
questStages.add(currentQuests.get(quest));
|
||||||
}
|
}
|
||||||
data.set("currentQuests", questNames);
|
data.set("currentQuests", questNames);
|
||||||
@ -1722,11 +1749,11 @@ public class Quester {
|
|||||||
data.set("quest-points", questPoints);
|
data.set("quest-points", questPoints);
|
||||||
ConfigurationSection dataSec = data.createSection("questData");
|
ConfigurationSection dataSec = data.createSection("questData");
|
||||||
for (Quest quest : currentQuests.keySet()) {
|
for (Quest quest : currentQuests.keySet()) {
|
||||||
if (quest.name == null || quest.name.isEmpty()) {
|
if (quest.getName() == null || quest.getName().isEmpty()) {
|
||||||
plugin.getLogger().severe("Quest name was null or empty while loading data");
|
plugin.getLogger().severe("Quest name was null or empty while loading data");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ConfigurationSection questSec = dataSec.createSection(quest.name);
|
ConfigurationSection questSec = dataSec.createSection(quest.getName());
|
||||||
QuestData questData = getQuestData(quest);
|
QuestData questData = getQuestData(quest);
|
||||||
if (questData == null)
|
if (questData == null)
|
||||||
continue;
|
continue;
|
||||||
@ -2033,8 +2060,8 @@ public class Quester {
|
|||||||
List<Long> redoTimes = data.getLongList("completedQuestTimes");
|
List<Long> redoTimes = data.getLongList("completedQuestTimes");
|
||||||
for (String s : redoNames) {
|
for (String s : redoNames) {
|
||||||
for (Quest q : plugin.quests) {
|
for (Quest q : plugin.quests) {
|
||||||
if (q.name.equalsIgnoreCase(s)) {
|
if (q.getName().equalsIgnoreCase(s)) {
|
||||||
completedTimes.put(q.name, redoTimes.get(redoNames.indexOf(s)));
|
completedTimes.put(q.getName(), redoTimes.get(redoNames.indexOf(s)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2052,9 +2079,9 @@ public class Quester {
|
|||||||
if (data.isList("completed-Quests")) {
|
if (data.isList("completed-Quests")) {
|
||||||
for (String s : data.getStringList("completed-Quests")) {
|
for (String s : data.getStringList("completed-Quests")) {
|
||||||
for (Quest q : plugin.quests) {
|
for (Quest q : plugin.quests) {
|
||||||
if (q.name.equalsIgnoreCase(s)) {
|
if (q.getName().equalsIgnoreCase(s)) {
|
||||||
if (!completedQuests.contains(q.name)) {
|
if (!completedQuests.contains(q.getName())) {
|
||||||
completedQuests.add(q.name);
|
completedQuests.add(q.getName());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2087,7 +2114,7 @@ public class Quester {
|
|||||||
stage = getCurrentStage(quest);
|
stage = getCurrentStage(quest);
|
||||||
if (stage == null) {
|
if (stage == null) {
|
||||||
quest.completeQuest(this);
|
quest.completeQuest(this);
|
||||||
plugin.getLogger().severe("[Quests] Invalid stage number for player: \"" + id + "\" on Quest \"" + quest.name + "\". Quest ended.");
|
plugin.getLogger().severe("[Quests] Invalid stage number for player: \"" + id + "\" on Quest \"" + quest.getName() + "\". Quest ended.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
addEmptiesFor(quest, 0);
|
addEmptiesFor(quest, 0);
|
||||||
@ -2505,7 +2532,7 @@ public class Quester {
|
|||||||
if (quest != null) {
|
if (quest != null) {
|
||||||
boolean exists = false;
|
boolean exists = false;
|
||||||
for (Quest q : plugin.quests) {
|
for (Quest q : plugin.quests) {
|
||||||
if (q.name.equalsIgnoreCase(quest.name)) {
|
if (q.getName().equalsIgnoreCase(quest.getName())) {
|
||||||
Stage stage = getCurrentStage(quest);
|
Stage stage = getCurrentStage(quest);
|
||||||
quest.updateCompass(this, stage);
|
quest.updateCompass(this, stage);
|
||||||
exists = true;
|
exists = true;
|
||||||
@ -2516,7 +2543,7 @@ public class Quester {
|
|||||||
* hardQuit(quest);
|
* hardQuit(quest);
|
||||||
*
|
*
|
||||||
* if (plugin.getServer().getPlayer(id) != null) { String error = Lang.get("questModified"); error = error.replace("<quest>",
|
* if (plugin.getServer().getPlayer(id) != null) { String error = Lang.get("questModified"); error = error.replace("<quest>",
|
||||||
* ChatColor.DARK_PURPLE + quest.name + ChatColor.RED); plugin.getServer().getPlayer(id).sendMessage(ChatColor.GOLD + "[Quests] "
|
* ChatColor.DARK_PURPLE + quest.getName() + ChatColor.RED); plugin.getServer().getPlayer(id).sendMessage(ChatColor.GOLD + "[Quests] "
|
||||||
* + ChatColor.RED + error); updateJournal(); }
|
* + ChatColor.RED + error); updateJournal(); }
|
||||||
*
|
*
|
||||||
* }
|
* }
|
||||||
@ -2527,7 +2554,7 @@ public class Quester {
|
|||||||
if (exists == false) {
|
if (exists == false) {
|
||||||
if (plugin.getServer().getPlayer(id) != null) {
|
if (plugin.getServer().getPlayer(id) != null) {
|
||||||
String error = Lang.get("questNotExist");
|
String error = Lang.get("questNotExist");
|
||||||
error = error.replace("<quest>", ChatColor.DARK_PURPLE + quest.name + ChatColor.RED);
|
error = error.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.RED);
|
||||||
plugin.getServer().getPlayer(id).sendMessage(ChatColor.GOLD + "[Quests] " + ChatColor.RED + error);
|
plugin.getServer().getPlayer(id).sendMessage(ChatColor.GOLD + "[Quests] " + ChatColor.RED + error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2628,7 +2655,7 @@ public class Quester {
|
|||||||
if (quests.get(i).guiDisplay != null) {
|
if (quests.get(i).guiDisplay != null) {
|
||||||
ItemStack display = quests.get(i).guiDisplay;
|
ItemStack display = quests.get(i).guiDisplay;
|
||||||
ItemMeta meta = display.getItemMeta();
|
ItemMeta meta = display.getItemMeta();
|
||||||
if (completedQuests.contains(quests.get(i).name)) {
|
if (completedQuests.contains(quests.get(i).getName())) {
|
||||||
meta.setDisplayName(ChatColor.DARK_PURPLE + Quests.parseString(quests.get(i).getName()
|
meta.setDisplayName(ChatColor.DARK_PURPLE + Quests.parseString(quests.get(i).getName()
|
||||||
+ " " + ChatColor.GREEN + Lang.get(player, "redoCompleted"), npc));
|
+ " " + ChatColor.GREEN + Lang.get(player, "redoCompleted"), npc));
|
||||||
} else {
|
} else {
|
||||||
@ -2673,7 +2700,7 @@ public class Quester {
|
|||||||
|
|
||||||
public void hardRemove(Quest quest) {
|
public void hardRemove(Quest quest) {
|
||||||
try {
|
try {
|
||||||
completedQuests.remove(quest.name);
|
completedQuests.remove(quest.getName());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -35,11 +35,6 @@ public class Stage {
|
|||||||
Integer fishToCatch;
|
Integer fishToCatch;
|
||||||
Integer playersToKill;
|
Integer playersToKill;
|
||||||
Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>();
|
Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>();
|
||||||
LinkedList<EntityType> mobsToKill = new LinkedList<EntityType>();
|
|
||||||
LinkedList<Integer> mobNumToKill = new LinkedList<Integer>();
|
|
||||||
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
|
|
||||||
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
|
|
||||||
LinkedList<String> areaNames = new LinkedList<String>();
|
|
||||||
LinkedList<ItemStack> itemsToDeliver = new LinkedList<ItemStack>();
|
LinkedList<ItemStack> itemsToDeliver = new LinkedList<ItemStack>();
|
||||||
LinkedList<Integer> itemDeliveryTargets = new LinkedList<Integer>() {
|
LinkedList<Integer> itemDeliveryTargets = new LinkedList<Integer>() {
|
||||||
|
|
||||||
@ -100,19 +95,23 @@ public class Stage {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
public LinkedList<Integer> citizenNumToKill = new LinkedList<Integer>();
|
public LinkedList<Integer> citizenNumToKill = new LinkedList<Integer>();
|
||||||
|
LinkedList<EntityType> mobsToKill = new LinkedList<EntityType>();
|
||||||
|
LinkedList<Integer> mobNumToKill = new LinkedList<Integer>();
|
||||||
|
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
|
||||||
|
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
|
||||||
|
LinkedList<String> areaNames = new LinkedList<String>();
|
||||||
public LinkedList<Location> locationsToReach = new LinkedList<Location>();
|
public LinkedList<Location> locationsToReach = new LinkedList<Location>();
|
||||||
public LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>();
|
public LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>();
|
||||||
public LinkedList<World> worldsToReachWithin = new LinkedList<World>();
|
public LinkedList<World> worldsToReachWithin = new LinkedList<World>();
|
||||||
public LinkedList<String> locationNames = new LinkedList<String>();
|
public LinkedList<String> locationNames = new LinkedList<String>();
|
||||||
public Map<EntityType, Integer> mobsToTame = new EnumMap<EntityType, Integer>(EntityType.class);
|
public Map<EntityType, Integer> mobsToTame = new EnumMap<EntityType, Integer>(EntityType.class);
|
||||||
public Map<DyeColor, Integer> sheepToShear = new EnumMap<DyeColor, Integer>(DyeColor.class);
|
public Map<DyeColor, Integer> sheepToShear = new EnumMap<DyeColor, Integer>(DyeColor.class);
|
||||||
public Map<EnumMap<Material, Integer>, Boolean> itemsToCraft = new HashMap<EnumMap<Material, Integer>, Boolean>();
|
public LinkedList<String> passwordDisplays = new LinkedList<String>();
|
||||||
|
public LinkedList<LinkedList<String>> passwordPhrases = new LinkedList<LinkedList<String>>();
|
||||||
public LinkedList<CustomObjective> customObjectives = new LinkedList<CustomObjective>();
|
public LinkedList<CustomObjective> customObjectives = new LinkedList<CustomObjective>();
|
||||||
public LinkedList<Integer> customObjectiveCounts = new LinkedList<Integer>();
|
public LinkedList<Integer> customObjectiveCounts = new LinkedList<Integer>();
|
||||||
public LinkedList<String> customObjectiveDisplays = new LinkedList<String>();
|
public LinkedList<String> customObjectiveDisplays = new LinkedList<String>();
|
||||||
public LinkedList<Map<String, Object>> customObjectiveData = new LinkedList<Map<String, Object>>();
|
public LinkedList<Map<String, Object>> customObjectiveData = new LinkedList<Map<String, Object>>();
|
||||||
public LinkedList<String> passwordDisplays = new LinkedList<String>();
|
|
||||||
public LinkedList<LinkedList<String>> passwordPhrases = new LinkedList<LinkedList<String>>();
|
|
||||||
public String script;
|
public String script;
|
||||||
public Event startEvent = null;
|
public Event startEvent = null;
|
||||||
public Event deathEvent = null;
|
public Event deathEvent = null;
|
||||||
@ -127,7 +126,9 @@ public class Stage {
|
|||||||
public String objectiveOverride = null;
|
public String objectiveOverride = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if stage has at least one objective EXCLUDING start/complete message
|
* Check if stage has at least one objective<p>
|
||||||
|
*
|
||||||
|
* Excludes start/complete message, delay, and objective-override
|
||||||
*
|
*
|
||||||
* @return true if stage contains an objective
|
* @return true if stage contains an objective
|
||||||
*/
|
*/
|
||||||
@ -139,6 +140,15 @@ public class Stage {
|
|||||||
if (blocksToCut.isEmpty() == false) { return true; }
|
if (blocksToCut.isEmpty() == false) { return true; }
|
||||||
if (fishToCatch != null) { return true; }
|
if (fishToCatch != null) { return true; }
|
||||||
if (playersToKill != null) { return true; }
|
if (playersToKill != null) { return true; }
|
||||||
|
if (itemsToEnchant.isEmpty() == false) { return true; }
|
||||||
|
if (itemsToDeliver.isEmpty() == false) { return true; }
|
||||||
|
if (citizensToInteract.isEmpty() == false) { return true; }
|
||||||
|
if (citizensToKill.isEmpty() == false) { return true; }
|
||||||
|
if (locationsToReach.isEmpty() == false) { return true; }
|
||||||
|
if (mobsToTame.isEmpty() == false) { return true; }
|
||||||
|
if (sheepToShear.isEmpty() == false) { return true; }
|
||||||
|
if (passwordDisplays.isEmpty() == false) { return true; }
|
||||||
|
if (customObjectives.isEmpty() == false) { return true; }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class StageTimer implements Runnable {
|
|||||||
public void run() {
|
public void run() {
|
||||||
if (quester.getQuestData(quest).delayOver) {
|
if (quester.getQuestData(quest).delayOver) {
|
||||||
Player player = quester.getPlayer();
|
Player player = quester.getPlayer();
|
||||||
if (quest.orderedStages.indexOf(quester.getCurrentStage(quest)) == (quest.orderedStages.size() - 1)) {
|
if (quest.getStages().indexOf(quester.getCurrentStage(quest)) == (quest.getStages().size() - 1)) {
|
||||||
if (quester.getCurrentStage(quest).script != null) {
|
if (quester.getCurrentStage(quest).script != null) {
|
||||||
plugin.trigger.parseQuestTaskTrigger(quester.getCurrentStage(quest).script, player);
|
plugin.trigger.parseQuestTaskTrigger(quester.getCurrentStage(quest).script, player);
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ public class StageTimer implements Runnable {
|
|||||||
quester.getQuestData(quest).delayStartTime = 0;
|
quester.getQuestData(quest).delayStartTime = 0;
|
||||||
quester.getQuestData(quest).delayTimeLeft = -1;
|
quester.getQuestData(quest).delayTimeLeft = -1;
|
||||||
String msg = Lang.get(player, "questObjectivesTitle");
|
String msg = Lang.get(player, "questObjectivesTitle");
|
||||||
msg = msg.replace("<quest>", quest.name);
|
msg = msg.replace("<quest>", quest.getName());
|
||||||
player.sendMessage(ChatColor.GOLD + msg);
|
player.sendMessage(ChatColor.GOLD + msg);
|
||||||
plugin.showObjectives(quest, quester, false);
|
plugin.showObjectives(quest, quester, false);
|
||||||
String stageStartMessage = quester.getCurrentStage(quest).startMessage;
|
String stageStartMessage = quester.getCurrentStage(quest).startMessage;
|
||||||
|
@ -100,10 +100,10 @@ public class QuestAcceptPrompt extends StringPrompt {
|
|||||||
return new QuestAcceptPrompt(plugin);
|
return new QuestAcceptPrompt(plugin);
|
||||||
} else {
|
} else {
|
||||||
Player player = quester.getPlayer();
|
Player player = quester.getPlayer();
|
||||||
if (!quester.completedQuests.contains(q.name)) {
|
if (!quester.completedQuests.contains(q.getName())) {
|
||||||
if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
||||||
if (q.testRequirements(quester)) {
|
if (q.testRequirements(quester)) {
|
||||||
quester.questToTake = q.name;
|
quester.questToTake = q.getName();
|
||||||
String s = extracted(quester);
|
String s = extracted(quester);
|
||||||
for (String msg : s.split("<br>")) {
|
for (String msg : s.split("<br>")) {
|
||||||
player.sendMessage(msg);
|
player.sendMessage(msg);
|
||||||
@ -121,19 +121,19 @@ public class QuestAcceptPrompt extends StringPrompt {
|
|||||||
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
msg = msg.replaceAll("<number>", String.valueOf(plugin.maxQuests));
|
||||||
player.sendMessage(ChatColor.YELLOW + msg);
|
player.sendMessage(ChatColor.YELLOW + msg);
|
||||||
}
|
}
|
||||||
} else if (quester.completedQuests.contains(q.name)) {
|
} else if (quester.completedQuests.contains(q.getName())) {
|
||||||
if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
if (quester.currentQuests.size() < plugin.maxQuests || plugin.maxQuests < 1) {
|
||||||
if (quester.getDifference(q) > 0) {
|
if (quester.getDifference(q) > 0) {
|
||||||
String early = Lang.get("questTooEarly");
|
String early = Lang.get("questTooEarly");
|
||||||
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
early = early.replaceAll("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
||||||
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
|
||||||
player.sendMessage(ChatColor.YELLOW + early);
|
player.sendMessage(ChatColor.YELLOW + early);
|
||||||
} else if (q.cooldownPlanner < 0) {
|
} else if (q.cooldownPlanner < 0) {
|
||||||
String completed = Lang.get("questAlreadyCompleted");
|
String completed = Lang.get("questAlreadyCompleted");
|
||||||
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
|
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
||||||
player.sendMessage(ChatColor.YELLOW + completed);
|
player.sendMessage(ChatColor.YELLOW + completed);
|
||||||
} else {
|
} else {
|
||||||
quester.questToTake = q.name;
|
quester.questToTake = q.getName();
|
||||||
String s = extracted(quester);
|
String s = extracted(quester);
|
||||||
for (String msg : s.split("<br>")) {
|
for (String msg : s.split("<br>")) {
|
||||||
player.sendMessage(msg);
|
player.sendMessage(msg);
|
||||||
|
@ -296,7 +296,7 @@ public class RequirementsPrompt extends FixedSetPrompt {
|
|||||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listDuplicate"));
|
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("listDuplicate"));
|
||||||
return new QuestListPrompt(isRequiredQuest);
|
return new QuestListPrompt(isRequiredQuest);
|
||||||
}
|
}
|
||||||
questNames.add(quests.getQuest(s).name);
|
questNames.add(quests.getQuest(s).getName());
|
||||||
}
|
}
|
||||||
Collections.sort(questNames, new Comparator<String>() {
|
Collections.sort(questNames, new Comparator<String>() {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user