Search in sources :

Example 1 with SetupStage

use of com.github.vaerys.handlers.SetupHandler.SetupStage in project DiscordSailv2 by Vaerys-Dawn.

the class SetupRepeat method execute.

@Override
public String execute(String args, CommandObject command) {
    SetupStage stage = command.guild.config.setupStage;
    SetupHandler.setSetupStage(command, stage);
    return null;
}
Also used : SetupStage(com.github.vaerys.handlers.SetupHandler.SetupStage)

Example 2 with SetupStage

use of com.github.vaerys.handlers.SetupHandler.SetupStage in project DiscordSailv2 by Vaerys-Dawn.

the class SetupBack method execute.

@Override
public String execute(String args, CommandObject command) {
    GuildConfig config = command.guild.config;
    if (!SetupHandler.isRunningSetup(command.guild))
        return "> You aren't running setup you nincompoop.";
    // check if out of bounds.
    try {
        SetupStage prevStage = SetupStage.getPrevStage(command.guild.config.setupStage);
        if (prevStage == SetupStage.SETUP_MODULES && command.guild.config.setupStage == SetupStage.SETUP_MODULES) {
            return "> You are already *on* the first step you pillock";
        }
        SetupHandler.setSetupStage(command, prevStage);
        return "> Going back a step.";
    } catch (ArrayIndexOutOfBoundsException e) {
        // stop them from actually breaking shit...
        config.setupStage = SetupStage.SETUP_UNSET;
        return "> `ERROR: ArrayIndexOutOfBoundsException`... *cough*\n" + "You broke it. Now I have to cancel the setup because of you. This shouldn't have even been possible. *angry bot noises*";
    }
}
Also used : SetupStage(com.github.vaerys.handlers.SetupHandler.SetupStage) GuildConfig(com.github.vaerys.pogos.GuildConfig)

Example 3 with SetupStage

use of com.github.vaerys.handlers.SetupHandler.SetupStage in project DiscordSailv2 by Vaerys-Dawn.

the class SetupNext method execute.

@Override
public String execute(String args, CommandObject command) {
    GuildConfig config = command.guild.config;
    if (!SetupHandler.isRunningSetup(command.guild))
        return "> You aren't running setup you nincompoop.";
    // check if out of bounds.
    try {
        // get next ordinal value
        SetupStage next = SetupStage.values()[config.setupStage.ordinal() + 1];
        if (next == SetupStage.SETUP_COMPLETE) {
            config.setupStage = SetupStage.SETUP_COMPLETE;
            return "> Congratulations! You're all done. Everything should be perfectly set up just the way you want it.";
        }
        // move to next stage
        SetupHandler.setSetupStage(command, next);
    } catch (ArrayIndexOutOfBoundsException e) {
        // stop them from actually breaking shit...
        config.setupStage = SetupStage.SETUP_COMPLETE;
        return "> Congratulations! You're all done. Everything should be perfectly set up just the way you want it.";
    }
    // "log" step change.
    SetupHandler.setSetupStage(command, config.setupStage);
    return null;
}
Also used : SetupStage(com.github.vaerys.handlers.SetupHandler.SetupStage) GuildConfig(com.github.vaerys.pogos.GuildConfig)

Aggregations

SetupStage (com.github.vaerys.handlers.SetupHandler.SetupStage)3 GuildConfig (com.github.vaerys.pogos.GuildConfig)2