Skip to content

Commit d390e66

Browse files
authored
Merge pull request FixedDev#29 from 4drian3d/fix/velocity-command-fixes
Fixed unregistering commands only applying to main command alias
2 parents 87d43ae + 91db488 commit d390e66

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Velocity/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
<repositories>
1616
<repository>
17-
<id>velocity</id>
18-
<url>https://nexus.velocitypowered.com/repository/maven-public/</url>
17+
<id>papermc</id>
18+
<url>https://repo.papermc.io/repository/maven-public/</url>
1919
</repository>
2020
</repositories>
2121

@@ -29,7 +29,7 @@
2929
<dependency>
3030
<groupId>com.velocitypowered</groupId>
3131
<artifactId>velocity-api</artifactId>
32-
<version>3.0.0</version>
32+
<version>3.1.2-SNAPSHOT</version>
3333
<scope>provided</scope>
3434
</dependency>
3535
</dependencies>

Velocity/src/main/java/me/fixeddev/commandflow/velocity/VelocityCommandManager.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package me.fixeddev.commandflow.velocity;
22

3+
import com.velocitypowered.api.command.CommandMeta;
34
import com.velocitypowered.api.proxy.ProxyServer;
45
import me.fixeddev.commandflow.CommandContext;
56
import me.fixeddev.commandflow.CommandManager;
@@ -98,7 +99,12 @@ public void registerCommand(Command command) {
9899
VelocityCommandWrapper velocityCommandWrapper = new VelocityCommandWrapper(command, commandManager, getTranslator());
99100
wrapperMap.put(command.getName(), velocityCommandWrapper);
100101

101-
proxyServer.getCommandManager().register(command.getName(), velocityCommandWrapper, command.getAliases().toArray(new String[0]));
102+
final CommandMeta commandMeta = proxyServer.getCommandManager().metaBuilder(command.getName())
103+
.aliases(command.getAliases().toArray(new String[0]))
104+
.plugin(plugin)
105+
.build();
106+
107+
proxyServer.getCommandManager().register(commandMeta, velocityCommandWrapper);
102108
}
103109

104110
@Override
@@ -119,7 +125,8 @@ public void unregisterCommand(Command command) {
119125

120126
VelocityCommandWrapper velocityCommandWrapper = wrapperMap.get(command.getName());
121127
if (velocityCommandWrapper != null) {
122-
proxyServer.getCommandManager().unregister(command.getName());
128+
final CommandMeta commandMeta = proxyServer.getCommandManager().getCommandMeta(command.getName());
129+
proxyServer.getCommandManager().unregister(commandMeta);
123130
}
124131
}
125132

0 commit comments

Comments
 (0)