blob: 575fc3f47beca47e52d3a5347b26f8d119506b47 (
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
|
package io.polyfrost.oneconfig.command;
import io.polyfrost.oneconfig.gui.Window;
import io.polyfrost.oneconfig.hud.gui.HudGui;
import io.polyfrost.oneconfig.themes.Themes;
import io.polyfrost.oneconfig.utils.TickDelay;
import net.minecraft.client.Minecraft;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class OneConfigCommand implements ICommand {
private static final Minecraft mc = Minecraft.getMinecraft();
@Override
public String getCommandName() {
return "oneconfig";
}
@Override
public String getCommandUsage(ICommandSender sender) {
return "oneconfig <>";
}
@Override
public List<String> getCommandAliases() {
return new ArrayList<String>() {{
add("oneconfig");
add("ocfg");
}};
}
@Override
public void processCommand(ICommandSender sender, String[] args) {
if (args.length == 0)
new TickDelay(() -> mc.displayGuiScreen(new Window()), 1);
else {
switch (args[0]) {
case "hud":
new TickDelay(() -> mc.displayGuiScreen(new HudGui()), 1);
break;
case "theme":
mc.thePlayer.addChatMessage(new ChatComponentText("reloading theme!"));
Themes.openTheme(new File("OneConfig/themes/one.zip").getAbsoluteFile());
break;
}
}
}
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender) {
return true;
}
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
return null;
}
@Override
public boolean isUsernameIndex(String[] args, int index) {
return false;
}
@Override
public int compareTo(@NotNull ICommand o) {
return 0;
}
}
|