User Tools

Site Tools


tutorial:command_examples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
tutorial:command_examples [2023/04/20 11:24] – [/giveMeDiamond] easier to understand solidblocktutorial:command_examples [2023/11/18 13:06] (current) – [/giveMeDiamond] solidblock
Line 62: Line 62:
 <code java [enable_line_numbers="true"]> <code java [enable_line_numbers="true"]>
     if(!player.inventory.insertStack(new ItemStack(Items.DIAMOND))){     if(!player.inventory.insertStack(new ItemStack(Items.DIAMOND))){
-        throw new SimpleCommandExceptionType(Text.translatable("inventory.isfull")).create();+        throw new CommandException(Text.translatable("commands.giveMeDiamond.isfull"));
     }     }
 +    source.sendFeedback(() -> Text.translatable("commands.giveMeDiamond.success", self.getDisplayName()), true);
  
     return 1;     return 1;
tutorial/command_examples.1681989867.txt.gz · Last modified: 2023/04/20 11:24 by solidblock