mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-12 10:45:50 -07:00
[Bleeding] Fix getCommand for conflicting plugin commands.
By: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
@@ -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;
|
||||||
|
Reference in New Issue
Block a user