mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-26 04:05:28 +01:00
Fix command mapping for /authme:unregister etc.
This commit is contained in:
parent
e3426cd731
commit
c9b66183de
@ -123,6 +123,9 @@ public class CommandMapper {
|
||||
|
||||
private CommandDescription getBaseCommand(String label) {
|
||||
String baseLabel = label.toLowerCase();
|
||||
if (baseLabel.startsWith("authme:")) {
|
||||
baseLabel = baseLabel.substring("authme:".length());
|
||||
}
|
||||
for (CommandDescription command : baseCommands) {
|
||||
if (command.hasLabel(baseLabel)) {
|
||||
return command;
|
||||
|
@ -290,6 +290,21 @@ public class CommandMapperTest {
|
||||
assertThat(result.getArguments(), contains(parts.get(2)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldSupportAuthMePrefix() {
|
||||
// given
|
||||
List<String> parts = asList("authme:unregister", "Betty");
|
||||
CommandSender sender = mock(CommandSender.class);
|
||||
given(permissionsManager.hasPermission(eq(sender), any(PermissionNode.class))).willReturn(true);
|
||||
|
||||
// when
|
||||
FoundCommandResult result = mapper.mapPartsToCommand(sender, parts);
|
||||
|
||||
// then
|
||||
assertThat(result.getResultStatus(), equalTo(FoundResultStatus.SUCCESS));
|
||||
assertThat(result.getCommandDescription(), equalTo(getCommandWithLabel(commands, "unregister")));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void shouldReturnExecutableCommandClasses() {
|
||||
|
Loading…
Reference in New Issue
Block a user