Skip to content

Commit 88384f7

Browse files
committed
feat: all things done except upgrade page
1 parent 7c27ee4 commit 88384f7

File tree

7 files changed

+405
-0
lines changed

7 files changed

+405
-0
lines changed

docs/en/afterword.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
order: 17
3+
authors:
4+
- JorelAli
5+
---
6+
7+
# Afterword
8+
9+
<div style="text-align: center;">
10+
11+
## A message from the CommandAPI's author
12+
13+
</div>
14+
15+
Congratulations on making it to the end of the documentation! It's really long, but I did my best to make it the best (Bukkit/Spigot plugin) documentation in existence.
16+
17+
### Intro
18+
19+
My name is Jorel, commonly known by my Minecraft username _Skepter_. I started the CommandAPI in the summer holidays between my first and second year at university. On the 19th August, 2018 I made my first commit to the CommandAPI project - just a month and a day after Minecraft 1.13 was released.
20+
21+
At the time, I just decided to call it "The 1.13 Command API" - it wasn't the catchiest name out there, but it sort of said what I wanted it to - it's a Command API for Minecraft 1.13, which was the update when the big overhaul to the command system was introduced.
22+
23+
It all started as a simple idea that can be summarized in 3 bullet points:
24+
25+
- Create an API to use the new command UI that was introduced in Minecraft 1.13
26+
- Make it so the developers don't have to understand/use Mojang's brigadier
27+
- Make it similar to Bukkit's existing API
28+
29+
### Starting out
30+
31+
After the release of version 1.2, two days after the initial release, I received my first GitHub issue. This was quite a shock to me - version 1.2 only had 11 total downloads so it seemed odd that someone managed to stumble upon it despite the fact that I did nothing to promote the CommandAPI. Little did I know that that one issue was the main motivation to keep this API alive after its initial release.
32+
33+
I would never have possible imagined in my wildest dreams that 2 years later, I would still be in contact with them and know that if I had not chosen to create this API, their server would not have survived beyond Minecraft 1.13, let alone Minecraft 1.15, two major Minecraft versions later.
34+
35+
### Reflection on the project and personal gains
36+
37+
This project has been insane. Absolutely, utterly insane. At over 1000 commits and over 1,000,000 additions (that includes things such as lines of code, lines of generated HTML documentation etc.), I can say without a doubt that this is indeed my biggest project ever.
38+
39+
Not only have I managed to deal with hundreds of GitHub issues, I've also had the opportunity to try all sorts of technologies that I could have only dreamt of using, such as:
40+
41+
- Using GitHub Actions for cloud-based build checking and project status notifications
42+
- Using CodeFactor.io to automatically identify issues with my code
43+
- Publishing the CommandAPI to MavenCentral
44+
- Improving my understanding of Gradle to write Gradle instructions for the documentation
45+
- Learning Kotlin to add Kotlin examples to the CommandAPI's documentation
46+
- Learning TypeScript for an upcoming web-based CommandAPI command visualizer
47+
48+
### Acknowledgements (early development)
49+
50+
Anyway, I digress. I'd like to give credit to all of the people that have opened issues on the CommandAPI GitHub, for without these people, the CommandAPI would have only remained a shadow of what it is now. I'd like to give credit to [the people that have starred](https://github.com/CommandAPI/CommandAPI/stargazers) the CommandAPI on its GitHub page, and all of the members of the [CommandAPI Discord server](https://discord.com/invite/G4SzSxZ).
51+
52+
I would like to personally give thanks to the following people - these are people that have made a significant contribution to the project in terms of ideas or support early in the CommandAPI's development:
53+
54+
- **[Combustible](https://github.com/Combustible)**, who kickstarted the project by creating the CommandAPI's first issue. From this issue, this allowed the CommandAPI to have interoperability with Minecraft commands and functions which is by far the CommandAPI's most admirable feature. Additionally, Combustible helped raise awareness of the CommandAPI via the Spigot forums and Spigot issue tracker.
55+
- **[Draycia](https://github.com/Draycia)**, who suggested implementing lazy evaluation for argument suggestions. This has been extended to provide the CommandAPI's context-aware system for argument suggestions based on previously filled arguments.
56+
- **[HielkeMinecraft](https://github.com/HielkeMinecraft)**, who made three outstanding contributions to the CommandAPI. They created the suggestion of setting the result and success values of commands which improves the interoperability between commands registered with the CommandAPI and vanilla Minecraft commands. They also influenced the implementation of the requirements system to have more powerful command constraints and helped start the CommandAPI Discord server.
57+
- **[Minenash](https://github.com/Minenash)**, who was the driving force for the CommandAPI's 3.0 release, which added a plethora of new arguments to the CommandAPI. Minenash's research, code prototypes, documentation examples, bug testing and code review was a tremendous help to make the 3.0 release such a feature-rich version.
58+
- **[Michael-Ziluck](https://github.com/Michael-Ziluck)**, who created an amazing pull request that helped greatly improve the performance of the CommandAPI as well as structure the entire CommandAPI project into a multi-module Maven project which significantly improved the maintainability of the CommandAPI for the future.
59+
- **[portlek](https://github.com/portlek)**, who helped migrate the CommandAPI's repository to [jitpack.io](https://jitpack.io/#dev.jorel/CommandAPI). They helped debug some technical errors with remote building and tested that the repository was working throughout the process.
60+
- **[469512345](https://github.com/469512345)**, who redesigned and implemented the suggestions feature for arguments, bringing powerful asynchronous arguments and highly-extensible suggestions to the CommandAPI. They also implemented the CommandTree feature to bring yet another way for developers to create commands with the CommandAPI.
61+
62+
I'd also like to give a special mention to the following people that have helped find bugs or have supported the project in some way early in the CommandAPI's development: aianlinb, Baka-Mitai, Checkium, Comeza, DerpNerb, DogeBogey, endrdragon, EnragedRabisu, i509VCB, KieranGateley, lifespan, Loapu, Marvmallow, MatrixTunnel, Ricky12Awesome, SHsuperCM, SpaceCheetah, The_Gavster, Tinkot, vladfrangu, zedwick.
63+
64+
### Acknowledgements (CommandAPI Discord server)
65+
66+
I'm well aware there are lots of users that have made significant contributions to the CommandAPI that aren't listed above! Over the past four years, hundreds of users have created GitHub issues, joined the CommandAPI Discord server and submitted pull requests to contribute to the CommandAPI.
67+
68+
I'd like to personally give thanks to my _✨Special Contributors_ in the CommandAPI Discord server - these are users that have made an exceptionally significant contribution to the CommandAPI project in general, from helping new users get started with the CommandAPI, to contributing to the CommandAPI repository directly, to bringing a liveliness to the CommandAPI Discord server as a whole:
69+
70+
- **[willkroboth](https://github.com/willkroboth)**, the first _✨Special Contributor_, recognized for their above-and-beyond contribution to helping new CommandAPI Discord members.
71+
- **[DerEchtePilz](https://github.com/DerEchtePilz)**, recognized for their significant contribution of creating a Kotlin DSL for the CommandAPI (with the help of Sparky from the CommandAPI Discord server).
72+
- **[Hawk](https://github.com/XHawk87)**, recognized for becoming the lead developer of the CommandAPI annotation system.
73+
74+
The CommandAPI would not be where it is currently without the community that has been established over the years in the CommandAPI Discord server. As such, I'd like to give a special thanks to some of the most active CommandAPI Discord server members that make the community feel lively:
75+
76+
- ! AkaGiant !
77+
- Brought To You By
78+
- MineNash
79+
- TheGates
80+
- Strokkur24
81+
82+
### Acknowledgements (Donators)
83+
84+
I didn't really want to add a way for CommandAPI users to be able to contribute financially via donations because the CommandAPI is free for all and the cost of maintaining the CommandAPI is effectively negligible. That said, I'd like to give special thanks to those that have donated to the CommandAPI.
85+
86+
### Final comments
87+
88+
I never really expected more than 5 or so people to use this API, so it was truly a pleasure to see everyone's responses, issues and suggestions that has made the CommandAPI what it is today.
89+
90+
Thank you so much for using the CommandAPI!

docs/en/contribution/intro.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
order: 1
3+
authors:
4+
- JorelAli
5+
---
6+
7+
# Introduction
8+
9+
:::info
10+
11+
Coming soon! In this section, I'll outline how to get started with building and contributing to the CommandAPI.
12+
13+
:::
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
order: 2
3+
authors:
4+
- JorelAli
5+
---
6+
7+
# Project Structure
8+
9+
The CommandAPI is a relatively large project (especially from the standpoint of one guy, because the CommandAPI was written by just one guy in their spare time!) and trying to figure out what everything does is a nightmare without some guidance. I've always felt that other community project structures aren't well documented and contributing to them can be daunting. Here's the CommandAPI's project structure for you!
10+
11+
## CommandAPI submodule folders
12+
13+
This is where all of the code is for the CommandAPI. The CommandAPI is a Maven project with multiple modules which each serve a different purpose:
14+
15+
- `commandapi-preprocessor` - The CommandAPI uses a bit of reflection to perform things which could not normally be done (for example, allowing custom commands in datapacks). Reflection is inherently unsafe and can lead to runtime errors if specific fields or methods are not present. The CommandAPI preprocessor project is a source annotation processor that checks all declared reflection calls and looks up at compile-time whether those calls are possible - if not, it prevents the CommandAPI from building. In short, it's a compile-time reflection checker.
16+
17+
- `commandapi-x.x.x` - The CommandAPI needs to access various NMS methods in order to operate. These are implemented for the specific version given by `x.x.x`. For example, to support Minecraft `1.16.5`, the project is `commandapi-1.16.5`. The `NMS` class implementation is done in these version-specific files.
18+
19+
- `commandapi-core` - The main brains of the CommandAPI. This includes both the code that makes the CommandAPI run, as well as the API which developers can use.
20+
21+
- `commandapi-vh` - The CommandAPI version handler. This is a super tiny project which simply links up all of the NMS version-specific files into the CommandAPI. This is only used for the actual running of the CommandAPI (e.g. the CommandAPI plugin or shading the CommandAPI). This ensures proper compile-time safety of NMS implementations.
22+
23+
- `commandapi-plugin` - It's the CommandAPI plugin! This is the project which is used for releases to both GitHub and Spigot. It's the CommandAPI all in one neat package, with a few extra features such as config-based command conversion for server owners (or other non-developers)
24+
25+
- `commandapi-shade` - It's the CommandAPI, but in shade-able format. It has none of the features of the CommandAPI plugin variant and can be shaded into your own plugins. Effectively, it's `commandapi-core` + `commandapi-vh` with all of the `commandapi-x.x.x` NMS implementations included.
26+
27+
- `commandapi-annotations` - The CommandAPI annotations project is a small compile-time annotation processer that writes CommandAPI code for you. Using a compile-time annotation processor makes the server run so much faster than using a runtime-annotation processor, because annotation processing requires reflection to inspect class metadata.

docs/en/faq.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
order: 14
3+
authors:
4+
- JorelAli
5+
---
6+
7+
# FAQ
8+
9+
Here's a list of questions that have come up time and time again which all have the same answer.
10+
11+
## How do I use (insert feature here) in the CommandAPI?
12+
13+
The CommandAPI's documentation is the place to search for anything! In the top left corner of this documentation, you can find this <i class="fas fa-search"></i> icon. You can pretty much search for anything - it'll find it!
14+
15+
## Does the CommandAPI support reloading via `/reload`?
16+
17+
Formally, no. If you are encountering issues with `/reload`, consider not using `/reload`. More information about reloading can be found in [Plugin reloading](./utils/reload).
18+
19+
## Does the CommandAPI support optional arguments?
20+
21+
As of 9.0.0, yes! Please view information on optional arguments in [Optional arguments](./create-commands/arguments/optional-arguments).
22+
23+
## Does the CommandAPI support suggestions in the annotation system?
24+
25+
Not yet. The CommandAPI's annotation system was actually originally a little test on writing a compile-time annotation system which actually worked out much better than I had intended. I plan to rewrite the CommandAPI's annotation system to make it much more powerful (and support suggestions!). This is stated in the [project roadmap](https://github.com/CommandAPI/CommandAPI#future-project-plans--timeline)
26+
27+
## Can you add tooltips to literal/multiliteral arguments?
28+
29+
No. This is a Brigadier limitation.
30+
31+
:::info Technical reason that this is a limitation of Brigadier
32+
33+
Brigadier's code has two classes for arguments, [`LiteralCommandNode`](https://github.com/Mojang/brigadier/blob/master/src/main/java/com/mojang/brigadier/tree/LiteralCommandNode.java) and [`ArgumentCommandNode`](https://github.com/Mojang/brigadier/blob/master/src/main/java/com/mojang/brigadier/tree/ArgumentCommandNode.java). The `ArgumentCommandNode` class contains a field `customSuggestions` of type `SuggestionProvider<S>` which is used to handle suggestions - this field is not present inside `LiteralCommandNode`, meaning that LiteralArguments cannot provide suggestions to users.
34+
35+
We need suggestions to provide tooltips. This is because [`SuggestionProvider` provides us with an instance of `SuggestionsBuilder`](https://github.com/Mojang/brigadier/blob/master/src/main/java/com/mojang/brigadier/suggestion/SuggestionProvider.java#L13), [`SuggestionsBuilder` contains a `List<Suggestion>`](https://github.com/Mojang/brigadier/blob/cf754c4ef654160dca946889c11941634c5db3d5/src/main/java/com/mojang/brigadier/suggestion/SuggestionsBuilder.java#L20) and the [`Suggestion` class contains `Message`](https://github.com/Mojang/brigadier/blob/cf754c4ef654160dca946889c11941634c5db3d5/src/main/java/com/mojang/brigadier/suggestion/Suggestion.java#L14). This `Message` class is what is needed to display a tooltip to users.
36+
37+
:::
38+
39+
## Can I change the message that is sent to the user when they don't have permission to run a command?
40+
41+
No. That message is handled client-side and isn't controlled by the CommandAPI. An alternative solution is to perform permission checking _inside_ the command and return a custom message if it's not satisfied:
42+
43+
```java
44+
new CommandAPICommand("mycommand")
45+
.withPermission("some.permission")
46+
.executes((sender, args) -> {
47+
sender.sendMessage("Hello!");
48+
})
49+
.register();
50+
```
51+
52+
$$\downarrow$$
53+
54+
```java
55+
new CommandAPICommand("mycommand")
56+
.executes((sender, args) -> {
57+
if(!sender.hasPermission("some.permission")) {
58+
throw CommandAPI.failWithString("You don't have permission to run /mycommand!");
59+
}
60+
sender.sendMessage("Hello!");
61+
})
62+
.register();
63+
```
64+
65+
## Can I change the message that is sent to the user when an argument isn't valid?
66+
67+
No. That message is handled client-side and isn't controlled by the CommandAPI.
68+
69+
## My suggestions on my arguments are empty or don't update. How do I make dynamic suggestions?
70+
71+
Arguments with suggestions provided using `ArgumentSuggestions.strings(String...)` are calculated _when the command is registered_. In order to have argument suggestions calculated _when the command is being typed_, you need to use the lambda-variant of the `ArgumentSuggestions.strings(Function<SuggestionInfo, String[]> suggestions)` method instead. More information about the different methods can be found [here](./create-commands/arguments/suggestions/suggestions#the-argumentsuggestions-interface).
72+
73+
The easiest way to do this is to add `info ->` at the start of your array:
74+
75+
```java
76+
ArgumentSuggestions.strings(SomeClass.someArray);
77+
```
78+
79+
$$\downarrow$$
80+
81+
```java
82+
ArgumentSuggestions.strings(info -> SomeClass.someArray);
83+
```

docs/en/incompatible-versions.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
order: 15
3+
authors:
4+
- JorelAli
5+
- DerEchtePilz
6+
---
7+
8+
# Incompatible version information
9+
10+
There are a few arguments that are incompatible with various versions of Minecraft. This page outlines the full list of incompatibilities that the CommandAPI has with what versions of Minecraft.
11+
12+
## Argument changes with respect to Minecraft version
13+
14+
### ChatArgument's chat preview
15+
16+
Incompatible with Minecraft versions **less than 1.19 and greater than 1.19.2** _(Works on 1.19, 1.19.1 and 1.19.2)_
17+
18+
### FunctionArgument
19+
20+
Running functions generated via the `FunctionArgument` on Minecraft version **1.20.3** and **1.20.4** will always return a value of 1, regardless of whether the command succeeds, fails, or returns a result. (Works normally on 1.20.2 and below). Trying to retrieve the list of commands in a function on Minecraft version **1.20.3** and **1.20.4** will always return an empty array.
21+
22+
## CommandAPI behavior with respect to Minecraft version
23+
24+
### Minecraft version 1.16 and beyond
25+
26+
In Minecraft version **1.16**, the way datapacks were loaded changed in such a way that the CommandAPI had to put in additional countermeasures to provide full support to it. To illustrate this, this was the previous loading sequence for Bukkit servers in Minecraft 1.15:
27+
28+
$\texttt{Server loads}\rightarrow\texttt{Plugins load}\rightarrow\texttt{Datapacks load}\rightarrow\texttt{Server finishes loading}$
29+
30+
Instead however, Minecraft 1.16 changed the loading sequence to the following:
31+
32+
$\texttt{Server loads}\rightarrow\texttt{Datapacks load}\rightarrow\texttt{Plugins load}\rightarrow\texttt{Server finishes loading}$
33+
34+
Because the CommandAPI used to register vanilla Minecraft commands _before_ datapacks (and thus, custom Minecraft functions), it was possible to register custom commands that can be used in functions. With this new loading sequence change in Minecraft 1.16, this meant that datapacks load first before the CommandAPI does, so custom commands are not registered and functions with custom commands would fail to load.
35+
36+
To resolve this, the CommandAPI reloads datapacks _and recipes_ at the end:
37+
38+
$$\begin{align}
39+
&\quad\texttt{Server loads} \\\\
40+
\rightarrow&\quad\texttt{Datapacks load} \\\\
41+
\rightarrow&\quad\texttt{Plugins load} \\\\
42+
\rightarrow&\quad\texttt{Server finishes loading} \\\\
43+
\rightarrow&\quad\texttt{Datapacks are reloaded} && \texttt{(by the CommandAPI)} \\\\
44+
\rightarrow&\quad\texttt{Recipes are reloaded} && \texttt{(by the CommandAPI)}
45+
\end{align}$$
46+
47+
By doing this, this means:
48+
49+
- Custom functions from datapacks are loaded twice
50+
- Recipes are reloaded twice, _including_ recipes defined by other plugins
51+
52+
Although this sounds pretty bad (since reloading these things twice can be time consuming, thus contributing to the server start-up time), it is the only way to make custom functions work in Minecraft 1.16 and beyond.

0 commit comments

Comments
 (0)