Add group setdisplayname command (#493)

This commit is contained in:
Luck
2017-10-22 16:58:53 +01:00
Unverified
parent 26c813c07b
commit ca8cc91f37
33 changed files with 301 additions and 206 deletions
@@ -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
-6
View File
@@ -89,12 +89,6 @@ world-rewrite {
# world_the_end="world"
}
# Rewrites group names. The underlying name of the group does not change, just the output in
# commands / placeholders / Vault.
group-name-rewrite {
# default="Member"
}
# Controls how temporary permissions/parents/meta should be accumulated
#
# The default behaviour is "deny"