mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-09-28 21:03:05 +00:00
Fix stack overflow when disabling commands from other addons (#4680)
This commit is contained in:
parent
dc27af78bf
commit
dae519494e
|
@ -749,7 +749,7 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||||
if (getSettings().isCommandDisabled(commandLabel)) {
|
if (getSettings().isCommandDisabled(commandLabel)) {
|
||||||
if (getKnownCommandsProvider().getKnownCommands().containsKey(commandLabel)) {
|
if (getKnownCommandsProvider().getKnownCommands().containsKey(commandLabel)) {
|
||||||
final Command newCmd = getKnownCommandsProvider().getKnownCommands().get(commandLabel);
|
final Command newCmd = getKnownCommandsProvider().getKnownCommands().get(commandLabel);
|
||||||
if (!(newCmd instanceof PluginIdentifiableCommand) || ((PluginIdentifiableCommand) newCmd).getPlugin() != this) {
|
if (!(newCmd instanceof PluginIdentifiableCommand) || !isEssentialsPlugin(((PluginIdentifiableCommand) newCmd).getPlugin())) {
|
||||||
return newCmd.execute(cSender, commandLabel, args);
|
return newCmd.execute(cSender, commandLabel, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -824,6 +824,10 @@ public class Essentials extends JavaPlugin implements net.ess3.api.IEssentials {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isEssentialsPlugin(Plugin plugin) {
|
||||||
|
return plugin.getDescription().getMain().contains("com.earth2me.essentials") || plugin.getDescription().getMain().contains("net.essentialsx");
|
||||||
|
}
|
||||||
|
|
||||||
public void cleanupOpenInventories() {
|
public void cleanupOpenInventories() {
|
||||||
for (final User user : getOnlineUsers()) {
|
for (final User user : getOnlineUsers()) {
|
||||||
if (user.isRecipeSee()) {
|
if (user.isRecipeSee()) {
|
||||||
|
|
Loading…
Reference in a new issue