aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/Danker/commands/MoveCommand.java
blob: 33d1f785e72863f09302196275a5e24b3cc1971e (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package me.Danker.commands;

import me.Danker.DankersSkyblockMod;
import me.Danker.handlers.ConfigHandler;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;

import java.util.List;

public class MoveCommand extends CommandBase {

	public static int[] coordsXY = {0, 0};
	public static int[] displayXY = {0, 0};
	public static int[] dungeonTimerXY = {0, 0};
	public static int[] skill50XY = {0, 0};
	public static int[] lividHpXY = {0, 0};
	public static int[] cakeTimerXY = {0, 0};
	public static int[] skillTrackerXY = {0, 0};
	public static int[] waterAnswerXY = {0, 0};
	public static int[] bonzoTimerXY = {0, 0};
	public static int[] golemTimerXY = {0 ,0};
	public static int[] teammatesInRadiusXY = {0, 0};

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

	@Override
	public String getCommandUsage(ICommandSender arg0) {
		return "/" + getCommandName() + " <coords/display/dungeontimer/skill50/lividhp/caketimer/skilltracker/wateranswer/bonzotimer/golemtimer/teammatesinradius> <x> <y>";
	}

	public static String usage(ICommandSender arg0) {
		return new MoveCommand().getCommandUsage(arg0);
	}
	
	@Override
	public int getRequiredPermissionLevel() {
		return 0;
	}
	
	@Override
	public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
		if (args.length == 1) {
			return getListOfStringsMatchingLastWord(args, "coords", "display", "dungeontimer", "skill50", "lividhp", "caketimer",
														  "skilltracker", "wateranswer", "bonzotimer", "golemtimer", "teammatesinradius");
		}
		return null;
	}

	@Override
	public void processCommand(ICommandSender arg0, String[] arg1) throws CommandException {
		final EntityPlayer player = (EntityPlayer)arg0;
		
		if (arg1.length < 2) {
			player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0)));
			return;
		}
		
		switch (arg1[0].toLowerCase()) {
			case "coords":
				coordsXY[0] = Integer.parseInt(arg1[1]);
				coordsXY[1] = Integer.parseInt(arg1[2]);
				ConfigHandler.writeIntConfig("locations", "coordsX", coordsXY[0]);
				ConfigHandler.writeIntConfig("locations", "coordsY", coordsXY[1]);
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Coords have been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2]));
				break;
			case "display":
				displayXY[0] = Integer.parseInt(arg1[1]);
				displayXY[1] = Integer.parseInt(arg1[2]);
				ConfigHandler.writeIntConfig("locations", "displayX", displayXY[0]);
				ConfigHandler.writeIntConfig("locations", "displayY", displayXY[1]);
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Tracker display has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2]));
				break;
			case "dungeontimer":
				dungeonTimerXY[0] = Integer.parseInt(arg1[1]);
				dungeonTimerXY[1] = Integer.parseInt(arg1[2]);
				ConfigHandler.writeIntConfig("locations", "dungeonTimerX", dungeonTimerXY[0]);
				ConfigHandler.writeIntConfig("locations", "dungeonTimerY", dungeonTimerXY[1]);
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Dungeon timer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2]));
				break;
			case "skill50":
				skill50XY[0] = Integer.parseInt(arg1[1]);
				skill50XY[1] = Integer.parseInt(arg1[2]);
				ConfigHandler.writeIntConfig("locations", "skill50X", skill50XY[0]);
				ConfigHandler.writeIntConfig("locations", "skill50Y", skill50XY[1]);
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill 50 display has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2]));
				break;
			case "lividhp":
				lividHpXY[0] = Integer.parseInt(arg1[1]);
				lividHpXY[1] = Integer.parseInt(arg1[2]);
				ConfigHandler.writeIntConfig("locations", "lividHpX", lividHpXY[0]);
				ConfigHandler.writeIntConfig("locations", "lividHpY", lividHpXY[1]);
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Livid HP has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2]));
				break;
			case "caketimer":
				cakeTimerXY[0] = Integer.parseInt(arg1[1]);
				cakeTimerXY[1] = Integer.parseInt(arg1[2]);
				ConfigHandler.writeIntConfig("locations", "cakeTimerX", cakeTimerXY[0]);
				ConfigHandler.writeIntConfig("locations", "cakeTimerY", cakeTimerXY[1]);
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Cake timer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2]));
				break;
			case "skilltracker":
				skillTrackerXY[0] = Integer.parseInt(arg1[1]);
				skillTrackerXY[1] = Integer.parseInt(arg1[2]);
				ConfigHandler.writeIntConfig("locations", "skillTrackerX", skillTrackerXY[0]);
				ConfigHandler.writeIntConfig("locations", "skillTrackerY", skillTrackerXY[1]);
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Skill tracker has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2]));
				break;
			case "wateranswer":
				waterAnswerXY[0] = Integer.parseInt(arg1[1]);
				waterAnswerXY[1] = Integer.parseInt(arg1[2]);
				ConfigHandler.writeIntConfig("locations", "waterAnswerX", waterAnswerXY[0]);
				ConfigHandler.writeIntConfig("locations", "waterAnswerY", waterAnswerXY[1]);
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Water solver answer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2]));
				break;
			case "bonzotimer":
				bonzoTimerXY[0] = Integer.parseInt(arg1[1]);
				bonzoTimerXY[1] = Integer.parseInt(arg1[2]);
				ConfigHandler.writeIntConfig("locations", "bonzoTimerX", bonzoTimerXY[0]);
				ConfigHandler.writeIntConfig("locations", "bonzoTimerX", bonzoTimerXY[1]);
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Bonzo's Mask timer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2]));
				break;
			case "golemtimer":
				golemTimerXY[0] = Integer.parseInt(arg1[1]);
				golemTimerXY[1] = Integer.parseInt(arg1[2]);
				ConfigHandler.writeIntConfig("locations", "golemTimerX", golemTimerXY[0]);
				ConfigHandler.writeIntConfig("locations", "golemTimerY", golemTimerXY[1]);
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Golem timer has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2]));
				break;
			case "teammatesinradius":
				teammatesInRadiusXY[0] = Integer.parseInt(arg1[1]);
				teammatesInRadiusXY[1] = Integer.parseInt(arg1[2]);
				ConfigHandler.writeIntConfig("locations", "teammatesInRadiusX", teammatesInRadiusXY[0]);
				ConfigHandler.writeIntConfig("locations", "teammatesInRadiusY", teammatesInRadiusXY[1]);
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.MAIN_COLOUR + "Teammates in radius has been moved to " + DankersSkyblockMod.SECONDARY_COLOUR + arg1[1] + ", " + arg1[2]));
				break;
			default:
				player.addChatMessage(new ChatComponentText(DankersSkyblockMod.ERROR_COLOUR + "Usage: " + getCommandUsage(arg0)));
		}
	}

}