Add option to disable commands

This commit is contained in:
Jesse Boyd 2019-04-12 10:51:18 +10:00
parent 4632f0d4f3
commit 99c4c2f35d
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 68 additions and 58 deletions

View File

@ -69,6 +69,13 @@ public class Settings extends Config {
public PATHS PATHS;
@Create
public REGION_RESTRICTIONS_OPTIONS REGION_RESTRICTIONS_OPTIONS;
@Create
public ENABLED_COMPONENTS ENABLED_COMPONENTS;
@Comment("Enable or disable core components")
public static final class ENABLED_COMPONENTS {
public boolean COMMANDS = true;
}
@Comment("Paths for various directories")
public static final class PATHS {

View File

@ -25,6 +25,7 @@ import com.boydti.fawe.command.CFICommand;
import com.boydti.fawe.command.MaskBinding;
import com.boydti.fawe.command.PatternBinding;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.FawePlayer;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.task.ThrowableSupplier;
@ -257,6 +258,7 @@ public final class CommandManager {
* Initialize the dispatcher
*/
public synchronized void setupDispatcher() {
if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) {
DispatcherNode graph = new CommandGraph().builder(builder).commands();
for (Map.Entry<Object, String[]> entry : methodMap.entrySet()) {
@ -324,6 +326,7 @@ public final class CommandManager {
platform.registerCommands(dispatcher);
}
}
}
public static CommandManager getInstance() {
return INSTANCE;