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.Lang;
import me.blackvein.quests.util.LocaleQuery; import me.blackvein.quests.util.LocaleQuery;
import me.blackvein.quests.util.MiscUtil; import me.blackvein.quests.util.MiscUtil;
import me.clip.placeholderapi.PlaceholderAPI;
import net.citizensnpcs.api.npc.NPC; import net.citizensnpcs.api.npc.NPC;
public class Quester { public class Quester {
@ -2082,7 +2083,10 @@ public class Quester {
if (getCurrentStage(quest).objectiveOverride != null) { if (getCurrentStage(quest).objectiveOverride != null) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + getCurrentStage(quest) String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + getCurrentStage(quest)
.objectiveOverride; .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")) { } else if (objective.equalsIgnoreCase("password")) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + pass; String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + pass;
p.sendMessage(message); p.sendMessage(message);

View File

@ -648,7 +648,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (!ignoreOverrides) { if (!ignoreOverrides) {
if (quester.getCurrentStage(quest) != null) { if (quester.getCurrentStage(quest) != null) {
if (quester.getCurrentStage(quest).objectiveOverride != 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; return;
} }
} }

View File

@ -151,14 +151,6 @@ public class ConfigUtil {
} }
return parsed; 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) { public static String parseString(String s, NPC npc) {
String parsed = parseString(s); String parsed = parseString(s);