Make PAPI tag better looking
This commit is contained in:
parent
6bd4b12f18
commit
81160ce074
@ -1,6 +1,7 @@
|
|||||||
package wtf.beatrice.nounspicker.objects;
|
package wtf.beatrice.nounspicker.objects;
|
||||||
|
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import wtf.beatrice.nounspicker.NounsPicker;
|
import wtf.beatrice.nounspicker.NounsPicker;
|
||||||
@ -50,6 +51,11 @@ public class PAPIManager extends PlaceholderExpansion
|
|||||||
|
|
||||||
int pronounId;
|
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: this sends query every time we get a papi call, which is horrible for performance.
|
||||||
// todo: we should cache player pronouns too.
|
// todo: we should cache player pronouns too.
|
||||||
|
|
||||||
@ -65,7 +71,8 @@ public class PAPIManager extends PlaceholderExpansion
|
|||||||
String mainPronounFormat = Cache.dbManager.getPronounFormat(pronounId);
|
String mainPronounFormat = Cache.dbManager.getPronounFormat(pronounId);
|
||||||
pronounId = Cache.dbManager.getPlayerPronounId(player.getName(), 1);
|
pronounId = Cache.dbManager.getPlayerPronounId(player.getName(), 1);
|
||||||
String secondaryPronounFormat = Cache.dbManager.getPronounFormat(pronounId);
|
String secondaryPronounFormat = Cache.dbManager.getPronounFormat(pronounId);
|
||||||
return "[" + mainPronounFormat + "/" + secondaryPronounFormat + "]";
|
return baseFormat.replace("%main%", mainPronounFormat)
|
||||||
|
.replace("%secondary%", secondaryPronounFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user