#1035 Forced commands: add more tests, rename account constraints, update commands.yml comments

This commit is contained in:
ljacqu
2018-01-16 20:32:17 +01:00
parent 3c0236e15e
commit f19f8502d8
7 changed files with 118 additions and 26 deletions
@@ -135,10 +135,10 @@ public class CommandManager implements Reloadable {
}
private static boolean shouldCommandBeRun(OnLoginCommand command, int numberOfOtherAccounts) {
return (!command.getNumberOfOtherAccountsAtLeast().isPresent()
|| command.getNumberOfOtherAccountsAtLeast().get() <= numberOfOtherAccounts)
&& (!command.getNumberOfOtherAccountsLessThan().isPresent()
|| command.getNumberOfOtherAccountsLessThan().get() >= numberOfOtherAccounts);
return (!command.getIfNumberOfAccountsAtLeast().isPresent()
|| command.getIfNumberOfAccountsAtLeast().get() <= numberOfOtherAccounts)
&& (!command.getIfNumberOfAccountsLessThan().isPresent()
|| command.getIfNumberOfAccountsLessThan().get() > numberOfOtherAccounts);
}
@Override
@@ -167,8 +167,8 @@ public class CommandManager implements Reloadable {
Map<String, OnLoginCommand> commands) {
return new WrappedTagReplacer<>(availableTags, commands.values(), Command::getCommand,
(cmd, text) -> new OnLoginCommand(text, cmd.getExecutor(), cmd.getNumberOfOtherAccountsAtLeast(),
cmd.getNumberOfOtherAccountsLessThan()));
(cmd, text) -> new OnLoginCommand(text, cmd.getExecutor(), cmd.getIfNumberOfAccountsAtLeast(),
cmd.getIfNumberOfAccountsLessThan()));
}
private List<Tag<Player>> buildAvailableTags() {