From 026b33b4275d596b55088b85508baf2726eb8b8c Mon Sep 17 00:00:00 2001 From: Trent Hensler Date: Sun, 18 Mar 2018 14:37:55 -0700 Subject: [PATCH] Don't even load /f fly if its set to false in config. --- src/main/java/com/massivecraft/factions/cmd/CmdFly.java | 6 ------ .../java/com/massivecraft/factions/cmd/FCmdRoot.java | 9 ++++++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFly.java b/src/main/java/com/massivecraft/factions/cmd/CmdFly.java index c849cd95..c9881ca8 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFly.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFly.java @@ -22,12 +22,6 @@ public class CmdFly extends FCommand { @Override public void perform() { - // Disabled by default. - if (!P.p.getConfig().getBoolean("enable-faction-flight", false)) { - fme.msg(TL.COMMAND_FLY_DISABLED); - return; - } - if (args.size() == 0) { if (!fme.canFlyAtLocation() && !fme.isFlying()) { Faction factionAtLocation = Board.getInstance().getFactionAt(fme.getLastStoodAt()); diff --git a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java index 9bc815fb..e4332263 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCmdRoot.java @@ -117,7 +117,6 @@ public class FCmdRoot extends FCommand { this.addSubCommand(this.cmdDeinvite); this.addSubCommand(this.cmdDescription); this.addSubCommand(this.cmdDisband); - this.addSubCommand(this.cmdFly); this.addSubCommand(this.cmdHelp); this.addSubCommand(this.cmdHome); this.addSubCommand(this.cmdInvite); @@ -185,6 +184,14 @@ public class FCmdRoot extends FCommand { this.addSubCommand(new CmdSetMaxVaults()); this.addSubCommand(new CmdVault()); } + + if (P.p.getConfig().getBoolean("enable-faction-flight", false)) { + this.addSubCommand(this.cmdFly); + P.p.log(Level.INFO, "Enabling /f fly command"); + } else { + P.p.log(Level.WARNING, "Faction flight set to false in config.yml. Not enabling /f fly command."); + } + } @Override