Allow color codes and tags in objective-overrides, part 2. Per #1047

This commit is contained in:
PikaMug 2020-01-22 23:31:25 -05:00
parent 2dea1eeebb
commit b352adda94
2 changed files with 11 additions and 5 deletions

View File

@ -578,7 +578,13 @@ public class Quester {
if (getCurrentStage(quest) != null) {
if (getCurrentStage(quest).objectiveOverride != null) {
LinkedList<String> objectives = new LinkedList<String>();
objectives.add(ChatColor.GREEN + getCurrentStage(quest).objectiveOverride);
String message = ChatColor.GREEN + ConfigUtil.parseString(
ChatColor.translateAlternateColorCodes('&', getCurrentStage(quest).objectiveOverride),
quest, getPlayer());
if (plugin.getDependencies().getPlaceholderApi() != null) {
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
}
objectives.add(message);
return objectives;
}
}
@ -2073,8 +2079,9 @@ public class Quester {
String pass, CustomObjective co) {
Player p = getPlayer();
if (getCurrentStage(quest).objectiveOverride != null) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + getCurrentStage(quest)
.objectiveOverride;
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") "
+ ConfigUtil.parseString(ChatColor.translateAlternateColorCodes('&',
getCurrentStage(quest).objectiveOverride), quest, p);
if (plugin.getDependencies().getPlaceholderApi() != null) {
message = PlaceholderAPI.setPlaceholders(p, message);
}

View File

@ -663,8 +663,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
if (!ignoreOverrides) {
if (quester.getCurrentStage(quest).objectiveOverride != null) {
String message = ChatColor.GREEN + ConfigUtil.parseString(ChatColor.GREEN
+ ChatColor.translateAlternateColorCodes('&',
String message = ChatColor.GREEN + ConfigUtil.parseString(ChatColor.translateAlternateColorCodes('&',
quester.getCurrentStage(quest).objectiveOverride), quest, quester.getPlayer());
if (depends.getPlaceholderApi() != null) {
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);