private object CanLock(BasePlayer player, BaseLock @lock) { if (player == null || @lock == null) { return(null); } if (@lock.IsLocked()) { return(false); } if (playerPrefs.ContainsKey(player.UserIDString) && !playerPrefs[player.UserIDString]) { return(null); } var prefab = @lock.parentEntity.Get(true).ShortPrefabName; if (prefab == null) { return(null); } var codeLock = @lock as CodeLock; foreach (var type in lockableTypes) { if (!prefab.Contains(type)) { continue; } if (!permission.UserHasPermission(player.UserIDString, $"masterkey.{type}")) { return(null); } if (showMessages) { player.ChatMessage(Lang("UnlockedWith", player.UserIDString, type)); } if (logUsage) { Log(Lang("LogLock", null, PlayerName(player), type, player.transform.position)); } if (@lock != null) { @lock.SetFlag(BaseEntity.Flags.Locked, true); } if (player != null && codeLock != null) { EffectNetwork.Send(new Effect(codeLock.effectLocked.resourcePath, player.transform.position, Vector3.zero)); } return(false); } return(null); }