Fix unchecked removal of commands by app name

This commit is contained in:
altrisi authored and GitHub committed 2023-01-23 22:19:07 +01:00
1 parent c9c1e5a4dc
commit fb7b1f79a5
2 files changed
+14 -6

No files matched your search

@@ -341,10 +341,11 @@ public class CarpetScriptServer extends ScriptServer
return false;
}
// stop all events associated with name
events.removeAllHostEvents(modules.get(name));
modules.get(name).onClose();
modules.remove(name);
((CommandDispatcherInterface)server.getCommands().getDispatcher()).carpet$unregister(name);
CarpetScriptHost host = modules.remove(name);
events.removeAllHostEvents(host);
host.onClose();
if (host.hasCommand)
((CommandDispatcherInterface)server.getCommands().getDispatcher()).carpet$unregister(name);
if (!isRuleApp) unloadableModules.remove(name);
CommandHelper.notifyPlayersCommandsChanged(server);
if (notifySource) Messenger.m(source, "gi Removed "+name+" app");