/*
 * This file is part of EssentialCmds, licensed under the MIT License (MIT).
 *
 * Copyright (c) 2015 - 2015 HassanS6000
 * 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 io.github.hsyyid.essentialcmds.cmdexecutors;

import io.github.hsyyid.essentialcmds.internal.AsyncCommandExecutorBase;
import io.github.hsyyid.essentialcmds.utils.Utils;
import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.command.args.CommandContext;
import org.spongepowered.api.command.spec.CommandSpec;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.format.TextColors;

import javax.annotation.Nonnull;
import java.util.ArrayList;

public class RuleExecutor extends AsyncCommandExecutorBase
{
	@Override
	public void executeAsync(CommandSource src, CommandContext ctx) {
		ArrayList<String> rules = Utils.getRules();
		for (String rule : rules)
		{
			src.sendMessage(Text.of(TextColors.GRAY, (rules.indexOf(rule) + 1) + ". ", TextColors.GOLD, rule));
		}
	}

	@Nonnull
	@Override
	public String[] getAliases() {
		return new String[] { "rules" };
	}

	@Nonnull
	@Override
	public CommandSpec getSpec() {
		return CommandSpec.builder().description(Text.of("Rules Command")).permission("essentialcmds.rules.use")
				.executor(this).build();
	}
}

@@ -1276,24 +1276,64 @@
 executors;%0A%0A
+import com.google.common.collect.Lists;%0A
 import io.gi
@@ -1444,16 +1444,53 @@
 .Utils;%0A
+import org.spongepowered.api.Sponge;%0A
 import o
@@ -1646,16 +1646,150 @@
 ndSpec;%0A
+import org.spongepowered.api.service.pagination.PaginationBuilder;%0Aimport org.spongepowered.api.service.pagination.PaginationService;%0A
 import o
@@ -1870,24 +1870,76 @@
 extColors;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 import javax
@@ -1962,36 +1962,8 @@
 ull;
-%0Aimport java.util.ArrayList;
 %0A%0Apu
@@ -2096,17 +2096,18 @@
 ext ctx)
- 
+%0A%09
 %7B%0A%09%09Arra
@@ -2146,16 +2146,63 @@
 ules();%0A
+%09%09List%3CText%3E ruleText = Lists.newArrayList();%0A%0A
 %09%09for (S
@@ -2232,23 +2232,20 @@
 %0A%09%09%09
-src.sendMessage
+ruleText.add
 (Tex
@@ -2328,16 +2328,305 @@
 e));%0A%09%09%7D
+%0A%0A%09%09PaginationService paginationService = Sponge.getServiceManager().provide(PaginationService.class).get();%0A%09%09PaginationBuilder paginationBuilder = paginationService.builder().contents(ruleText).title(Text.of(TextColors.GOLD, %22Rules%22)).paddingString(%22-%22);%0A%09%09paginationBuilder.sendTo(src);
 %0A%09%7D%0A%0A%09@N
@@ -2672,17 +2672,18 @@
 liases()
- 
+%0A%09
 %7B%0A%09%09retu
@@ -2765,17 +2765,18 @@
 etSpec()
- 
+%0A%09
 %7B%0A%09%09retu
@@ -2799,16 +2799,20 @@
 uilder()
+%0A%09%09%09
 .descrip
@@ -2841,16 +2841,20 @@
 mmand%22))
+%0A%09%09%09
 .permiss
@@ -2887,17 +2887,16 @@
 se%22)%0A%09%09%09
-%09
 .executo
@@ -2902,16 +2902,20 @@
 or(this)
+%0A%09%09%09
 .build()

Fix rules