Add support for primary prefixes
This commit is contained in:
parent
765bb8537f
commit
0124b6952c
|
|
@ -78,7 +78,8 @@ public class Utility {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
prefix.append(user.getCachedData().getMetaData().getPrefix());
|
prefix.append(getUserPrefix(user));
|
||||||
|
// prefix.append(user.getCachedData().getMetaData().getPrefix());
|
||||||
|
|
||||||
return applyColor(prefix.toString());
|
return applyColor(prefix.toString());
|
||||||
}
|
}
|
||||||
|
|
@ -91,11 +92,29 @@ public class Utility {
|
||||||
if(user.getCachedData().getPermissionData().checkPermission("group." + Config.MINIMIUMSTAFFRANK).asBoolean()) {
|
if(user.getCachedData().getPermissionData().checkPermission("group." + Config.MINIMIUMSTAFFRANK).asBoolean()) {
|
||||||
Group group = luckPerms.getGroupManager().getGroup(user.getPrimaryGroup());
|
Group group = luckPerms.getGroupManager().getGroup(user.getPrimaryGroup());
|
||||||
if(group != null)
|
if(group != null)
|
||||||
prefix.append(group.getCachedData().getMetaData().getPrefix());
|
prefix.append(getGroupPrefix(group));
|
||||||
|
// prefix.append(group.getCachedData().getMetaData().getPrefix());
|
||||||
}
|
}
|
||||||
return applyColor(prefix.toString());
|
return applyColor(prefix.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getUserPrefix(User user) {
|
||||||
|
LuckPerms luckPerms = ChatAPI.get().getLuckPerms();
|
||||||
|
Group group = luckPerms.getGroupManager().getGroup(user.getPrimaryGroup());
|
||||||
|
if (group == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return ChatAPI.get().getPrefixes().get(group.getName()).replace("<prefix>", user.getCachedData().getMetaData().getPrefix());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getGroupPrefix(String groupName) {
|
||||||
|
Group group = ChatAPI.get().getLuckPerms().getGroupManager().getGroup(groupName);
|
||||||
|
if (group == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return getGroupPrefix(group);
|
||||||
|
}
|
||||||
|
|
||||||
public static String getGroupPrefix(Group group) {
|
public static String getGroupPrefix(Group group) {
|
||||||
return ChatAPI.get().getPrefixes().get(group.getName()).replace("<prefix>", group.getCachedData().getMetaData().getPrefix());
|
return ChatAPI.get().getPrefixes().get(group.getName()).replace("<prefix>", group.getCachedData().getMetaData().getPrefix());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user