mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
@@ -53,11 +53,13 @@ public final class SimpleCommandMap implements CommandMap {
|
|||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public boolean register(String name, String fallbackPrefix, Command command) {
|
public boolean register(String name, String fallbackPrefix, Command command) {
|
||||||
boolean nameInUse = (knownCommands.get(name) != null);
|
boolean nameInUse = (getCommand(name) != null);
|
||||||
if (nameInUse)
|
|
||||||
name = fallbackPrefix + ":" + name;
|
|
||||||
|
|
||||||
knownCommands.put(name, command);
|
if (nameInUse) {
|
||||||
|
name = fallbackPrefix + ":" + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
knownCommands.put(name.toLowerCase(), command);
|
||||||
return !nameInUse;
|
return !nameInUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +72,7 @@ public final class SimpleCommandMap implements CommandMap {
|
|||||||
|
|
||||||
args = Arrays.copyOfRange(args, 1, args.length);
|
args = Arrays.copyOfRange(args, 1, args.length);
|
||||||
|
|
||||||
Command target = knownCommands.get(sentCommandLabel);
|
Command target = getCommand(sentCommandLabel);
|
||||||
boolean isRegisteredCommand = (target != null);
|
boolean isRegisteredCommand = (target != null);
|
||||||
if (isRegisteredCommand) {
|
if (isRegisteredCommand) {
|
||||||
try {
|
try {
|
||||||
@@ -92,7 +94,7 @@ public final class SimpleCommandMap implements CommandMap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Command getCommand(String name) {
|
public Command getCommand(String name) {
|
||||||
return knownCommands.get(name);
|
return knownCommands.get(name.toLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class VersionCommand extends Command {
|
private static class VersionCommand extends Command {
|
||||||
|
Reference in New Issue
Block a user