zh_cn:tutorial:command_argument_types
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
zh_cn:tutorial:command_argument_types [2023/04/20 11:06] – solidblock | zh_cn:tutorial:command_argument_types [2023/04/20 11:11] – fix type solidblock | ||
---|---|---|---|
Line 42: | Line 42: | ||
<code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
- | 最终,我们检票我们的参数是否正确,并解析我们的参数,如果解析失败则抛出异常。 | + | 最终,我们检查我们的参数是否正确,并解析我们的参数,如果解析失败则抛出异常。 |
<code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
Line 73: | Line 73: | ||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; | import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; | ||
import net.minecraft.text.Text; | import net.minecraft.text.Text; | ||
- | import net.minecraft.util.SystemUtil; | ||
import java.util.ArrayList; | import java.util.ArrayList; | ||
Line 89: | Line 88: | ||
public static <S> UUID getUuid(String name, CommandContext< | public static <S> UUID getUuid(String name, CommandContext< | ||
// 注意你应该假设 CommandContext 中包含的 CommandSource 是一个泛型类型。 | // 注意你应该假设 CommandContext 中包含的 CommandSource 是一个泛型类型。 | ||
- | // 如果你需要访问 ServerCommandSource,确保你在强转之前验证了源。 | + | // 如果你需要访问 ServerCommandSource,确保你在强转之前验证了命令源。 |
return context.getArgument(name, | return context.getArgument(name, | ||
} | } | ||
- | private static final Collection< | + | private static final Collection< |
- | | + | " |
- | | + | " |
- | | + | " |
- | | + | ); |
@Override | @Override |
zh_cn/tutorial/command_argument_types.txt · Last modified: 2024/04/15 07:24 by solidblock