@@ -0,0 +1,3088 @@
+/*%0A * This file is part of GenericsLib for Bukkit, licensed under the MIT License (MIT).%0A *%0A * Copyright (c) JCThePants (www.jcwhatever.com)%0A *%0A * Permission is hereby granted, free of charge, to any person obtaining a copy%0A * of this software and associated documentation files (the %22Software%22), to deal%0A * in the Software without restriction, including without limitation the rights%0A * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell%0A * copies of the Software, and to permit persons to whom the Software is%0A * furnished to do so, subject to the following conditions:%0A *%0A * The above copyright notice and this permission notice shall be included in%0A * all copies or substantial portions of the Software.%0A *%0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,%0A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE%0A * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER%0A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,%0A * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN%0A * THE SOFTWARE.%0A */%0A%0Apackage com.jcwhatever.bukkit.generic.utils;%0A%0Aimport com.jcwhatever.bukkit.generic.mixins.IMeta;%0A%0Aimport javax.annotation.Nullable;%0A%0A/**%0A * A meta data key that is used as a singleton instance or as a wrapper to%0A * an object that represents the key.%0A */%0Apublic class MetaKey%3CV%3E %7B%0A%0A    private final Object _key;%0A    private final Class%3CV%3E _type;%0A%0A    /**%0A     * Constructor.%0A     *%0A     * %3Cp%3EThe newly created instance acts as a meta key and should%0A     * be stored as a singleton instance.%3C/p%3E%0A     *%0A     * @param type  The meta value type.%0A     */%0A    public MetaKey(Class%3CV%3E type) %7B%0A        this(type, null);%0A    %7D%0A%0A    /**%0A     * Constructor.%0A     *%0A     * %3Cp%3EThe meta key instance equals the provided key.%3C/p%3E%0A     *%0A     * @param type  The meta value type.%0A     * @param key   The key object.%0A     */%0A    public MetaKey(Class%3CV%3E type, @Nullable Object key) %7B%0A        PreCon.notNull(type);%0A%0A        _type = type;%0A        _key = key != null ? key : this;%0A    %7D%0A%0A    /**%0A     * Get the meta value represented by the key%0A     * from the specified meta store.%0A     *%0A     * @param meta  The meta store.%0A     *%0A     * @return  Null if the value is not present or is not the correct type.%0A     */%0A    @Nullable%0A    public V getValue(IMeta meta) %7B%0A        PreCon.notNull(meta);%0A%0A        Object value = meta.getMetaObject(this);%0A        if (value == null)%0A            return null;%0A%0A        if (_type.isAssignableFrom(value.getClass())) %7B%0A            return _type.cast(value);%0A        %7D%0A%0A        return null;%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        if (_key == this) %7B%0A            return super.hashCode();%0A        %7D%0A        return _key.hashCode();%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        if (obj instanceof MetaKey) %7B%0A            return ((MetaKey) obj)._key.equals(_key);%0A        %7D%0A%0A        return _key.equals(obj);%0A    %7D%0A%7D%0A

add MetaKey class