コード例 #1
0
ファイル: PotionType.cs プロジェクト: Mitch528/BukkitNET
        public static bool IsInstant(this PotionType type)
        {
            var attrib = type.GetAttribute <PotionTypeInfoAttribute>();
            var effect = attrib.Effect;

            var et = PotionEffectType.GetById(effect);

            return(et == null || et.IsInstant());
        }
コード例 #2
0
        private static PotionEffectType GetEffectType <TKey, TValue>(Dictionary <TKey, TValue> map)
        {
            int type = GetInt(map, TYPE);
            PotionEffectType effect = PotionEffectType.GetById(type);

            if (effect != null)
            {
                return(effect);
            }
            throw new Exception(map + " does not contain " + TYPE);
        }
コード例 #3
0
ファイル: PotionType.cs プロジェクト: Mitch528/BukkitNET
        public static PotionType GetByEffect(PotionEffectType effect)
        {
            if (effect == null)
            {
                return(PotionType.Water);
            }

            var vals = Enum.GetValues(typeof(PotionType));

            foreach (PotionType t in vals)
            {
                var attrib = t.GetAttribute <PotionTypeInfoAttribute>();

                if (PotionEffectType.GetById(attrib.Effect).Equals(effect))
                {
                    return(t);
                }
            }

            return(PotionType.Water);
        }
コード例 #4
0
 public PotionEffectType GetEffectType()
 {
     return(PotionEffectType.GetById(this.Id));
 }