tutorial:command_exceptions
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorial:command_exceptions [2023/11/18 11:38] – solidblock | tutorial:command_exceptions [2024/04/15 06:43] (current) – solidblock | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| There are two type of command exceptions: | There are two type of command exceptions: | ||
| * **'' | * **'' | ||
| - | * **''< | + | * **''< |
| The two main types of '' | The two main types of '' | ||
| Line 18: | Line 18: | ||
| if(random.nextBoolean()) { // If heads succeed. | if(random.nextBoolean()) { // If heads succeed. | ||
| - | ctx.getSource().sendFeedback(Text.translatable(" | + | ctx.getSource().sendFeedback(() -> Text.translatable(" |
| return Command.SINGLE_SUCCESS; | return Command.SINGLE_SUCCESS; | ||
| } | } | ||
| Line 25: | Line 25: | ||
| })); | })); | ||
| </ | </ | ||
| + | :!: '' | ||
| ===== Using CommandSyntaxException ===== | ===== Using CommandSyntaxException ===== | ||
| Line 40: | Line 41: | ||
| if (random.nextBoolean()) { // If heads succeed. | if (random.nextBoolean()) { // If heads succeed. | ||
| - | ctx.getSource().sendFeedback(Text.translatable(" | + | ctx.getSource().sendFeedback(() -> Text.translatable(" |
| return Command.SINGLE_SUCCESS; | return Command.SINGLE_SUCCESS; | ||
| } | } | ||
| Line 62: | Line 63: | ||
| if (random.nextBoolean()) { // If heads succeed. | if (random.nextBoolean()) { // If heads succeed. | ||
| - | ctx.getSource().sendFeedback(Text.translatable(" | + | ctx.getSource().sendFeedback(() -> Text.translatable(" |
| return Command.SINGLE_SUCCESS; | return Command.SINGLE_SUCCESS; | ||
| } | } | ||
tutorial/command_exceptions.1700307512.txt.gz · Last modified: 2023/11/18 11:38 by solidblock