Skip to content

Commit

Permalink
Add total completed PAPI placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSzabo committed Aug 6, 2024
1 parent 84f2f8a commit 86d8f76
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ public String onPlaceholderRequest(Player player, String[] args) {
var manager = AuroraQuests.getInstance().getQuestManager();
var full = String.join("_", args);

if (full.endsWith("level_roman")) {
if (full.endsWith("total_completed_raw")) {
var sum = manager.getQuestPools().stream().mapToLong(p -> p.getCompletedQuestCount(player)).sum();
return String.valueOf(sum);
} else if(full.endsWith("total_completed")) {
var sum = manager.getQuestPools().stream().mapToLong(p -> p.getCompletedQuestCount(player)).sum();
return AuroraAPI.formatNumber(sum);
} else if (full.endsWith("level_roman")) {
var pool = manager.getQuestPool(full.substring(0, full.length() - 12));
if (pool == null) return null;
return RomanNumber.toRoman(pool.getPlayerLevel(player));
Expand Down Expand Up @@ -58,7 +64,10 @@ public String onPlaceholderRequest(Player player, String[] args) {
public List<String> getPatterns() {
var manager = AuroraQuests.getInstance().getQuestManager();

var list = new ArrayList<String>();
var list = new ArrayList<String>(manager.getQuestPools().size() * 7 + 2);

list.add("total_completed_raw");
list.add("total_completed");

for (var pool : manager.getQuestPools()) {
list.add(pool.getId() + "_level");
Expand Down

0 comments on commit 86d8f76

Please sign in to comment.