mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-19 15:48:10 +01:00
Support PlaceholderAPI variables in objective-overrides part 2, per #980
This commit is contained in:
parent
2c5f09dec8
commit
75e7357929
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -151,14 +151,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);
|
||||
|
Loading…
Reference in New Issue
Block a user