mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-25 03:55:35 +01:00
Parse format tokens in objective message
This commit is contained in:
parent
3413895abf
commit
3e59fc5659
@ -57,8 +57,8 @@ public class BukkitQuestJournal {
|
||||
}
|
||||
|
||||
public List<BaseComponent[]> getPages() {
|
||||
if (owner.getCurrentQuests().isEmpty()) {
|
||||
final Player player = owner.getPlayer();
|
||||
if (owner.getCurrentQuests().isEmpty()) {
|
||||
final String title = BukkitLang.get(player, "journalTitle");
|
||||
return Collections.singletonList(new BookUtil.PageBuilder().add(new TextComponent(ChatColor.DARK_RED
|
||||
+ BukkitLang.get(player, "journalNoQuests").replace("<journal>", title))).build());
|
||||
@ -74,14 +74,18 @@ public class BukkitQuestJournal {
|
||||
final BookUtil.PageBuilder builder = new BookUtil.PageBuilder().add(title).newLine();
|
||||
for (final Objective obj : owner.getCurrentObjectives(quest, false, false)) {
|
||||
final BukkitObjective objective = (BukkitObjective) obj;
|
||||
if (!plugin.getConfigSettings().canShowCompletedObjs()
|
||||
&& objective.getMessage().startsWith(ChatColor.GRAY.toString())) {
|
||||
if (objective.getMessage() == null) {
|
||||
continue;
|
||||
}
|
||||
final String message = "- " + BukkitLang.BukkitFormatToken.convertString(player,
|
||||
objective.getMessage());
|
||||
if (!plugin.getConfigSettings().canShowCompletedObjs()
|
||||
&& message.startsWith(ChatColor.GRAY.toString())) {
|
||||
continue;
|
||||
}
|
||||
if (objective.getMessage() != null) {
|
||||
String[] split = null;
|
||||
if (objective.getMessage().contains("<item>") && objective.getGoalAsItem() != null) {
|
||||
split = objective.getMessage().split("<item>");
|
||||
if (message.contains("<item>") && objective.getGoalAsItem() != null) {
|
||||
split = message.split("<item>");
|
||||
builder.add(split[0]);
|
||||
final ItemStack goal = objective.getGoalAsItem();
|
||||
if (goal.getItemMeta() != null && goal.getItemMeta().hasDisplayName()) {
|
||||
@ -99,8 +103,8 @@ public class BukkitQuestJournal {
|
||||
}
|
||||
builder.add(split[1]).newLine();
|
||||
}
|
||||
if (objective.getMessage().contains("<mob>") && objective.getGoalAsMob() != null) {
|
||||
split = objective.getMessage().split("<mob>");
|
||||
if (message.contains("<mob>") && objective.getGoalAsMob() != null) {
|
||||
split = message.split("<mob>");
|
||||
builder.add(split[0]);
|
||||
if (plugin.getConfigSettings().canTranslateNames()) {
|
||||
final TranslatableComponent tc = new TranslatableComponent(plugin.getLocaleManager()
|
||||
@ -113,8 +117,7 @@ public class BukkitQuestJournal {
|
||||
builder.add(split[1]).newLine();
|
||||
}
|
||||
if (split == null) {
|
||||
builder.add(objective.getMessage()).newLine();
|
||||
}
|
||||
builder.add(message).newLine();
|
||||
}
|
||||
}
|
||||
pages.add(builder.build());
|
||||
|
@ -1714,7 +1714,8 @@ public class BukkitQuester implements Quester {
|
||||
}
|
||||
for (final Objective obj : q.getCurrentObjectives(quest, false, false)) {
|
||||
final BukkitObjective objective = (BukkitObjective) obj;
|
||||
final String message = "- " + objective.getMessage();
|
||||
final String message = "- " + BukkitLang.BukkitFormatToken.convertString(quester.getPlayer(),
|
||||
objective.getMessage());
|
||||
if (objective.getProgressAsItem() != null && objective.getGoalAsItem() != null) {
|
||||
final ItemStack progress = objective.getProgressAsItem();
|
||||
final ItemStack goal = objective.getGoalAsItem();
|
||||
|
Loading…
Reference in New Issue
Block a user