forked from DFOnline/CodeClient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandClearQueue.java
More file actions
32 lines (27 loc) · 1.16 KB
/
Copy pathCommandClearQueue.java
File metadata and controls
32 lines (27 loc) · 1.16 KB
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
package dev.dfonline.codeclient.command.impl;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import dev.dfonline.codeclient.ChatType;
import dev.dfonline.codeclient.Utility;
import dev.dfonline.codeclient.command.Command;
import dev.dfonline.codeclient.command.CommandSender;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.text.Text;
public class CommandClearQueue extends Command {
@Override
public String name() {
return "ccclearqueue";
}
@Override
public LiteralArgumentBuilder<FabricClientCommandSource> create(LiteralArgumentBuilder<FabricClientCommandSource> cmd, CommandRegistryAccess registryAccess) {
return cmd.executes(context -> {
if (CommandSender.queueSize() > 0) {
CommandSender.clearQueue();
Utility.sendMessage(Text.translatable("codeclient.action.clearqueue.success"), ChatType.SUCCESS);
} else {
Utility.sendMessage(Text.translatable("codeclient.action.clearqueue.empty"), ChatType.FAIL);
}
return 1;
});
}
}