aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/torui/coflsky/FlipperChatCommand.java
blob: 9fe597f3a4196e317b8292735f783237dddbad88 (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
package de.torui.coflsky;

import java.util.List;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;

import java.util.ArrayList;

public class FlipperChatCommand extends CoflSkyCommand {

    public static boolean useChatOnlyMode = false;


    @Override
    public String getCommandName() {
        return "fc";
    }

    @Override
    public List getCommandAliases() {
        ArrayList<String> al = new ArrayList<String>();
        al.add("coflchat");
        return al;
    }

    @Override
    public String getCommandUsage(ICommandSender sender) {
        return "Shorthand for /cofl chat";
    }

    @Override
    public void processCommand(ICommandSender sender, String[] args) throws CommandException {
        new Thread(() -> {

            if (args.length == 1 && args[0].equals("toggle")) {
                FlipperChatCommand.useChatOnlyMode = !FlipperChatCommand.useChatOnlyMode;
                sender.addChatMessage(new ChatComponentText("[§1C§6oflnet§f]§7: §7Set §bChat only mode §7to: §f" + (FlipperChatCommand.useChatOnlyMode ? "true" : "false")));
            } else {
                String[] newArgs = new String[args.length + 1];
                System.arraycopy(args, 0, newArgs, 1, args.length);
                newArgs[0] = "chat";
                SendCommandToServer(newArgs, sender);
            }
        }).start();
    }
}