Add group setdisplayname command (#493)

This commit is contained in:
Luck committed 2017-10-22 16:58:53 +01:00
1 parent 26c813c07b
commit ca8cc91f37
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