Skip to content

Commit 42827d4

Browse files
committed
rename option
1 parent fca5f7e commit 42827d4

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

cloud-core/src/main/java/org/incendo/cloud/CommandTree.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ private Exception noPermissionOrSyntax(
348348
final C sender,
349349
final CommandNode<C> root
350350
) {
351-
final boolean convert = this.commandManager.settings().get(ManagerSetting.CONVERT_NO_PERMISSION_TO_SYNTAX_EXCEPTION);
351+
final boolean convert = this.commandManager.settings().get(ManagerSetting.HIDE_COMMAND_EXISTENCE);
352352
if (!convert) {
353353
return new NoPermissionException(
354354
permissionResult,
@@ -369,8 +369,8 @@ private Exception noPermissionOrSyntax(
369369
return new InvalidSyntaxException(
370370
this.commandManager.commandSyntaxFormatter().apply(
371371
sender,
372-
parentChain.stream().map(CommandNode::component)
373-
.filter(Objects::nonNull).collect(Collectors.toList()),
372+
parentChain.stream().map(CommandNode::component)
373+
.filter(Objects::nonNull).collect(Collectors.toList()),
374374
root
375375
),
376376
sender, this.getComponentChain(root)
@@ -384,7 +384,7 @@ private Exception noPermissionOrSyntax(
384384
);
385385
}
386386

387-
private boolean childPermitted(CommandNode<C> node, C sender) {
387+
private boolean childPermitted(final CommandNode<C> node, final C sender) {
388388
if (this.determinePermissionResult(sender, node).allowed()) {
389389
return true;
390390
}
@@ -396,7 +396,7 @@ private boolean childPermitted(CommandNode<C> node, C sender) {
396396
return false;
397397
}
398398

399-
private @Nullable List<CommandNode<C>> permittedParentChain(CommandNode<C> node, C sender) {
399+
private @Nullable List<CommandNode<C>> permittedParentChain(final CommandNode<C> node, final C sender) {
400400
final @Nullable CommandNode<C> parent = node.parent();
401401
if (parent != null) {
402402
if (this.determinePermissionResult(sender, parent).allowed()) {

cloud-core/src/main/java/org/incendo/cloud/setting/ManagerSetting.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ public enum ManagerSetting implements Setting {
6363
@API(status = API.Status.EXPERIMENTAL)
6464
LIBERAL_FLAG_PARSING,
6565

66+
/**
67+
* When the sender does not have permission for the parsed command, but does have permission for a preceding or following
68+
* node, the command tree will return a {@link org.incendo.cloud.exception.InvalidSyntaxException} instead of a
69+
* {@link org.incendo.cloud.exception.NoPermissionException}.
70+
*/
6671
@API(status = API.Status.EXPERIMENTAL)
67-
CONVERT_NO_PERMISSION_TO_SYNTAX_EXCEPTION
72+
HIDE_COMMAND_EXISTENCE
6873
}

0 commit comments

Comments
 (0)