blob: 82e8661999d5e368ab8d0188765fe16b4b160975 (
plain) (
blame)
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
|
package ftbsc.bscv.commands;
import com.google.auto.service.AutoService;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import ftbsc.bscv.Boscovicino;
import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.api.IModule;
import net.minecraft.command.CommandSource;
import net.minecraft.command.Commands;
import static ftbsc.bscv.Boscovicino.log;
@AutoService(ILoadable.class)
public class ModCommands extends AbstractCommand {
@Override
public String getName() { return "mods"; }
public LiteralArgumentBuilder<CommandSource> register(LiteralArgumentBuilder<CommandSource> builder) {
return builder
.then(
Commands.literal("off")
.executes(ctx -> {
for (IModule mod : Boscovicino.modManager.mods) {
if (mod.isEnabled()) {
mod.disable();
}
}
return 1;
})
)
.then(
Commands.literal("re-enable") // this is to fix some jankyness in event subscriptions
.executes(ctx -> {
for (IModule mod : Boscovicino.modManager.mods) {
if (mod.isEnabled()) {
mod.disable();
mod.enable();
}
}
return 1;
})
)
.executes(ctx -> {
log("no args specified");
return 0;
});
}
}
|