Fix PAPI issues when pronouns haven't been set
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Bea 2022-10-24 23:05:07 +02:00
parent 27b1fabd72
commit c4ce5e7399
2 changed files with 4 additions and 0 deletions

View File

@ -70,8 +70,10 @@ public class PAPIManager extends PlaceholderExpansion
return Cache.dbManager.getPronounFormat(pronounId);
case "full_tag":
pronounId = Cache.dbManager.getPlayerPronounId(player.getName(), 0);
if(pronounId < 0) return "";
String mainPronounFormat = Cache.dbManager.getPronounFormat(pronounId);
pronounId = Cache.dbManager.getPlayerPronounId(player.getName(), 1);
if(pronounId < 0) return "";
String secondaryPronounFormat = Cache.dbManager.getPronounFormat(pronounId);
return baseFormat.replace("%main%", mainPronounFormat)
.replace("%secondary%", secondaryPronounFormat);

View File

@ -260,6 +260,8 @@ public class DatabaseManager
}
public String getPronounFormat(int pronounId) {
if(pronounId < 0) return "";
String query = "SELECT format FROM pronouns " +
"WHERE id = " + pronounId + " " +
"LIMIT 1;";