aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands/RepartyCommand.java
blob: 1658298791527d4eea7fea4a0b1e0fca56e7e400 (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
package me.Danker.commands;

import me.Danker.DankersSkyblockMod;
import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;

public class RepartyCommand extends CommandBase implements ICommand {
    public static String[] players;

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

    @Override
    public String getCommandUsage(ICommandSender sender) { return "/" + getCommandName(); }

    @Override
    public int getRequiredPermissionLevel() { return 0; }

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

        final EntityPlayer player = (EntityPlayer) sender;

        if(!SetPartyCommand.set){
            player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Party unset! use " + SetPartyCommand.getUsage()));
            return;
        }
        try{
            Minecraft.getMinecraft().thePlayer.sendChatMessage("/p disband");
            Thread.sleep(210);
            Minecraft.getMinecraft().thePlayer.sendChatMessage("/p " + String.join(" ",players));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }

    public static void processCommand() {

        if(!SetPartyCommand.set){
            Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Party unset! use " + SetPartyCommand.getUsage()));
            return;
        }
        try{
            Minecraft.getMinecraft().thePlayer.sendChatMessage("/p disband");
            Thread.sleep(210);
            Minecraft.getMinecraft().thePlayer.sendChatMessage("/p " + String.join(" ",players));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}