mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Don't suggest default namespaces.
This just ends adding a lot of `minecraft:` to otherwise short commands. (cherry picked from commit d2601851835201d11e5805250ecffc703d0b0cd6)
This commit is contained in:
parent
396b03edf7
commit
ee3a30d582
@ -149,7 +149,8 @@ public final class SuggestionHelper {
|
|||||||
if (input.isEmpty() || input.equals(":")) {
|
if (input.isEmpty() || input.equals(":")) {
|
||||||
final Set<String> namespaces = registry.getKnownNamespaces();
|
final Set<String> namespaces = registry.getKnownNamespaces();
|
||||||
if (namespaces.size() == 1) {
|
if (namespaces.size() == 1) {
|
||||||
return registry.keySet().stream();
|
int def = namespaces.iterator().next().length() + 1; // default namespace length + ':'
|
||||||
|
return registry.keySet().stream().map(s -> s.substring(def));
|
||||||
} else {
|
} else {
|
||||||
return namespaces.stream().map(s -> s + ":");
|
return namespaces.stream().map(s -> s + ":");
|
||||||
}
|
}
|
||||||
@ -164,7 +165,8 @@ public final class SuggestionHelper {
|
|||||||
// don't yet have namespace - search namespaces + default
|
// don't yet have namespace - search namespaces + default
|
||||||
final String lowerSearch = input.toLowerCase(Locale.ROOT);
|
final String lowerSearch = input.toLowerCase(Locale.ROOT);
|
||||||
String defKey = registry.getDefaultNamespace() + ":" + lowerSearch;
|
String defKey = registry.getDefaultNamespace() + ":" + lowerSearch;
|
||||||
return Stream.concat(registry.keySet().stream().filter(s -> s.startsWith(defKey)),
|
int defLength = registry.getDefaultNamespace().length() + 1;
|
||||||
|
return Stream.concat(registry.keySet().stream().filter(s -> s.startsWith(defKey)).map(s -> s.substring(defLength)),
|
||||||
registry.getKnownNamespaces().stream().filter(n -> n.startsWith(lowerSearch)).map(n -> n + ":"));
|
registry.getKnownNamespaces().stream().filter(n -> n.startsWith(lowerSearch)).map(n -> n + ":"));
|
||||||
}
|
}
|
||||||
// have a namespace - search that
|
// have a namespace - search that
|
||||||
|
Loading…
Reference in New Issue
Block a user