Support PlaceholderAPI variables in objective-overrides part 2, per #980

This commit is contained in:
PikaMug 2019-11-08 15:24:43 -05:00
parent 2c5f09dec8
commit 75e7357929
3 changed files with 10 additions and 10 deletions

View File

@ -61,6 +61,7 @@ import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang;
import me.blackvein.quests.util.LocaleQuery;
import me.blackvein.quests.util.MiscUtil;
import me.clip.placeholderapi.PlaceholderAPI;
import net.citizensnpcs.api.npc.NPC;
public class Quester {
@ -2082,7 +2083,10 @@ public class Quester {
if (getCurrentStage(quest).objectiveOverride != null) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + getCurrentStage(quest)
.objectiveOverride;
p.sendMessage(ConfigUtil.parseString(message, p));
if (plugin.getDependencies().getPlaceholderApi() != null) {
message = PlaceholderAPI.setPlaceholders(p, message);
}
p.sendMessage(message);
} else if (objective.equalsIgnoreCase("password")) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + pass;
p.sendMessage(message);

View File

@ -648,7 +648,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (!ignoreOverrides) {
if (quester.getCurrentStage(quest) != null) {
if (quester.getCurrentStage(quest).objectiveOverride != null) {
quester.getPlayer().sendMessage(ChatColor.GREEN + quester.getCurrentStage(quest).objectiveOverride);
String message = ChatColor.GREEN + quester.getCurrentStage(quest).objectiveOverride;
if (depends.getPlaceholderApi() != null) {
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);
}
quester.getPlayer().sendMessage(message);
return;
}
}

View File

@ -152,14 +152,6 @@ public class ConfigUtil {
return parsed;
}
public static String parseString(String s, Player player) {
String parsed = parseString(s);
if (Dependencies.placeholder != null && player != null) {
parsed = PlaceholderAPI.setPlaceholders(player, parsed);
}
return parsed;
}
public static String parseString(String s, NPC npc) {
String parsed = parseString(s);
if (parsed.contains("<npc>")) {