mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-14 22:55:55 +01:00
Prevent stack overflow when finding an EssX cmd as alternative (#4128)
This commit is contained in:
parent
956afc0382
commit
83ca7d2574
@ -82,6 +82,7 @@ import org.bukkit.command.BlockCommandSender;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.command.PluginIdentifiableCommand;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
@ -571,7 +572,10 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
// Check for disabled commands
|
||||
if (getSettings().isCommandDisabled(commandLabel)) {
|
||||
if (getKnownCommandsProvider().getKnownCommands().containsKey(commandLabel)) {
|
||||
return getKnownCommandsProvider().getKnownCommands().get(commandLabel).tabComplete(cSender, commandLabel, args);
|
||||
final Command newCmd = getKnownCommandsProvider().getKnownCommands().get(commandLabel);
|
||||
if (!(newCmd instanceof PluginIdentifiableCommand) || ((PluginIdentifiableCommand) newCmd).getPlugin() != this) {
|
||||
return newCmd.tabComplete(cSender, commandLabel, args);
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@ -676,7 +680,10 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||
// Check for disabled commands
|
||||
if (getSettings().isCommandDisabled(commandLabel)) {
|
||||
if (getKnownCommandsProvider().getKnownCommands().containsKey(commandLabel)) {
|
||||
return getKnownCommandsProvider().getKnownCommands().get(commandLabel).execute(cSender, commandLabel, args);
|
||||
final Command newCmd = getKnownCommandsProvider().getKnownCommands().get(commandLabel);
|
||||
if (!(newCmd instanceof PluginIdentifiableCommand) || ((PluginIdentifiableCommand) newCmd).getPlugin() != this) {
|
||||
return newCmd.execute(cSender, commandLabel, args);
|
||||
}
|
||||
}
|
||||
sender.sendMessage(tl("commandDisabled", commandLabel));
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user