allowed the Arole parameter type to be either an id or the role mention

fixed adding/removing allowed roles, the compare did not work
changed a few commands to use the Arole parameter
This commit is contained in:
Sheldan
2020-04-28 22:12:29 +02:00
parent 6ed3a133e2
commit 85c47db5ed
18 changed files with 36 additions and 33 deletions

View File

@@ -53,7 +53,7 @@ public class SetExpRole extends AbstractConditionableCommand {
public CommandConfiguration getConfiguration() {
List<Parameter> parameters = new ArrayList<>();
parameters.add(Parameter.builder().name("level").type(Integer.class).build());
parameters.add(Parameter.builder().name("roleId").type(Long.class).build());
parameters.add(Parameter.builder().name("role").type(ARole.class).build());
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()
.name("setExpRole")

View File

@@ -28,8 +28,7 @@ public class UnSetExpRole extends AbstractConditionableCommand {
@Override
public CommandResult execute(CommandContext commandContext) {
Long roleId = (Long) commandContext.getParameters().getParameters().get(0);
ARole role = roleManagementService.findRole(roleId);
ARole role = (ARole) commandContext.getParameters().getParameters().get(0);
// do not check for the existence of the role, because if the role was deleted, users should be able
// to get rid of it in the configuration
experienceRoleService.unsetRole(role, commandContext.getUserInitiatedContext().getServer(), commandContext.getUserInitiatedContext().getChannel());
@@ -39,7 +38,7 @@ public class UnSetExpRole extends AbstractConditionableCommand {
@Override
public CommandConfiguration getConfiguration() {
List<Parameter> parameters = new ArrayList<>();
parameters.add(Parameter.builder().name("roleId").type(Long.class).build());
parameters.add(Parameter.builder().name("role").type(ARole.class).build());
HelpInfo helpInfo = HelpInfo.builder().templated(true).build();
return CommandConfiguration.builder()
.name("unSetExpRole")