Joining HQ when you're already authed on TC?

I'm wondering how this plugin is supposed to handle clans and teams, or more specifically, clans on servers that use the Automatic Authorization plugin. We're running into a problem that happens, as far as I can tell, when a new member is added to a clan and automatically authorized on TC. The member can't authorize again to join the HQ, but can't deauthorize on TC because it belongs to the HQ. Admins can clear the authorization which allows the member to authorize and then properly get added to the HQ, but that's a pain for everyone. Other than that, really liking this vs. other raid protection options!

Any thoughts yet? It's a pain but we are getting by for now with turning off automatic authorizations on TCs so that the Authorize option is available. However, we are also getting an error when trying to use /hq.quit. Not sure if it's everyone or just a few:

Failed to call hook 'cmdChatHeadquarterQuit' on plugin 'Headquarters v1.1.0' (KeyNotFoundException: The given key was not present in the dictionary.)
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <fb001e01371b4adca20013e0ac763896>:0 
  at Oxide.Plugins.Headquarters+<cmdChatHeadquarterQuit>c__AnonStorey3.<>m__0 (System.String memberId) [0x00000] in <4aa3b7551f9948c196017c403e2a2eab>:0 
  at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x00024] in <fb001e01371b4adca20013e0ac763896>:0 
  at Oxide.Plugins.Headquarters.cmdChatHeadquarterQuit (BasePlayer player, System.String command) [0x000d2] in <4aa3b7551f9948c196017c403e2a2eab>:0 
  at Oxide.Plugins.Headquarters.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x01688] in <4aa3b7551f9948c196017c403e2a2eab>:0 
  at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <09575a60985045248bcb43b20faeeb99>:0 
  at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <bae5f1223fce49c493b01571c99dce02>:0 
  at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <bae5f1223fce49c493b01571c99dce02>:0​

Man this is tricky.. I honestly never thought this would be used on a server with Clans/Automatic Authorization.  The reason for that being that if you allow the members of a clan to be authed in many headquarters.. then they can potentially just use all these bases to store stuff without any risk of being raided. Have you encountered any abuse regarding this?

Merged post

I'm thinking maybe if I add a command to join a HQ like /hq.join perhaps that will help with this somewhat.  I just don't know how the rest of the features would interact with these other clan based plugins.  Do you think that would work for you?

Also any idea what caused that error?  I can't think of a way to replicate it.  I would appreciate if you could tell me the steps to make it happen.

digital0iced0

I'm thinking maybe if I add a command to join a HQ like /hq.join perhaps that will help with this somewhat.  I just don't know how the rest of the features would interact with these other clan based plugins.  Do you think that would work for you?

Also any idea what caused that error?  I can't think of a way to replicate it.  I would appreciate if you could tell me the steps to make it happen.

Yeah, maybe not the intended use and we're still trying to find a good balance for clans with the storage limit, but the current setup is still an improvement over the offline raid protection we had before since every base ended up being protected and nobody would log in when larger clans were on for fear of getting raided.

It would probably be my preference to have an option for a clan to be limited to one HQ, if possible. I haven't looked at how you implement it, but if access to fill HQ storage was only for clan members who had joined the HQ, and TC authorization wasn't messed with on join or quit, I think that would take care of any other conflicts we've seen. Yes, the /hq.join command rather than the TC authorize method seems like it would do the trick for joining.

I'm thinking the error may have been caused by someone being TC-authorized and trying to join the HQ and something not getting saved properly originally, but I haven't been able to reproduce it. I believe all the reports of /hq.quit failing were on HQs created before we turned off auto authorization on TCs.

@GeneralChaos can you try this update: https://github.com/digital0iced0/headquarters/blob/clans/Headquarters.cs

This should work with clans now but I only have a local test server so my testing ability is limited.  Basically the idea is when someone from a clan starts a headquarter, that becomes the headquarter for the entire clan.  The members of the headquarter will be automatically updated from the Clans plugin so clans users will not need to authenticate to join or quit a HQ.  It will be managed automatically.  

With that said, you may get weird behavior if you add this version of the plugin and you currently have multiple headquarters for one clan.  The plugin should prevent that from happening from now on.. but if you're using the data from an old version of the plugin it may not work right.

@GeneralChaos can you please let me know if everything is good so I can release this version for everyone?

No issues reported so far. Automatic authorization for TCs has been turned back on with no apparent conflicts. We did manually reduce the existing HQ bases down to one per clan before upgrading, so I can't say how it would have handled upgrading the data for multiple pre-existing per clan, as you mentioned. Seems like it's a good version to release and get more feedback. Thanks for the quick work!