And I did it again

This commit is contained in:
Svenja Reissaus 2018-08-28 12:06:26 -03:00
parent a6174f026b
commit 9ce8467224
4 changed files with 19 additions and 23 deletions

View File

@ -214,8 +214,6 @@ public class CmdFly extends FCommand {
return; return;
} }
} }
List<Entity> entities = me.getNearbyEntities(16, 256, 16); List<Entity> entities = me.getNearbyEntities(16, 256, 16);
for (int i = 0; i <= entities.size() - 1; i++) { for (int i = 0; i <= entities.size() - 1; i++) {
if (entities.get(i) instanceof Player) { if (entities.get(i) instanceof Player) {

View File

@ -47,9 +47,9 @@ public abstract class FCommand extends MCommand<P> {
} }
public boolean hasAccess() { public boolean hasAccess() {
if (this.permission == null || this.fme == null) return false; if (this.actionPermission == null || this.fme == null) return false;
if (!this.fme.isAdminBypassing()) { if (!this.fme.isAdminBypassing()) {
Access access = myFaction.getAccess(this.fme, permission); Access access = myFaction.getAccess(this.fme, this.actionPermission);
if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) { if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) {
return false; return false;
} }
@ -57,9 +57,9 @@ public abstract class FCommand extends MCommand<P> {
return true; return true;
} }
public boolean hasAccess(boolean checkifAdmin) { public boolean hasAccess(boolean checkifAdmin) {
if (this.permission == null || this.fme == null) return false; if (this.actionPermission == null || this.fme == null) return false;
if (!this.fme.isAdminBypassing() && checkifAdmin) { if (!this.fme.isAdminBypassing() && checkifAdmin) {
Access access = myFaction.getAccess(this.fme, permission); Access access = myFaction.getAccess(this.fme, this.actionPermission);
if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) { if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) {
return false; return false;
} }

View File

@ -99,27 +99,25 @@ public abstract class MCommand<T extends MPlugin> {
} }
this.args = args; this.args = args;
this.commandChain = commandChain; this.commandChain = commandChain;
if (validCall(this.sender, this.args)) {
// Is there a matching sub command? // This is always true but anyway
if (args.size() > 0) { if (!this.isEnabled()) {
for (MCommand<?> subCommand : this.subCommands) { return;
if (subCommand.aliases.contains(args.get(0).toLowerCase())) { }
args.remove(0); // Is there a matching sub command?
commandChain.add(this); if (args.size() > 0) {
subCommand.execute(sender, args, commandChain); for (MCommand<?> subCommand : this.subCommands) {
return; if (subCommand.aliases.contains(args.get(0).toLowerCase())) {
args.remove(0);
commandChain.add(this);
subCommand.execute(sender, args, commandChain);
return;
}
} }
} }
} } else {
if (!validCall(this.sender, this.args)) {
return; return;
} }
if (!this.isEnabled()) {
return;
}
perform(); perform();
} }