Don't assume primary group is always present

Fixes a potential issue with PEX 2.0 (and 1.x) where users may not have a primary group.
Closes #2901.
This commit is contained in:
md678685 2019-12-26 13:08:38 +00:00
parent 8a04c1e232
commit 1c4ce7b4bd

View file

@ -46,23 +46,31 @@ public abstract class AbstractVaultHandler extends SuperpermsHandler {
@Override
public String getPrefix(final Player base) {
String playerPrefix = chat.getPlayerPrefix(base);
if (playerPrefix == null) {
String playerGroup = perms.getPrimaryGroup(base);
return chat.getGroupPrefix(base.getWorld().getName(), playerGroup);
} else {
if (playerPrefix != null) {
return playerPrefix;
}
String playerGroup = perms.getPrimaryGroup(base);
if (playerGroup != null) {
return chat.getGroupPrefix(base.getWorld().getName(), playerGroup);
}
return null;
}
@Override
public String getSuffix(final Player base) {
String playerSuffix = chat.getPlayerSuffix(base);
if (playerSuffix == null) {
String playerGroup = perms.getPrimaryGroup(base);
return chat.getGroupSuffix(base.getWorld().getName(), playerGroup);
} else {
if (playerSuffix != null) {
return playerSuffix;
}
String playerGroup = perms.getPrimaryGroup(base);
if (playerGroup != null) {
return chat.getGroupSuffix(base.getWorld().getName(), playerGroup);
}
return null;
}
boolean canLoad() {