aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/test/TestCommand_Test.java
blob: 33ed5b7a53b608d17c60b859656256275eb52fe4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package cc.polyfrost.oneconfig.test;

import cc.polyfrost.oneconfig.utils.commands.annotations.Command;
import cc.polyfrost.oneconfig.utils.commands.annotations.Main;
import cc.polyfrost.oneconfig.utils.commands.annotations.Name;
import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand;
import cc.polyfrost.oneconfig.libs.universal.UChat;

@Command(value = "test", aliases = {"t"}, description = "Description of the test command")
public class TestCommand_Test {

    @Main(description = "The main command.")
    private static void main() {  // /test
        UChat.chat("Main command");
    }

    @SubCommand(value = "subcommand", aliases = {"s"}, description = "Subcommand 1.")
    private static class TestSubCommand {

        @Main(priority = 999, description = "Description of method")
        private static void main(int a, float b, @Name("named c") String c) { // /test subcommand <a> <b> <c>
            UChat.chat("Integer main: " + a + " " + b + " " + c);
        }

        @Main(priority = 10001)
        private static void main(double a, double b, @Name("named c") String c) { // /test subcommand <a> <b> <c>
            UChat.chat("Double main: " + a + " " + b + " " + c);
        }

        @SubCommand(value = "subsubcommand", aliases = {"ss"})
        private static class TestSubSubCommand {

            @Main
            private static void main(String a, String b, @Name("named c") String c) { // /test subcommand subsubcommand <a> <b> <c>
                joinAndChat(a, b, c);
            }
        }
    }

    @SubCommand(value = "subcommand2", aliases = {"s2"})
    private static class TestSubCommand2 {
        @Main
        private static void main(boolean a, boolean b, boolean c, boolean d, boolean e, boolean f, int hgshrs, boolean jrwjhrw) {
            joinAndChat(a, b, c, d, e, f, hgshrs, jrwjhrw);
        }
    }

    @SubCommand(value = "subcommand3", aliases = {"s3"})
    private static class TestSubCommand3 {
        @Main
        private static void main() {
            UChat.chat("subcommand 3");
        }
    }

    private static void joinAndChat(Object... stuff) {
        StringBuilder builder = new StringBuilder();
        for (Object thing : stuff) {
            builder.append(thing).append(" ");
        }
        UChat.chat(builder.toString().trim());
    }
}