mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-24 01:58:42 +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.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);
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,14 +152,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);
|
||||||
if (parsed.contains("<npc>")) {
|
if (parsed.contains("<npc>")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user