Clear extra space from custom objective display

This commit is contained in:
PikaMug 2024-01-12 05:17:07 -05:00
parent 3e59fc5659
commit 3f2465fe6c
2 changed files with 7 additions and 3 deletions

View File

@ -78,7 +78,7 @@ public class BukkitQuestJournal {
continue;
}
final String message = "- " + BukkitLang.BukkitFormatToken.convertString(player,
objective.getMessage());
objective.getMessage().trim().replaceAll("\\s{2,}", ""));
if (!plugin.getConfigSettings().canShowCompletedObjs()
&& message.startsWith(ChatColor.GRAY.toString())) {
continue;

View File

@ -1668,7 +1668,7 @@ public class BukkitQuester implements Quester {
if (co.canShowCount()) {
message = message.replace("%count%", cleared + "/" + toClear);
}
message = BukkitConfigUtil.parseString(message);
message = BukkitConfigUtil.parseString(message.trim().replaceAll("\\s{2,}", ""));
objectives.add(new BukkitObjective(ObjectiveType.CUSTOM, message, cleared, toClear));
customIndex++;
}
@ -1760,10 +1760,14 @@ public class BukkitQuester implements Quester {
if (!settings.canShowCompletedObjs() && objective.getProgress() >= objective.getGoal()) {
continue;
}
if (obj.getType().equals(ObjectiveType.CUSTOM)) {
quester.sendMessage(message.trim().replaceAll("\\s{2,}", ""));
} else {
quester.sendMessage(message);
}
}
}
}
/**
* Check if player's current stage has the specified objective