From 81160ce0745b9c5487e98d8d6faafca9497a8537 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beatrice=20Dellac=C3=A0?= Date: Mon, 24 Oct 2022 22:55:24 +0200 Subject: [PATCH] Make PAPI tag better looking --- .../wtf/beatrice/nounspicker/objects/PAPIManager.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/wtf/beatrice/nounspicker/objects/PAPIManager.java b/src/main/java/wtf/beatrice/nounspicker/objects/PAPIManager.java index cf5cce1..b88619b 100644 --- a/src/main/java/wtf/beatrice/nounspicker/objects/PAPIManager.java +++ b/src/main/java/wtf/beatrice/nounspicker/objects/PAPIManager.java @@ -1,6 +1,7 @@ package wtf.beatrice.nounspicker.objects; import me.clip.placeholderapi.expansion.PlaceholderExpansion; +import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; import wtf.beatrice.nounspicker.NounsPicker; @@ -50,6 +51,11 @@ public class PAPIManager extends PlaceholderExpansion int pronounId; + // base format is [She/Her] + final String baseFormat = ChatColor.DARK_GRAY + "%main%" + ChatColor.DARK_GRAY + "/" + + "%secondary%" + ChatColor.DARK_GRAY + "]" + ChatColor.RESET; + + // todo: this sends query every time we get a papi call, which is horrible for performance. // todo: we should cache player pronouns too. @@ -65,7 +71,8 @@ public class PAPIManager extends PlaceholderExpansion String mainPronounFormat = Cache.dbManager.getPronounFormat(pronounId); pronounId = Cache.dbManager.getPlayerPronounId(player.getName(), 1); String secondaryPronounFormat = Cache.dbManager.getPronounFormat(pronounId); - return "[" + mainPronounFormat + "/" + secondaryPronounFormat + "]"; + return baseFormat.replace("%main%", mainPronounFormat) + .replace("%secondary%", secondaryPronounFormat); } return null;