mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
Process custom requirement display placeholders
This commit is contained in:
parent
a85c2d4b81
commit
d35301d1e5
@ -1129,12 +1129,23 @@ public class BukkitQuester implements Quester {
|
|||||||
for (final Entry<String, Map<String, Object>> m : requirements.getCustomRequirements().entrySet()) {
|
for (final Entry<String, Map<String, Object>> m : requirements.getCustomRequirements().entrySet()) {
|
||||||
for (final CustomRequirement cr : plugin.getCustomRequirements()) {
|
for (final CustomRequirement cr : plugin.getCustomRequirements()) {
|
||||||
if (cr.getName().equalsIgnoreCase(m.getKey())) {
|
if (cr.getName().equalsIgnoreCase(m.getKey())) {
|
||||||
|
String message = cr.getDisplay() != null ? cr.getDisplay() : m.getKey();
|
||||||
|
for (Entry<String, Object> prompt : cr.getData().entrySet()) {
|
||||||
|
final String replacement = "%" + prompt.getKey() + "%";
|
||||||
|
try {
|
||||||
|
if (message.contains(replacement)) {
|
||||||
|
message = message.replace(replacement, String.valueOf(m.getValue().get(prompt.getKey())));
|
||||||
|
}
|
||||||
|
} catch (final NullPointerException ne) {
|
||||||
|
plugin.getLogger().severe("Unable to gather display for " + cr.getName() + " on "
|
||||||
|
+ quest.getName());
|
||||||
|
ne.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (cr.testRequirement(getPlayer().getUniqueId(), m.getValue())) {
|
if (cr.testRequirement(getPlayer().getUniqueId(), m.getValue())) {
|
||||||
finishedRequirements.add(ChatColor.GREEN + ""
|
finishedRequirements.add(ChatColor.GREEN + "" + message);
|
||||||
+ (cr.getDisplay() != null ? cr.getDisplay() : m.getKey()));
|
|
||||||
} else {
|
} else {
|
||||||
unfinishedRequirements.add(ChatColor.GRAY + ""
|
unfinishedRequirements.add(ChatColor.GRAY + "" + message);
|
||||||
+ (cr.getDisplay() != null ? cr.getDisplay() : m.getKey()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user