Skip to content

Commit ac300b3

Browse files
committed
Add documentation for the default namespace changes
1 parent 3193ce5 commit ac300b3

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

docs/.vitepress/theme/upgrading/upgrading.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const upgradingInfos: UpgradingInfo[] = [
1818
{from: '9.0.1', to: '9.0.2'},
1919
{from: '9.0.3', to: '9.1.0'},
2020
{from: '9.2.0', to: '9.3.0'},
21+
{from: '9.7.0', to: '10.0.0'},
2122
]
2223

2324
export const keyVersions = Array.from(new Set(upgradingInfos.map(info => [info.from, info.to]).flat()));

docs/en/create-commands/registration.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ new CommandAPICommand("spawnpigs")
181181
void register()
182182
```
183183

184-
Registers the command with the default `minecraft` namespace. If you are [shading](../dev-setup/shading) you can set the default namespace using `CommandAPIConfig#setNamespace(String)` or `CommandAPIBukkitConfig#usePluginNamespace()`.
184+
Registers the command with the default namespace.
185+
186+
If you are not shading, the default namespace is going to be `commandapi`. Hence it is recommended that you use one of the two methods below to register your commands.
187+
188+
If you are [shading](../dev-setup/shading), the default namespace is going to be the name of your plugin. You can also change the default namespace using `CommandAPIConfig#setNamespace(String)`.
189+
Hence you can safely use this method to register your commands without the namespace being `commandapi`, while you're also able to change individual namespaces for commands using the methods below.
185190

186191
```java
187192
void register(String namespace)

docs/en/dev-setup/shading.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public class CommandAPIConfig {
4242
CommandAPIConfig missingExecutorImplementationMessage(String value); // Set message to display when executor implementation is missing
4343
CommandAPIConfig dispatcherFile(File file); // If not null, the CommandAPI will create a JSON file with Brigadier's command tree
4444
CommandAPIConfig setNamespace(String namespace); // The namespace to use when the CommandAPI registers a command
45-
CommandAPIConfig usePluginNamespace(); // Whether the CommandAPI should use the name of the plugin passed into the CommandAPIConfig implementation as the default namespace for commands
4645

4746
<T> CommandAPIConfig initializeNBTAPI(Class<T> nbtContainerClass, Function<Object, T> nbtContainerConstructor); // Initializes hooks with an NBT API. See NBT arguments documentation page for more info
4847
}

docs/en/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Think of it as the "knowledge you should know before using this API".
2626
The CommandAPI does not follow the "standard" method of registering commands. In other words, commands which are registered with the CommandAPI will be registered as pure vanilla Minecraft commands as opposed to Bukkit or Spigot commands. This means that the following implications exist:
2727

2828
- **Commands should not be declared in the `plugin.yml` file.**
29-
- Commands are automatically registered under the `minecraft` namespace. For example, if you register a command `/hello`, you can also run it using `/minecraft:hello`. However, you can change this default `minecraft` namespace. More about this [on the command registration page](./create-commands/registration#registering-the-command).
29+
- Commands are automatically registered under the namespace of the plugin that registered the command. For example, if you register a command `/hello`, you can also run it using `/<pluginname>:hello`. However, you can change the default namespace. More about this [on the command registration page](./create-commands/registration#registering-the-command).
3030
- Commands are not "linked" to a certain plugin. In other words, you can’t look up which commands are registered by which plugin.
3131

3232
## How this documentation works
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### Default namespace changes
2+
3+
The default namespace has been updated from `minecraft` to the plugin's name. If you are not shading, the default namespace is going to be `commandapi`. If you are shading, the default namespace is going to be your plugin's name.
4+
5+
Along with this change, the `CommandAPIBukkitConfig#usePluginNamespace()` has been deprecated since it is now default behaviour.

0 commit comments

Comments
 (0)