1- using LabExtended . API . Enums ;
2- using LabExtended . API . Hints ;
1+ using CentralAuth ;
2+ using CommandSystem ;
3+ using Footprinting ;
4+ using Hints ;
5+ using InventorySystem . Disarming ;
6+ using InventorySystem . Items ;
7+ using InventorySystem . Items . Pickups ;
8+ using LabApi . Features . Wrappers ;
39using LabExtended . API . Containers ;
410using LabExtended . API . CustomVoice ;
5- using LabExtended . API . RemoteAdmin ;
11+ using LabExtended . API . Enums ;
612using LabExtended . API . FileStorage ;
7-
8- using LabExtended . API . Settings . Menus ;
9- using LabExtended . API . Settings . Entries ;
10-
13+ using LabExtended . API . Hints ;
1114using LabExtended . API . Hints . Elements . Personal ;
12-
13- using LabExtended . Core . Pooling . Pools ;
14-
15+ using LabExtended . API . RemoteAdmin ;
16+ using LabExtended . API . Settings . Entries ;
17+ using LabExtended . API . Settings . Menus ;
1518using LabExtended . Commands . Attributes ;
1619using LabExtended . Commands . Interfaces ;
17-
20+ using LabExtended . Core ;
21+ using LabExtended . Core . Pooling . Pools ;
1822using LabExtended . Events ;
19- using LabExtended . Utilities ;
2023using LabExtended . Extensions ;
21-
22- using LabApi . Features . Wrappers ;
23-
24+ using LabExtended . Utilities ;
25+ using LiteNetLib ;
2426using Mirror ;
2527using Mirror . LiteNetLib4Mirror ;
26-
28+ using NetworkManagerUtils . Dummies ;
29+ using NorthwoodLib . Pools ;
2730using PlayerRoles ;
28- using PlayerRoles . Spectating ;
2931using PlayerRoles . FirstPersonControl ;
30-
31- using InventorySystem . Disarming ;
32-
33- using InventorySystem . Items ;
34- using InventorySystem . Items . Pickups ;
35-
32+ using PlayerRoles . Spectating ;
3633using RemoteAdmin ;
3734using RemoteAdmin . Communication ;
38-
39- using LiteNetLib ;
40-
35+ using System . Collections . Generic ;
36+ using System . Collections . ObjectModel ;
37+ using System . Reflection ;
4138using UnityEngine ;
42-
43- using VoiceChat ;
44-
45- using Hints ;
46-
47- using CentralAuth ;
48-
49- using CommandSystem ;
50-
51- using Footprinting ;
52-
53- using NetworkManagerUtils . Dummies ;
54-
55- using NorthwoodLib . Pools ;
56-
5739using UserSettings . ServerSpecific ;
40+ using VoiceChat ;
5841
5942#pragma warning disable CS8602 // Dereference of a possibly null reference.
6043#pragma warning disable CS8604 // Possible null reference argument.
@@ -135,6 +118,11 @@ public class ExPlayer : Player, IDisposable
135118 }
136119 }
137120
121+ /// <summary>
122+ /// Gets a dictionary of Personal DefinedSettings for each Plugin Assembly
123+ /// </summary>
124+ public Dictionary < Assembly , ServerSpecificSettingBase [ ] > ? SettingsByAssembly => settingsByAssembly ;
125+
138126 #region Get
139127 /// <summary>
140128 /// Gets an <see cref="ExPlayer"/> instance tied to the specified <see cref="ReferenceHub"/>.
@@ -459,7 +447,10 @@ public static IEnumerable<ExPlayer> Get(RoleTypeId role)
459447 private string idInfoValue = string . Empty ;
460448
461449 internal ICommandRunner ? activeRunner ;
462-
450+
451+ internal Dictionary < Assembly , ServerSpecificSettingBase [ ] > ?
452+ settingsByAssembly = DictionaryPool < Assembly , ServerSpecificSettingBase [ ] > . Shared . Rent ( ) ;
453+
463454 internal Dictionary < string , SettingsMenu > ? settingsMenuLookup = DictionaryPool < string , SettingsMenu > . Shared . Rent ( ) ;
464455 internal Dictionary < string , SettingsEntry > ? settingsIdLookup = DictionaryPool < string , SettingsEntry > . Shared . Rent ( ) ;
465456
@@ -1442,6 +1433,9 @@ public void Dispose()
14421433 PersistentStorage = null ! ;
14431434 }
14441435
1436+ if ( settingsByAssembly != null )
1437+ DictionaryPool < Assembly , ServerSpecificSettingBase [ ] > . Shared . Return ( settingsByAssembly ) ;
1438+
14451439 if ( settingsIdLookup != null )
14461440 DictionaryPool < string , SettingsEntry > . Shared . Return ( settingsIdLookup ) ;
14471441
@@ -1463,6 +1457,7 @@ public void Dispose()
14631457 if ( SentPositions != null )
14641458 DictionaryPool < uint , PositionSync . SentPosition > . Shared . Return ( SentPositions ) ;
14651459
1460+ settingsByAssembly = null ;
14661461 settingsIdLookup = null ;
14671462 settingsMenuLookup = null ;
14681463 settingsAssignedIdLookup = null ;
@@ -1478,6 +1473,21 @@ public void Dispose()
14781473 Rotation = null ! ;
14791474 }
14801475
1476+ internal void SyncSettingsByAssembly ( Assembly assembly , ServerSpecificSettingBase [ ] collection ) {
1477+ if ( ! this )
1478+ return ;
1479+
1480+ if ( settingsByAssembly == null ) {
1481+ ApiLog . Warn ( $ "Player's { nameof ( settingsByAssembly ) } is null") ;
1482+ return ;
1483+ }
1484+
1485+ if ( collection == null || collection . Length == 0 )
1486+ settingsByAssembly . Remove ( assembly ) ;
1487+ else
1488+ settingsByAssembly [ assembly ] = collection ;
1489+ }
1490+
14811491 private static ReferenceHub SpawnHiddenDummy ( string nick )
14821492 {
14831493 var hubGo = UnityEngine . Object . Instantiate ( NetworkManager . singleton . playerPrefab ) ;
0 commit comments