/**
 * This file is part of XtraPunish, licensed under the MIT License (MIT).
 *
 * Copyright (c) 2016 - 2016 XtraStudio <https://github.com/XtraStudio>
 * Copyright (c) Contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

package com.awesomeman.xtrapunish.punish;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandResult;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.command.spec.CommandSpec;
import org.spongepowered.api.service.pagination.PaginationService;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColors;

import com.awesomeman.xtrapunish.XtraPunish;
import com.awesomeman.xtrapunish.util.CmdUtil;
import com.awesomeman.xtrapunish.util.CommandBase;

public class HelpCommand implements CommandBase {

    public CommandResult execute(CommandSource src, CommandContext args) throws CommandException {
        PaginationService service = Sponge.getServiceManager().provide(PaginationService.class).get();

        List<Text> descriptions = new ArrayList<>();
        for (CommandBase command : XtraPunish.instance.commandBases) {
            descriptions.add(Text.of(TextColors.GREEN, "/punish ",
                    command.command()[0], " - ", TextColors.GOLD,
                    command.description()));
        }

        service.builder()
                .title(Text.of(TextColors.GOLD, "XtraPunish"))
                .contents(descriptions)
                .padding(Text.of("-="))
                .sendTo(src);

        return CommandResult.success();
    }

    @Override
    public String description() {
        return "Display's this help list!";
    }

    @Override
    public String[] command() {
        return new String[] {"help"};
    }

    @Override
    public CommandSpec commandSpec() {
        return CommandSpec.builder()
                .permission(permission())
                .description(Text.of(description()))
                .executor(this)
                .build();
    }

    @Override
    public CmdUtil.UndoSuccess undoRecent() {
        return CmdUtil.UndoSuccess.FAILUE_NOT_SUPPORTED;
    }

    @Override
    public boolean supportsUndo() {
        return false;
    }

    @Override
    public String permission() {
        return "xtrapunish.help";
    }

    @Override
    public Optional<String> argText() {
        return Optional.empty();
    }
}

@@ -2366,24 +2366,107 @@
 andBases) %7B%0A
+            String supportsUndo = command.supportsUndo() ? %22 Supports Undo.%22 : %22%22;%0A
             
@@ -2627,16 +2627,50 @@
 iption()
+,%0A                    supportsUndo
 ));%0A    

Add supportsUndo to the help list