dev.polymodloader.api.command
이 페이지는 소스의 Javadoc에서 ./gradlew apiReference로 만든 것입니다. 설명은 코드에 적힌 영어 그대로입니다. 직접 고치지 말고 소스의 주석을 고친 뒤 다시 만드세요.
| 형식 | 종류 | 설명 |
|---|---|---|
ArgumentCommand | 클래스 | A typed value in a command. |
CommandAction | 함수형 인터페이스 | What a command does. |
CommandArgumentType | 인터페이스 | What a command argument accepts; each maps to one of the game's argument parsers, so clients complete and validate them natively. |
CommandArgumentType.BlockPosType | 레코드 | Block coordinates, absolute or relative (~ ~1 ~); read with CommandContext.getBlockPos(String). |
CommandArgumentType.BooleanType | 레코드 | true or false; read with CommandContext.getBoolean(String). |
CommandArgumentType.DecimalType | 레코드 | Decimal number in [min, max]; read with CommandContext.getDouble(String). |
CommandArgumentType.IntegerType | 레코드 | Whole number in [min, max]; read with CommandContext.getInteger(String). |
CommandArgumentType.PlayerType | 레코드 | One online player by name or selector; read with CommandContext.getPlayer(String). |
CommandArgumentType.TextKind | 열거형 | How much text a TextType consumes. |
CommandArgumentType.TextType | 레코드 | Text: one word, a quotable string, or the rest of the line; read with CommandContext.getString(String). |
CommandContext | 인터페이스 | Parsed arguments and the source of a running command. |
CommandFailure | 클래스 | Thrown by a CommandAction to fail with a message shown to the command source in red. |
CommandNode | 추상 클래스 | One word of a command: a fixed LiteralCommand or a typed ArgumentCommand. |
CommandRegistrar | 인터페이스 | Registers server commands. |
CommandSource | 인터페이스 | Who or what ran a command: a player, the console, a command block, or a function. |
LiteralCommand | 클래스 | A fixed word in a command. |
ArgumentCommand
클래스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public final class ArgumentCommand extends CommandNode<ArgumentCommand>
A typed value in a command. Create with CommandNode.argument(String, CommandArgumentType).
상위 형식: CommandNode
type()
public CommandArgumentType type()
추가된 버전 0.1.0-alpha.4 또는 그 이전
What the argument accepts.
반환 CommandArgumentType
CommandAction
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface CommandAction
What a command does. Runs on the server thread.
run(CommandContext)
int run(CommandContext context) throws CommandFailure
추가된 버전 0.1.0-alpha.4 또는 그 이전
Runs the command.
| 인자 | 타입 | 설명 |
|---|---|---|
context | CommandContext | — |
반환 int — the command's result value (used by /execute store); 1 conventionally means success
예외 CommandFailure — to show an error message to the source and report failure
CommandArgumentType
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public sealed interface CommandArgumentType
What a command argument accepts; each maps to one of the game's argument parsers, so clients complete and validate them natively.
integer()
static CommandArgumentType integer()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Any whole number.
반환 CommandArgumentType
integer(int, int)
static CommandArgumentType integer(int min, int max)
추가된 버전 0.1.0-alpha.4 또는 그 이전
A whole number in [min, max].
| 인자 | 타입 | 설명 |
|---|---|---|
min | int | — |
max | int | — |
반환 CommandArgumentType
decimal()
static CommandArgumentType decimal()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Any decimal number.
반환 CommandArgumentType
bool()
static CommandArgumentType bool()
추가된 버전 0.1.0-alpha.4 또는 그 이전
true or false.
반환 CommandArgumentType
word()
static CommandArgumentType word()
추가된 버전 0.1.0-alpha.4 또는 그 이전
A single word.
반환 CommandArgumentType
string()
static CommandArgumentType string()
추가된 버전 0.1.0-alpha.4 또는 그 이전
A word or quoted text.
반환 CommandArgumentType
greedyString()
static CommandArgumentType greedyString()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The rest of the command line.
반환 CommandArgumentType
blockPos()
static CommandArgumentType blockPos()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Block coordinates.
반환 CommandArgumentType
player()
static CommandArgumentType player()
추가된 버전 0.1.0-alpha.4 또는 그 이전
One online player.
반환 CommandArgumentType
CommandArgumentType.BlockPosType
레코드 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static record BlockPosType() implements CommandArgumentType
Block coordinates, absolute or relative (~ ~1 ~); read with CommandContext.getBlockPos(String).
| 구성 요소 | 타입 | 설명 |
|---|
상위 형식: CommandArgumentType
CommandArgumentType.BooleanType
레코드 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static record BooleanType() implements CommandArgumentType
true or false; read with CommandContext.getBoolean(String).
| 구성 요소 | 타입 | 설명 |
|---|
상위 형식: CommandArgumentType
CommandArgumentType.DecimalType
레코드 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static record DecimalType(double min, double max) implements CommandArgumentType
Decimal number in [min, max]; read with CommandContext.getDouble(String).
| 구성 요소 | 타입 | 설명 |
|---|---|---|
min | double | — |
max | double | — |
상위 형식: CommandArgumentType
CommandArgumentType.IntegerType
레코드 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static record IntegerType(int min, int max) implements CommandArgumentType
Whole number in [min, max]; read with CommandContext.getInteger(String).
| 구성 요소 | 타입 | 설명 |
|---|---|---|
min | int | — |
max | int | — |
상위 형식: CommandArgumentType
CommandArgumentType.PlayerType
레코드 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static record PlayerType() implements CommandArgumentType
One online player by name or selector; read with CommandContext.getPlayer(String).
| 구성 요소 | 타입 | 설명 |
|---|
상위 형식: CommandArgumentType
CommandArgumentType.TextKind
열거형 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static enum TextKind
How much text a TextType consumes.
| 상수 | 설명 |
|---|---|
WORD | Letters, digits, and _ - . +. |
QUOTABLE | A word, or text in double quotes. |
GREEDY | Everything until the end of the command. |
CommandArgumentType.TextType
레코드 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static record TextType(CommandArgumentType.TextKind kind) implements CommandArgumentType
Text: one word, a quotable string, or the rest of the line; read with CommandContext.getString(String).
| 구성 요소 | 타입 | 설명 |
|---|---|---|
kind | CommandArgumentType.TextKind | — |
상위 형식: CommandArgumentType
CommandContext
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface CommandContext
Parsed arguments and the source of a running command. Valid only during the action. Reading an argument that is not on the executed path, or with the wrong type, throws IllegalArgumentException.
source()
CommandSource source()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Who ran the command.
반환 CommandSource
getInteger(String)
int getInteger(String name)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Value of an CommandArgumentType.integer() argument.
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | — |
반환 int
getDouble(String)
double getDouble(String name)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Value of a CommandArgumentType.decimal() argument.
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | — |
반환 double
getBoolean(String)
boolean getBoolean(String name)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Value of a CommandArgumentType.bool() argument.
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | — |
반환 boolean
getString(String)
String getString(String name)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Value of a text argument.
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | — |
반환 String
getBlockPos(String)
BlockPos getBlockPos(String name) throws CommandFailure
추가된 버전 0.1.0-alpha.4 또는 그 이전
Value of a CommandArgumentType.blockPos() argument, resolved against the source.
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | — |
반환 BlockPos
예외 CommandFailure — when the position is not loaded
getPlayer(String)
PlayerView getPlayer(String name) throws CommandFailure
추가된 버전 0.1.0-alpha.4 또는 그 이전
Value of a CommandArgumentType.player() argument.
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | — |
반환 PlayerView
예외 CommandFailure — when no single online player matches
CommandFailure
클래스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public final class CommandFailure extends Exception
Thrown by a CommandAction to fail with a message shown to the command source in red.
CommandFailure(String)
public CommandFailure(String message)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Creates a failure with the message shown to the user.
| 인자 | 타입 | 설명 |
|---|---|---|
message | String | — |
CommandNode
추상 클래스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public abstract sealed class CommandNode<N extends CommandNode<N>>
One word of a command: a fixed LiteralCommand or a typed ArgumentCommand. Nodes form a tree; a node with an action can end the command.
literal(String)
public static LiteralCommand literal(String name)
추가된 버전 0.1.0-alpha.4 또는 그 이전
A fixed word, for example /hello.
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | — |
반환 LiteralCommand
argument(String, CommandArgumentType)
public static ArgumentCommand argument(String name, CommandArgumentType type)
추가된 버전 0.1.0-alpha.4 또는 그 이전
A typed value; read it in actions with context.get*(name).
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | — |
type | CommandArgumentType | — |
반환 ArgumentCommand
then(CommandNode<?>)
public N then(CommandNode<?> child)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Adds a child that may follow this node.
| 인자 | 타입 | 설명 |
|---|---|---|
child | CommandNode<?> | — |
반환 N
executes(CommandAction)
public N executes(CommandAction action)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Lets the command end at this node and run action.
| 인자 | 타입 | 설명 |
|---|---|---|
action | CommandAction | — |
반환 N
requiresPermission(int)
public N requiresPermission(int level)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Only sources with at least this permission level can see and run this node: 0 everyone, 2 game masters (command blocks, operators), 4 server owners.
| 인자 | 타입 | 설명 |
|---|---|---|
level | int | — |
반환 N
requiresPermission(PermissionNode)
public N requiresPermission(PermissionNode node)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Only sources that have node can see and run this node.
| 인자 | 타입 | 설명 |
|---|---|---|
node | PermissionNode | — |
반환 N
permissionNode()
public Optional<PermissionNode> permissionNode()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The required named permission, if any (checked in addition to the level).
반환 Optional<PermissionNode>
name()
public String name()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The word or argument name.
반환 String
children()
public List<CommandNode<?>> children()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Child nodes in registration order.
반환 List<CommandNode<?>>
action()
public Optional<CommandAction> action()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The action run when the command ends here.
반환 Optional<CommandAction>
permissionLevel()
public int permissionLevel()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Required permission level, 0–4.
반환 int
CommandRegistrar
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface CommandRegistrar
Registers server commands. Poly Mod Loader adds them every time the server builds its command tree (server start and /reload), on every server kind, including single player.
When: inside common entrypoints. Registering a name that another mod or the game already uses merges the trees as the game does; Poly Mod Loader logs POLY-COMMAND-001 when two mods register the same top-level name.
register(LiteralCommand)
void register(LiteralCommand command)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Registers a top-level command. Do not change command or its children afterwards.
| 인자 | 타입 | 설명 |
|---|---|---|
command | LiteralCommand | — |
예외 IllegalStateException — after registration closed (POLY-COMMAND-002)
CommandSource
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface CommandSource
Who or what ran a command: a player, the console, a command block, or a function.
name()
String name()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Display name, for example a player name or Server.
반환 String
sendMessage(String)
void sendMessage(String text)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sends feedback text to the source.
| 인자 | 타입 | 설명 |
|---|---|---|
text | String | — |
sendFailure(String)
void sendFailure(String text)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sends an error message (shown in red to players).
| 인자 | 타입 | 설명 |
|---|---|---|
text | String | — |
hasPermission(int)
boolean hasPermission(int level)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the source has at least permission level (0–4).
| 인자 | 타입 | 설명 |
|---|---|---|
level | int | — |
반환 boolean
hasPermission(PermissionNode)
boolean hasPermission(PermissionNode node)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the source has the permission: for players as PlayerView.hasPermission; for the console, command blocks, and functions by the node's default level.
| 인자 | 타입 | 설명 |
|---|---|---|
node | PermissionNode | — |
반환 boolean
player()
Optional<PlayerView> player()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The player who ran the command, if a player did.
반환 Optional<PlayerView>
world()
WorldView world()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The world the command runs in.
반환 WorldView
blockPos()
BlockPos blockPos()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The block position the command runs at.
반환 BlockPos
LiteralCommand
클래스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public final class LiteralCommand extends CommandNode<LiteralCommand>
A fixed word in a command. Create with CommandNode.literal(String).
상위 형식: CommandNode