File tree Expand file tree Collapse file tree
src/main/java/org/mangorage/mangobotcore Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88import org .mangorage .mangobotcore .api .command .v1 .info .CommandData ;
99import org .mangorage .mangobotcore .api .command .v1 .info .CommandPart ;
1010import org .mangorage .mangobotcore .api .command .v1 .info .ParameterPart ;
11-
1211import java .util .ArrayList ;
1312import java .util .LinkedHashMap ;
1413import java .util .List ;
@@ -40,7 +39,9 @@ public String getDescription() {
4039 public abstract R getFailedResult ();
4140 public abstract R getNoPermission ();
4241
43- public abstract PermissionNode <C > getPermissionNode ();
42+ public PermissionNode <C > getPermissionNode () {
43+ return PermissionNode .empty ();
44+ }
4445
4546 public List <String > aliases () {
4647 return List .of ();
Original file line number Diff line number Diff line change 11package org .mangorage .mangobotcore .api .command .v1 ;
22
3+ import org .mangorage .mangobotcore .internal .permission .EmptyPermissionNode ;
4+
35public interface PermissionNode <C > {
6+ static <C > PermissionNode <C > empty () {
7+ return EmptyPermissionNode .of ();
8+ }
9+
410 String getId ();
511 boolean hasPermission (CommandContext <C > commandContext );
612}
Original file line number Diff line number Diff line change 1+ package org .mangorage .mangobotcore .internal .permission ;
2+
3+ import org .mangorage .mangobotcore .api .command .v1 .CommandContext ;
4+ import org .mangorage .mangobotcore .api .command .v1 .PermissionNode ;
5+
6+ public final class EmptyPermissionNode <C > implements PermissionNode <C > {
7+
8+ private static final EmptyPermissionNode <?> INSTANCE = new EmptyPermissionNode <>();
9+
10+ public static <C > EmptyPermissionNode <C > of () {
11+ return (EmptyPermissionNode <C >) INSTANCE ;
12+ }
13+
14+ EmptyPermissionNode () {}
15+
16+ @ Override
17+ public String getId () {
18+ return "empty" ;
19+ }
20+
21+ @ Override
22+ public boolean hasPermission (CommandContext <C > commandContext ) {
23+ return true ;
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments