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 [2020/06/14 05:17] – Move old categories below FAQ to be migrated i509vcbtutorial:commands [2020/11/25 08:01] – Specify the class i509vcb
Line 159: Line 159:
     public void onInitialize() {     public void onInitialize() {
         CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {         CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
-            if (dispatcher) {+            if (dedicated) {
                 TestDedicatedCommand.register(dispatcher);                 TestDedicatedCommand.register(dispatcher);
             }             }
Line 174: Line 174:
     public void onInitialize() {     public void onInitialize() {
         CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {         CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
-            if (!dispatcher) {+            if (!dedicated) {
                 TestIntegratedCommand.register(dispatcher);                 TestIntegratedCommand.register(dispatcher);
             }             }
Line 254: Line 254:
 You can do this but it is not recommended. You would get the ''CommandManager'' from the server and add anything commands you wish to it's ''CommandDispatcher''. You can do this but it is not recommended. You would get the ''CommandManager'' from the server and add anything commands you wish to it's ''CommandDispatcher''.
  
-After that you need to send the command tree to every player again using ''sendCommandTree(ServerPlayerEntity)''. This is required because the client locally caches the command tree it receives during login (or when operator packets are sent) for local completions rich error messages.+After that you need to send the command tree to every player again using ''CommandManager.sendCommandTree(ServerPlayerEntity)''. This is required because the client locally caches the command tree it receives during login (or when operator packets are sent) for local completions rich error messages.
  
 ==== Can I unregister commands in runtime? ==== ==== Can I unregister commands in runtime? ====
tutorial/commands.txt · Last modified: 2024/02/23 14:22 by allen1210