User Tools

Site Tools


tutorial:commands

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:commands [2021/03/07 20:27] modmuss50tutorial:commands [2021/06/29 16:23] – [What is a command?] Fix wrong parenthesis placement technici4n
Line 54: Line 54:
 void registerCommand() { void registerCommand() {
     // Ignore this for now, we will explain it next.     // Ignore this for now, we will explain it next.
-    dispatcher.register(CommandManager.literal("foo")+    dispatcher.register(CommandManager.literal("foo"
-        .executes(this::execute); // This refers to the "execute" method below.+        .executes(this::execute)); // This refers to the "execute" method below.
 } }
  
Line 301: Line 301:
   
         if(random.nextBoolean()) { // If heads succeed.         if(random.nextBoolean()) { // If heads succeed.
-            ctx.getSource().sendMessage(new TranslateableText("coin.flip.heads"))+            ctx.getSource().sendMessage(new TranslatableText("coin.flip.heads"))
             return Command.SINGLE_SUCCESS;             return Command.SINGLE_SUCCESS;
         }         }
  
-        throw new SimpleCommandExceptionType(new TranslateableText("coin.flip.tails")).create(); // Oh no tails, you lose.+        throw new SimpleCommandExceptionType(new TranslatableText("coin.flip.tails")).create(); // Oh no tails, you lose.
     }));     }));
 </code> </code>
tutorial/commands.txt · Last modified: 2024/02/23 14:22 by allen1210