mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-31 22:22:49 +00:00
[Bleeding] Fix getCommand for conflicting plugin commands.
This commit is contained in:
parent
8fb03c1da7
commit
4c35c61ca9
2 changed files with 4 additions and 4 deletions
|
@ -3,7 +3,6 @@ package org.bukkit.command;
|
||||||
import static org.bukkit.util.Java15Compat.Arrays_copyOfRange;
|
import static org.bukkit.util.Java15Compat.Arrays_copyOfRange;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -101,7 +100,8 @@ public class SimpleCommandMap implements CommandMap {
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
public boolean register(String label, String fallbackPrefix, Command command) {
|
public boolean register(String label, String fallbackPrefix, Command command) {
|
||||||
label = label.toLowerCase();
|
label = label.toLowerCase().trim();
|
||||||
|
fallbackPrefix = fallbackPrefix.toLowerCase().trim();
|
||||||
boolean registered = register(label, command, false);
|
boolean registered = register(label, command, false);
|
||||||
knownCommands.put(fallbackPrefix + ":" + label, command);
|
knownCommands.put(fallbackPrefix + ":" + label, command);
|
||||||
|
|
||||||
|
|
|
@ -351,11 +351,11 @@ public abstract class JavaPlugin extends PluginBase {
|
||||||
String alias = name.toLowerCase();
|
String alias = name.toLowerCase();
|
||||||
PluginCommand command = getServer().getPluginCommand(alias);
|
PluginCommand command = getServer().getPluginCommand(alias);
|
||||||
|
|
||||||
if ((command != null) && (command.getPlugin() != this)) {
|
if (command == null || command.getPlugin() != this) {
|
||||||
command = getServer().getPluginCommand(description.getName().toLowerCase() + ":" + alias);
|
command = getServer().getPluginCommand(description.getName().toLowerCase() + ":" + alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((command != null) && (command.getPlugin() == this)) {
|
if (command != null && command.getPlugin() == this) {
|
||||||
return command;
|
return command;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Add table
Reference in a new issue