Beispiel #1
0
        /// <summary>
        /// Retrieves a metadata value from this player at the specified key.
        /// </summary>
        /// <typeparam name="T">The data type</typeparam>
        /// <param name="plugin">The plugin calling this method.</param>
        /// <param name="global">Whether the metadata node is global or plugin-local.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value output. <see cref="default"/> if not found.</param>
        /// <returns>Whether or not the value exists and was assigned to <paramref name="value"/></returns>
        public bool GetMetadata <T>(Plugin plugin, bool global, string key, out T value)
        {
            if (plugin == null)
            {
                throw new ArgumentNullException("The plugin instance cannot be null!");
            }

            if (global)
            {
                return(Metadata.GetGlobalValue(key, out value));
            }
            else
            {
                return(Metadata.GetLocalValue(plugin, key, out value));
            }
        }