tutorial:commands
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:commands [2020/06/14 04:55] – [Sorry for the mess] i509vcb | tutorial:commands [2020/06/14 05:17] – Move old categories below FAQ to be migrated i509vcb | ||
---|---|---|---|
Line 186: | Line 186: | ||
Arguments in Brigadier both parse and error check any inputted arguments. | Arguments in Brigadier both parse and error check any inputted arguments. | ||
Minecraft creates some special argument types for it's own use such as the '' | Minecraft creates some special argument types for it's own use such as the '' | ||
+ | |||
+ | **TODO:** Go into more detail on how to use arguments | ||
===== Static Imports ===== | ===== Static Imports ===== | ||
Line 212: | Line 214: | ||
CommandManager is in '' | CommandManager is in '' | ||
- | ===== Advanced concepts ===== | + | ====== Advanced concepts |
Below are links to the articles about more complex concepts used in brigadier. | Below are links to the articles about more complex concepts used in brigadier. | ||
Line 225: | Line 227: | ||
**TODO:** Sections are being moved to sub categories and will be added to their respective articles as they are migrated. | **TODO:** Sections are being moved to sub categories and will be added to their respective articles as they are migrated. | ||
+ | |||
+ | ====== FAQ ====== | ||
+ | |||
+ | ===== Why does my command not compile ===== | ||
+ | |||
+ | There are two immediate possibilities for why this could occur. | ||
+ | |||
+ | ==== Catch or throw a CommandSyntaxException ==== | ||
+ | |||
+ | The solution to this issue is to make the run or suggest methods throw a CommandSyntaxException. Don't worry, brigadier will handle the exceptions and output the proper error message. | ||
+ | |||
+ | ==== Issues with generics ==== | ||
+ | |||
+ | You may have an issue with generic types once in a while. Verify you are using '' | ||
+ | |||
+ | ===== Can I register client side commands? ===== | ||
+ | |||
+ | Fabric doesn' | ||
+ | |||
+ | ===== Dark Arts ===== | ||
+ | |||
+ | A few things we don't recommend, but are possible. | ||
+ | |||
+ | ==== Can I register commands in runtime? ==== | ||
+ | |||
+ | You can do this but it is not recommended. You would get the '' | ||
+ | |||
+ | After that you need to send the command tree to every player again using '' | ||
+ | |||
+ | ==== Can I unregister commands in runtime? ==== | ||
+ | |||
+ | You can also do this, however it is much less stable than registering commands and could cause unwanted side effects. To keep things simple, you need to use reflection on brigadier and remove the nodes. After this, you need to send the command tree to every player again using '' | ||
+ | |||
+ | ---- | ||
====== Sorry for the mess ====== | ====== Sorry for the mess ====== | ||
- | __Currently this article is being migrated, so things may be a mess. Below is are the parts of the article that are yet to be migrated to the new format.__ | + | **__Currently this article is being migrated, so things may be a mess. Below is are the parts of the article that are yet to be migrated to the new format.__** |
===== Requirements ===== | ===== Requirements ===== | ||
Line 595: | Line 631: | ||
} | } | ||
</ | </ | ||
- | ===== FAQ ===== | ||
- | |||
- | === What else can I send feedback to the CommandSource? | ||
- | |||
- | You use the Text classes (LiteralText, | ||
- | |||
- | === Why does my IDE complain saying that a method executed by my command needs to catch or throw a CommandSyntaxException === | ||
- | |||
- | The solution to this is just to make the methods throw a CommandSyntaxException. This is because brigadier handles the exceptions. | ||
- | |||
- | === Can I register commands in runtime? === | ||
- | |||
- | You can do this but it is not reccomended. You would get the instance of the CommandManager and add anything you wish to the CommandDispatcher within it. | ||
- | |||
- | After that you will need to send the command tree to every player again using '' | ||
- | |||
- | === Can I unregister commands in runtime? === | ||
- | |||
- | You can also do this but it is very unstable and could cause unwanted side effects. Lets just say it involves a bunch of Reflection. | ||
- | |||
- | Once again you will need to send the command tree to every player again using '' | ||
- | |||
- | === Can I register client side commands? === | ||
- | |||
- | Well Fabric currently doesn' | ||
- | https:// |
tutorial/commands.txt · Last modified: 2024/02/23 14:22 by allen1210