Hide EssX commands from non-core modules in autocomplete (#3473)

quick little thing so people stop complaining
This commit is contained in:
zml 2020-07-09 00:37:41 -07:00 committed by GitHub
parent e35fb82bc2
commit 08e553bd1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -910,14 +910,14 @@ public class EssentialsPlayerListener implements Listener {
/** /**
* Returns true if all of the following are true: * Returns true if all of the following are true:
* - The command is a plugin command * - The command is a plugin command
* - The plugin command is from Essentials * - The plugin command is from a plugin in an essentials-controlled package
* - There is no known alternative OR the alternative is overridden by Essentials * - There is no known alternative OR the alternative is overridden by Essentials
*/ */
private boolean isEssentialsCommand(String label) { private boolean isEssentialsCommand(String label) {
PluginCommand command = ess.getServer().getPluginCommand(label); PluginCommand command = ess.getServer().getPluginCommand(label);
return command != null return command != null
&& command.getPlugin() == ess && (command.getPlugin() == ess || command.getPlugin().getClass().getName().startsWith("com.earth2me.essentials"))
&& (ess.getSettings().isCommandOverridden(label) || (ess.getAlternativeCommandsHandler().getAlternative(label) == null)); && (ess.getSettings().isCommandOverridden(label) || (ess.getAlternativeCommandsHandler().getAlternative(label) == null));
} }
} }