5
5
import com .massivecraft .factions .struct .Role ;
6
6
import com .massivecraft .factions .util .WarmUpUtil ;
7
7
import com .massivecraft .factions .zcore .MCommand ;
8
+ import com .massivecraft .factions .zcore .fperms .Access ;
9
+ import com .massivecraft .factions .zcore .fperms .PermissableAction ;
8
10
import com .massivecraft .factions .zcore .util .TL ;
9
11
import org .bukkit .command .CommandSender ;
10
12
import org .bukkit .entity .Player ;
@@ -25,6 +27,7 @@ public abstract class FCommand extends MCommand<P> {
25
27
public boolean senderMustBeModerator ;
26
28
public boolean senderMustBeAdmin ;
27
29
public boolean senderMustBeColeader ;
30
+ protected PermissableAction actionPermission ;
28
31
29
32
public boolean isMoneyCommand ;
30
33
@@ -43,6 +46,47 @@ public FCommand() {
43
46
senderMustBeAdmin = false ;
44
47
}
45
48
49
+ public boolean hasAccess () {
50
+ if (this .permission == null || this .fme == null ) return false ;
51
+ if (!this .fme .isAdminBypassing ()) {
52
+ Access access = myFaction .getAccess (this .fme , permission );
53
+ if (access != Access .ALLOW && this .fme .getRole () != Role .ADMIN ) {
54
+ return false ;
55
+ }
56
+ }
57
+ return true ;
58
+ }
59
+ public boolean hasAccess (boolean checkifAdmin ) {
60
+ if (this .permission == null || this .fme == null ) return false ;
61
+ if (!this .fme .isAdminBypassing () && checkifAdmin ) {
62
+ Access access = myFaction .getAccess (this .fme , permission );
63
+ if (access != Access .ALLOW && this .fme .getRole () != Role .ADMIN ) {
64
+ return false ;
65
+ }
66
+ }
67
+ return true ;
68
+ }
69
+ public boolean hasAccess (PermissableAction perm ) {
70
+ if (this .permission == null || this .fme == null ) return false ;
71
+ if (!this .fme .isAdminBypassing ()) {
72
+ Access access = myFaction .getAccess (this .fme , perm );
73
+ if (access != Access .ALLOW && this .fme .getRole () != Role .ADMIN ) {
74
+ return false ;
75
+ }
76
+ }
77
+ return true ;
78
+ }
79
+ public boolean hasAccess (PermissableAction perm , boolean checkifAdmin ) {
80
+ if (this .permission == null || this .fme == null ) return false ;
81
+ if (!this .fme .isAdminBypassing () && checkifAdmin ) {
82
+ Access access = myFaction .getAccess (this .fme , perm );
83
+ if (access != Access .ALLOW && this .fme .getRole () != Role .ADMIN ) {
84
+ return false ;
85
+ }
86
+ }
87
+ return true ;
88
+ }
89
+
46
90
@ Override
47
91
public void execute (CommandSender sender , List <String > args , List <MCommand <?>> commandChain ) {
48
92
if (sender instanceof Player ) {
0 commit comments