mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-16 17:16:11 +00:00
Change unknown selector to list to enable suggestions.
This commit is contained in:
parent
096a9e4f9f
commit
2b0a4bab27
@ -582,7 +582,7 @@ public class SelectionCommands {
|
|||||||
limit.ifPresent(integer -> player.print(integer + " points maximum."));
|
limit.ifPresent(integer -> player.print(integer + " points maximum."));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case UNKNOWN:
|
case LIST:
|
||||||
default:
|
default:
|
||||||
CommandListBox box = new CommandListBox("Selection modes", null);
|
CommandListBox box = new CommandListBox("Selection modes", null);
|
||||||
box.setHidingHelp(true);
|
box.setHidingHelp(true);
|
||||||
|
@ -29,14 +29,15 @@ import org.enginehub.piston.inject.Key;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class EnumConverter {
|
public final class EnumConverter {
|
||||||
|
|
||||||
public static void register(CommandManager commandManager) {
|
public static void register(CommandManager commandManager) {
|
||||||
commandManager.registerConverter(Key.of(SelectorChoice.class),
|
commandManager.registerConverter(Key.of(SelectorChoice.class),
|
||||||
basic(SelectorChoice.class, SelectorChoice.UNKNOWN));
|
basic(SelectorChoice.class));
|
||||||
commandManager.registerConverter(Key.of(TreeGenerator.TreeType.class),
|
commandManager.registerConverter(Key.of(TreeGenerator.TreeType.class),
|
||||||
full(TreeGenerator.TreeType.class,
|
full(TreeGenerator.TreeType.class,
|
||||||
t -> ImmutableSet.copyOf(t.lookupKeys),
|
t -> ImmutableSet.copyOf(t.lookupKeys),
|
||||||
@ -48,11 +49,11 @@ public class EnumConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static <E extends Enum<E>> ArgumentConverter<E> basic(Class<E> enumClass) {
|
private static <E extends Enum<E>> ArgumentConverter<E> basic(Class<E> enumClass) {
|
||||||
return full(enumClass, e -> ImmutableSet.of(e.name()), null);
|
return full(enumClass, e -> ImmutableSet.of(e.name().toLowerCase(Locale.ROOT)), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <E extends Enum<E>> ArgumentConverter<E> basic(Class<E> enumClass, E unknownValue) {
|
private static <E extends Enum<E>> ArgumentConverter<E> basic(Class<E> enumClass, @Nullable E unknownValue) {
|
||||||
return full(enumClass, e -> ImmutableSet.of(e.name()), unknownValue);
|
return full(enumClass, e -> ImmutableSet.of(e.name().toLowerCase(Locale.ROOT)), unknownValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <E extends Enum<E>> ArgumentConverter<E> full(Class<E> enumClass,
|
private static <E extends Enum<E>> ArgumentConverter<E> full(Class<E> enumClass,
|
||||||
|
@ -29,5 +29,5 @@ public enum SelectorChoice {
|
|||||||
CONVEX,
|
CONVEX,
|
||||||
HULL,
|
HULL,
|
||||||
POLYHEDRON,
|
POLYHEDRON,
|
||||||
UNKNOWN
|
LIST
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user