mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2026-11-24 10:34:24 +00:00
Add group setdisplayname command (#493)
This commit is contained in:
33 files changed
+301
-206
No files matched your search
@@ -288,4 +288,29 @@ public class SpongeGroupManager implements GroupManager, LPSubjectCollection {
|
||||
public void suggestUnload(String identifier) {
|
||||
// noop
|
||||
}
|
||||
|
||||
@Override
|
||||
public Group getByDisplayName(String name) {
|
||||
// try to get an exact match first
|
||||
Group g = getIfLoaded(name);
|
||||
if (g != null) {
|
||||
return g;
|
||||
}
|
||||
|
||||
// then try exact display name matches
|
||||
for (Group group : getAll().values()) {
|
||||
if (group.getDisplayName().isPresent() && group.getDisplayName().get().equals(name)) {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
|
||||
// then try case insensitive name matches
|
||||
for (Group group : getAll().values()) {
|
||||
if (group.getDisplayName().isPresent() && group.getDisplayName().get().equalsIgnoreCase(name)) {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -151,8 +151,7 @@ public class SpongeGroup extends Group {
|
||||
|
||||
@Override
|
||||
public Optional<String> getFriendlyIdentifier() {
|
||||
String rawDisplayName = parent.getRawDisplayName();
|
||||
return rawDisplayName.equals(getIdentifier()) ? Optional.empty() : Optional.of(rawDisplayName);
|
||||
return parent.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user