-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommandUtils.java
54 lines (44 loc) · 2.77 KB
/
CommandUtils.java
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
package org.auioc.mcmod.arnicalib.utils.game;
import java.util.List;
import java.util.function.Predicate;
import org.auioc.mcmod.arnicalib.utils.game.command.CommandExceptions;
import org.auioc.mcmod.arnicalib.utils.game.command.CommandNodeUtils;
import org.auioc.mcmod.arnicalib.utils.game.command.CommandSourceUtils;
import com.mojang.brigadier.context.ParsedCommandNode;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@Deprecated(since = "5.4.4", forRemoval = true)
public interface CommandUtils {
SimpleCommandExceptionType INTERNAL_ERROR = CommandExceptions.INTERNAL_ERROR;
SimpleCommandExceptionType LOGGABLE_INTERNAL_ERROR = CommandExceptions.LOGGABLE_INTERNAL_ERROR;
SimpleCommandExceptionType NOT_SERVER_ERROR = CommandExceptions.NOT_SERVER_ERROR;
SimpleCommandExceptionType NOT_DEDICATED_SERVER_ERROR = CommandExceptions.NOT_DEDICATED_SERVER_ERROR;
SimpleCommandExceptionType GET_REAL_SOURCE_REFLECTION_ERROR = CommandExceptions.GET_REAL_SOURCE_REFLECTION_ERROR;
Predicate<CommandSourceStack> IS_PLAYER = CommandSourceUtils.IS_PLAYER;
Predicate<CommandSourceStack> PERMISSION_LEVEL_0 = CommandSourceUtils.PERMISSION_LEVEL_0;
Predicate<CommandSourceStack> PERMISSION_LEVEL_1 = CommandSourceUtils.PERMISSION_LEVEL_1;
Predicate<CommandSourceStack> PERMISSION_LEVEL_2 = CommandSourceUtils.PERMISSION_LEVEL_2;
Predicate<CommandSourceStack> PERMISSION_LEVEL_3 = CommandSourceUtils.PERMISSION_LEVEL_3;
Predicate<CommandSourceStack> PERMISSION_LEVEL_4 = CommandSourceUtils.PERMISSION_LEVEL_4;
static CommandSource getPrivateSource(CommandSourceStack sourceStack) {
return CommandSourceUtils.getRealSourceReflection(sourceStack);
}
@OnlyIn(Dist.CLIENT)
static LocalPlayer getLocalPlayerOrException(CommandSourceStack sourceStack) throws CommandSyntaxException {
return CommandSourceUtils.getLocalPlayerOrException(sourceStack);
}
static String joinLiteralNodes(List<ParsedCommandNode<CommandSourceStack>> nodeList, int fromIndex, int toIndex, boolean conventToSnakeCase) {
return CommandNodeUtils.joinLiteralNodes(nodeList, fromIndex, toIndex);
}
static String joinLiteralNodes(List<ParsedCommandNode<CommandSourceStack>> nodes, int fromIndex) {
return CommandNodeUtils.joinLiteralNodes(nodes, fromIndex, nodes.size());
}
static String joinLiteralNodes(List<ParsedCommandNode<CommandSourceStack>> nodes) {
return CommandNodeUtils.joinLiteralNodes(nodes, 0, nodes.size());
}
}