类org.bukkit.potion.PotionType源码实例Demo

下面列出了怎么用org.bukkit.potion.PotionType的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Kettle   文件: CraftTippedArrow.java
@Override
public boolean removeCustomEffect(PotionEffectType effect) {
    int effectId = effect.getId();
    net.minecraft.potion.PotionEffect existing = null;
    for (net.minecraft.potion.PotionEffect mobEffect : getHandle().customPotionEffects) {
        if (Potion.getIdFromPotion(mobEffect.getPotion()) == effectId) {
            existing = mobEffect;
        }
    }
    if (existing == null) {
        return false;
    }
    Validate.isTrue(getBasePotionData().getType() != PotionType.UNCRAFTABLE || !getHandle().customPotionEffects.isEmpty(), "Tipped Arrows must have at least 1 effect");
    getHandle().customPotionEffects.remove(existing);
    getHandle().refreshEffects();
    return true;
}
 
源代码2 项目: Kettle   文件: CraftWorld.java
public <T extends Arrow> T spawnArrow(Location loc, Vector velocity, float speed, float spread, Class<T> clazz) {
    Validate.notNull(loc, "Can not spawn arrow with a null location");
    Validate.notNull(velocity, "Can not spawn arrow with a null velocity");
    Validate.notNull(clazz, "Can not spawn an arrow with no class");

    EntityArrow arrow;
    if (TippedArrow.class.isAssignableFrom(clazz)) {
        arrow = new EntityTippedArrow(world);
        ((EntityTippedArrow) arrow).setType(CraftPotionUtil.fromBukkit(new PotionData(PotionType.WATER, false, false)));
    } else if (SpectralArrow.class.isAssignableFrom(clazz)) {
        arrow = new EntitySpectralArrow(world);
    } else {
        arrow = new EntityTippedArrow(world);
    }

    arrow.setLocationAndAngles(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
    arrow.shoot(velocity.getX(), velocity.getY(), velocity.getZ(), speed, spread);
    world.spawnEntity(arrow);
    return (T) arrow.getBukkitEntity();
}
 
源代码3 项目: Kettle   文件: CraftMetaPotion.java
CraftMetaPotion(Map<String, Object> map) {
    super(map);
    type = CraftPotionUtil.toBukkit(SerializableMeta.getString(map, DEFAULT_POTION.BUKKIT, true));
    if (type.getType() == PotionType.UNCRAFTABLE) {
        emptyType = SerializableMeta.getString(map, DEFAULT_POTION.BUKKIT + "-empty", true);
    }
    Color color = SerializableMeta.getObject(Color.class, map, POTION_COLOR.BUKKIT, true);
    if (color != null) {
        setColor(color);
    }

    Iterable<?> rawEffectList = SerializableMeta.getObject(Iterable.class, map, POTION_EFFECTS.BUKKIT, true);
    if (rawEffectList == null) {
        return;
    }

    for (Object obj : rawEffectList) {
        if (!(obj instanceof PotionEffect)) {
            throw new IllegalArgumentException("Object in effect list is not valid. " + obj.getClass());
        }
        addCustomEffect((PotionEffect) obj, true);
    }
}
 
源代码4 项目: Kettle   文件: CraftMetaPotion.java
@Override
void applyToItem(NBTTagCompound tag) {
    super.applyToItem(tag);

    tag.setString(DEFAULT_POTION.NBT, (this.type.getType() == PotionType.UNCRAFTABLE && emptyType != null) ? emptyType : CraftPotionUtil.fromBukkit(type));

    if (hasColor()) {
        tag.setInteger(POTION_COLOR.NBT, color.asRGB());
    }

    if (customEffects != null) {
        NBTTagList effectList = new NBTTagList();
        tag.setTag(POTION_EFFECTS.NBT, effectList);

        for (PotionEffect effect : customEffects) {
            NBTTagCompound effectData = new NBTTagCompound();
            effectData.setByte(ID.NBT, (byte) effect.getType().getId());
            effectData.setByte(AMPLIFIER.NBT, (byte) effect.getAmplifier());
            effectData.setInteger(DURATION.NBT, effect.getDuration());
            effectData.setBoolean(AMBIENT.NBT, effect.isAmbient());
            effectData.setBoolean(SHOW_PARTICLES.NBT, effect.hasParticles());
            effectList.appendTag(effectData);
        }
    }
}
 
源代码5 项目: Kettle   文件: CraftMetaPotion.java
@Override
int applyHash() {
    final int original;
    int hash = original = super.applyHash();
    if (type.getType() != PotionType.UNCRAFTABLE) {
        hash = 73 * hash + type.hashCode();
    } else if (emptyType != null) {
        hash = 73 * hash + emptyType.hashCode();
    }
    if (hasColor()) {
        hash = 73 * hash + color.hashCode();
    }
    if (hasCustomEffects()) {
        hash = 73 * hash + customEffects.hashCode();
    }
    return original != hash ? CraftMetaPotion.class.hashCode() ^ hash : hash;
}
 
源代码6 项目: Kettle   文件: CraftMetaPotion.java
@Override
Builder<String, Object> serialize(Builder<String, Object> builder) {
    super.serialize(builder);
    if (type.getType() != PotionType.UNCRAFTABLE) {
        builder.put(DEFAULT_POTION.BUKKIT, CraftPotionUtil.fromBukkit(type));
    } else if (this.emptyType != null) {
        builder.put(DEFAULT_POTION.BUKKIT + "-empty", emptyType);
    }

    if (hasColor()) {
        builder.put(POTION_COLOR.BUKKIT, getColor());
    }

    if (hasCustomEffects()) {
        builder.put(POTION_EFFECTS.BUKKIT, ImmutableList.copyOf(this.customEffects));
    }

    return builder;
}
 
源代码7 项目: Kettle   文件: CraftPotionUtil.java
public static PotionData toBukkit(String type) {
    if (type == null) {
        return new PotionData(PotionType.UNCRAFTABLE, false, false);
    }
    if (type.startsWith("minecraft:")) {
        type = type.substring(10);
    }
    PotionType potionType = null;
    potionType = extendable.inverse().get(type);
    if (potionType != null) {
        return new PotionData(potionType, true, false);
    }
    potionType = upgradeable.inverse().get(type);
    if (potionType != null) {
        return new PotionData(potionType, false, true);
    }
    potionType = regular.inverse().get(type);
    if (potionType != null) {
        return new PotionData(potionType, false, false);
    }
    return new PotionData(PotionType.UNCRAFTABLE, false, false);
}
 
源代码8 项目: UhcCore   文件: JsonItemUtils.java
private static ItemMeta parseBasePotionEffect(ItemMeta meta, JsonObject jsonObject) throws ParseException{
    PotionMeta potionMeta = (PotionMeta) meta;

    PotionType type;

    try {
        type = PotionType.valueOf(jsonObject.get("type").getAsString());
    }catch (IllegalArgumentException ex){
        throw new ParseException(ex.getMessage());
    }

    JsonElement jsonElement;
    jsonElement = jsonObject.get("extended");
    boolean extended = jsonElement != null && jsonElement.getAsBoolean();
    jsonElement = jsonObject.get("upgraded");
    boolean upgraded = jsonElement != null && jsonElement.getAsBoolean();

    PotionData potionData = new PotionData(type, extended, upgraded);
    potionMeta = VersionUtils.getVersionUtils().setBasePotionEffect(potionMeta, potionData);

    return potionMeta;
}
 
源代码9 项目: Crazy-Crates   文件: ItemBuilder.java
private PotionType getPotionType(PotionEffectType type) {
    if (type != null) {
        if (type.equals(PotionEffectType.FIRE_RESISTANCE)) {
            return PotionType.FIRE_RESISTANCE;
        } else if (type.equals(PotionEffectType.HARM)) {
            return PotionType.INSTANT_DAMAGE;
        } else if (type.equals(PotionEffectType.HEAL)) {
            return PotionType.INSTANT_HEAL;
        } else if (type.equals(PotionEffectType.INVISIBILITY)) {
            return PotionType.INVISIBILITY;
        } else if (type.equals(PotionEffectType.JUMP)) {
            return PotionType.JUMP;
        } else if (type.equals(PotionEffectType.getByName("LUCK"))) {
            return PotionType.valueOf("LUCK");
        } else if (type.equals(PotionEffectType.NIGHT_VISION)) {
            return PotionType.NIGHT_VISION;
        } else if (type.equals(PotionEffectType.POISON)) {
            return PotionType.POISON;
        } else if (type.equals(PotionEffectType.REGENERATION)) {
            return PotionType.REGEN;
        } else if (type.equals(PotionEffectType.SLOW)) {
            return PotionType.SLOWNESS;
        } else if (type.equals(PotionEffectType.SPEED)) {
            return PotionType.SPEED;
        } else if (type.equals(PotionEffectType.INCREASE_DAMAGE)) {
            return PotionType.STRENGTH;
        } else if (type.equals(PotionEffectType.WATER_BREATHING)) {
            return PotionType.WATER_BREATHING;
        } else if (type.equals(PotionEffectType.WEAKNESS)) {
            return PotionType.WEAKNESS;
        }
    }
    return null;
}
 
源代码10 项目: CS-CoreLib   文件: CustomPotion.java
public CustomPotion(String name, PotionType type, PotionEffect effect, String... lore) {
	super(Material.POTION, name, lore);
	PotionMeta meta = (PotionMeta) getItemMeta();
	meta.setBasePotionData(new PotionData(type));
	meta.addCustomEffect(effect, true);
	setItemMeta(meta);
}
 
源代码11 项目: UHC   文件: Tier2PotionsModule.java
public Tier2PotionsModule(PotionFuelsListener listener) {
    setId("Tier2Potions");

    this.listener = listener;

    final Potion potion = new Potion(PotionType.INSTANT_HEAL);
    potion.setLevel(2);

    this.icon.setType(Material.POTION);
    this.icon.setDurability(potion.toDamageValue());
    this.icon.setWeight(ModuleRegistry.CATEGORY_POTIONS);
    this.iconName = ICON_NAME;
}
 
源代码12 项目: UHC   文件: SplashPotionsModule.java
public SplashPotionsModule(PotionFuelsListener listener) {
    setId("SplashPotions");

    this.listener = listener;

    final Potion potion = new Potion(PotionType.POISON);
    potion.setSplash(true);

    this.icon.setType(Material.POTION);
    this.icon.setDurability(potion.toDamageValue());
    this.icon.setWeight(ModuleRegistry.CATEGORY_POTIONS);
    this.iconName = ICON_NAME;
}
 
源代码13 项目: ShopChest   文件: ItemUtils.java
public static PotionType getPotionEffect(ItemStack itemStack) {
    if (itemStack.getItemMeta() instanceof PotionMeta) {    
        if (Utils.getMajorVersion() < 9) {
            return Potion.fromItemStack(itemStack).getType();
        } else {
            return ((PotionMeta) itemStack.getItemMeta()).getBasePotionData().getType();
        }
    }

    return null;
}
 
源代码14 项目: BetonQuest   文件: PotionHandler.java
public void setType(String type) throws InstructionParseException {
    typeE = Existence.REQUIRED;
    try {
        this.type = PotionType.valueOf(type.toUpperCase());
    } catch (IllegalArgumentException e) {
        throw new InstructionParseException("No such potion type: " + type, e);
    }
}
 
源代码15 项目: CraftserveRadiation   文件: LugolsIodinePotion.java
public Recipe(boolean enabled, Material ingredient, PotionType basePotion) {
    this.enabled = enabled;
    this.ingredient = Objects.requireNonNull(ingredient, "ingredient");
    this.basePotion = Objects.requireNonNull(basePotion, "basePotion");
}
 
源代码16 项目: CraftserveRadiation   文件: LugolsIodinePotion.java
public PotionType getBasePotion() {
    return basePotion;
}
 
源代码17 项目: Kettle   文件: CraftTippedArrow.java
@Override
public void clearCustomEffects() {
    Validate.isTrue(getBasePotionData().getType() != PotionType.UNCRAFTABLE, "Tipped Arrows must have at least 1 effect");
    getHandle().customPotionEffects.clear();
    getHandle().refreshEffects();
}
 
源代码18 项目: Kettle   文件: CraftTippedArrow.java
@Override
public void setBasePotionData(PotionData data) {
    Validate.notNull(data, "PotionData cannot be null");
    Validate.isTrue(data.getType() != PotionType.UNCRAFTABLE || !getHandle().customPotionEffects.isEmpty(), "Tipped Arrows must have at least 1 effect");
    getHandle().setType(CraftPotionUtil.fromBukkit(data));
}
 
源代码19 项目: Kettle   文件: CraftMetaPotion.java
boolean isPotionEmpty() {
    return (type.getType() == PotionType.UNCRAFTABLE) && !(hasCustomEffects() || hasColor()) && emptyType == null;
}
 
源代码20 项目: Skript   文件: PotionEffectUtils.java
/**
 * Checks if given string represents a known potion type and returns that type.
 * Unused currently, will be used soon (TM).
 * @param name Name of potion type
 * @return
 */
@Nullable
public static PotionType checkPotionType(String name) {
	switch (name) {
		case "uncraftable":
		case "empty":
			return PotionType.UNCRAFTABLE;
		case "mundane":
			return PotionType.MUNDANE;
		case "thick":
			return PotionType.THICK;
		case "night vision":
		case "darkvision":
			return PotionType.NIGHT_VISION;
		case "invisibility":
			return PotionType.INVISIBILITY;
		case "leaping":
		case "jump boost":
			return PotionType.JUMP;
		case "fire resistance":
		case "fire immunity":
			return PotionType.FIRE_RESISTANCE;
		case "swiftness":
		case "speed":
			return PotionType.SPEED;
		case "slowness":
			return PotionType.SLOWNESS;
		case "water breathing":
			return PotionType.WATER_BREATHING;
		case "instant health":
		case "healing":
		case "health":
			return PotionType.INSTANT_HEAL;
		case "instant damage":
		case "harming":
		case "damage":
			return PotionType.INSTANT_DAMAGE;
		case "poison":
			return PotionType.POISON;
		case "regeneration":
		case "regen":
			return PotionType.REGEN;
		case "strength":
			return PotionType.STRENGTH;
		case "weakness":
			return PotionType.WEAKNESS;
		case "luck":
			return PotionType.LUCK;
	}
	
	return null;
}
 
源代码21 项目: Sentinel   文件: SentinelWeaponHelper.java
/**
 * Fires an arrow from the NPC at a target.
 */
public void fireArrow(ItemStack type, Location target, Vector lead) {
    Location launchStart;
    Vector baseVelocity;
    if (SentinelVersionCompat.v1_14 && type.getType() == Material.FIREWORK_ROCKET) {
        launchStart = sentinel.getLivingEntity().getEyeLocation();
        launchStart = launchStart.clone().add(launchStart.getDirection());
        baseVelocity = target.toVector().subtract(launchStart.toVector().add(lead));
        if (baseVelocity.lengthSquared() > 0) {
            baseVelocity = baseVelocity.normalize();
        }
        baseVelocity = baseVelocity.multiply(2);
    }
    else {
        HashMap.SimpleEntry<Location, Vector> start = sentinel.getLaunchDetail(target, lead);
        if (start == null || start.getKey() == null) {
            return;
        }
        launchStart = start.getKey();
        baseVelocity = start.getValue();
    }
    Vector velocity = sentinel.fixForAcc(baseVelocity);
    sentinel.stats_arrowsFired++;
    Entity arrow;
    if (SentinelVersionCompat.v1_9) {
        if (SentinelVersionCompat.v1_14) {
            double length = Math.max(1.0, velocity.length());
            if (type.getType() == Material.FIREWORK_ROCKET) {
                FireworkMeta meta = (FireworkMeta) type.getItemMeta();
                meta.setPower(3);
                arrow = launchStart.getWorld().spawn(launchStart, EntityType.FIREWORK.getEntityClass(), (e) -> {
                    ((Firework) e).setShotAtAngle(true);
                    ((Firework) e).setFireworkMeta(meta);
                    e.setVelocity(velocity);
                });
            }
            else {
                Class toShoot;
                toShoot = type.getType() == Material.SPECTRAL_ARROW ? SpectralArrow.class :
                        (type.getType() == Material.TIPPED_ARROW ? TippedArrow.class : Arrow.class);
                arrow = launchStart.getWorld().spawnArrow(launchStart, velocity.multiply(1.0 / length), (float) length, 0f, toShoot);
                ((Projectile) arrow).setShooter(getLivingEntity());
                ((Arrow) arrow).setPickupStatus(Arrow.PickupStatus.DISALLOWED);
                if (type.getItemMeta() instanceof PotionMeta) {
                    PotionData data = ((PotionMeta) type.getItemMeta()).getBasePotionData();
                    if (data.getType() == null || data.getType() == PotionType.UNCRAFTABLE) {
                        if (SentinelPlugin.debugMe) {
                            sentinel.debug("Potion data '" + data + "' for '" + type.toString() + "' is invalid.");
                        }
                    }
                    else {
                        ((Arrow) arrow).setBasePotionData(data);
                        for (PotionEffect effect : ((PotionMeta) type.getItemMeta()).getCustomEffects()) {
                            ((Arrow) arrow).addCustomEffect(effect, true);
                        }
                    }
                }
            }
        }
        else {
            arrow = launchStart.getWorld().spawnEntity(launchStart,
                    type.getType() == Material.SPECTRAL_ARROW ? EntityType.SPECTRAL_ARROW :
                            (type.getType() == Material.TIPPED_ARROW ? TIPPED_ARROW : EntityType.ARROW));
            arrow.setVelocity(velocity);
            ((Projectile) arrow).setShooter(getLivingEntity());
        }
    }
    else {
        arrow = launchStart.getWorld().spawnEntity(launchStart, EntityType.ARROW);
        ((Projectile) arrow).setShooter(getLivingEntity());
        arrow.setVelocity(velocity);
    }
    if (sentinel.itemHelper.getHeldItem().containsEnchantment(Enchantment.ARROW_FIRE)) {
        arrow.setFireTicks(10000);
    }
    sentinel.useItem();
}
 
源代码22 项目: AnnihilationPro   文件: Vampire.java
@Override
protected Loadout getFinalLoadout()
{
	return new Loadout().addStoneSword().addWoodPick().addWoodAxe()
			.addItem(new Potion(PotionType.NIGHT_VISION).toItemStack(1));
}
 
源代码23 项目: AnnihilationPro   文件: Loadout.java
@SuppressWarnings("deprecation")
public Loadout addHealthPotion1()
{
	return addItem(KitUtils.addSoulbound((new Potion(PotionType.INSTANT_HEAL, 1, false,false).toItemStack(1))));
}
 
源代码24 项目: TradePlus   文件: UMaterial.java
public static UMaterial matchPotion(ItemStack potion) {
  if(potion != null && potion.getItemMeta() instanceof PotionMeta) {
    final PotionMeta p = (PotionMeta) potion.getItemMeta();
    final List<PotionEffect> ce = p.getCustomEffects();
    if(ce.size() == 0) {
      final String base;
      final PotionEffectType t;
      final int l, max;
      final boolean extended;
      if(EIGHT) {
        final Potion po = Potion.fromItemStack(potion);
        base = po.isSplash() ? "SPLASH_POTION_" : "POTION_";
        final Collection<PotionEffect> e = po.getEffects();
        t = e.size() > 0 ? ((PotionEffect) e.toArray()[0]).getType() : null;
        l = po.getLevel();
        final PotionType ty = po.getType();
        max = ty != null ? ty.getMaxLevel() : 0;
        extended = po.hasExtendedDuration();
      } else {
        final org.bukkit.potion.PotionData pd = p.getBasePotionData();
        final PotionType type = pd.getType();
        base = potion.getType().name() + "_";
        t = type.getEffectType();
        l = type.isUpgradeable() && pd.isUpgraded() ? 2 : 1;
        max = type.getMaxLevel();
        extended = type.isExtendable() && pd.isExtended();
      }
      final String a = t != null ? t.getName() : null,
          type = a != null ? a.equals("SPEED") ? "SWIFTNESS"
                                 : a.equals("SLOW") ? "SLOWNESS"
                                       : a.equals("INCREASE_DAMAGE") ? "STRENGTH"
                                             : a.equals("HEAL") ? "HEALING"
                                                   : a.equals("HARM") ? "HARMING"
                                                         : a.equals("JUMP") ? "LEAPING"
                                                               : a : null;
      if(type != null) {
        final String g = base + type + (max != 1 && l <= max ? "_" + l : "") + (extended ? "_EXTENDED" : "");
        return valueOf(g);
      } else {
        return UMaterial.POTION;
      }
    }
  }
  return null;
}
 
源代码25 项目: ShopChest   文件: PotionName.java
public PotionName(PotionItemType potionItemType, PotionType potionType, String localizedName) {
    this.potionItemType = potionItemType;
    this.localizedName = localizedName;
    this.potionType = potionType;
}
 
源代码26 项目: ShopChest   文件: PotionName.java
/**
 * @return Potion Type linked to the Potion name
 */
public PotionType getPotionType() {
    return potionType;
}
 
源代码27 项目: BetonQuest   文件: Instruction.java
public PotionType getPotion() throws InstructionParseException {
    return getEnum(next(), PotionType.class);
}
 
源代码28 项目: BetonQuest   文件: Instruction.java
public PotionType getPotion(String string) throws InstructionParseException {
    return getEnum(string, PotionType.class);
}
 
源代码29 项目: Slimefun4   文件: AutoBrewer.java
private ItemStack brew(Material input, Material potionType, PotionMeta potion) {
    PotionData data = potion.getBasePotionData();

    if (data.getType() == PotionType.WATER) {
        if (input == Material.FERMENTED_SPIDER_EYE) {
            potion.setBasePotionData(new PotionData(PotionType.WEAKNESS, false, false));
            return new ItemStack(potionType);
        }
        else if (input == Material.NETHER_WART) {
            potion.setBasePotionData(new PotionData(PotionType.AWKWARD, false, false));
            return new ItemStack(potionType);
        }
        else if (potionType == Material.POTION && input == Material.GUNPOWDER) {
            return new ItemStack(Material.SPLASH_POTION);
        }
        else if (potionType == Material.SPLASH_POTION && input == Material.DRAGON_BREATH) {
            return new ItemStack(Material.LINGERING_POTION);
        }
        else {
            return null;
        }

    }
    else if (input == Material.FERMENTED_SPIDER_EYE) {
        potion.setBasePotionData(new PotionData(fermentations.get(data.getType()), false, false));
        return new ItemStack(potionType);
    }
    else if (input == Material.REDSTONE) {
        potion.setBasePotionData(new PotionData(data.getType(), true, data.isUpgraded()));
        return new ItemStack(potionType);
    }
    else if (input == Material.GLOWSTONE_DUST) {
        potion.setBasePotionData(new PotionData(data.getType(), data.isExtended(), true));
        return new ItemStack(potionType);
    }
    else if (data.getType() == PotionType.AWKWARD && potionRecipes.containsKey(input)) {
        potion.setBasePotionData(new PotionData(potionRecipes.get(input), false, false));
        return new ItemStack(potionType);
    }
    else {
        return null;
    }
}
 
源代码30 项目: askyblock   文件: NMSHandler.java
@Override
public ItemStack setPotion(Material itemMaterial, Tag itemTags,
        ItemStack chestItem) {
    // Try some backwards compatibility with new 1.9 schematics
    Map<String,Tag> cont = (Map<String,Tag>) ((CompoundTag) itemTags).getValue();
    if (cont != null) {
        if (((CompoundTag) itemTags).getValue().containsKey("tag")) {
            Map<String,Tag> contents = (Map<String,Tag>)((CompoundTag) itemTags).getValue().get("tag").getValue();
            StringTag stringTag = ((StringTag)contents.get("Potion"));
            if (stringTag != null) {
                String tag = stringTag.getValue().replace("minecraft:", "");
                PotionType type = null;
                boolean strong = tag.contains("strong");
                boolean _long = tag.contains("long");
                //Bukkit.getLogger().info("tag = " + tag);
                if(tag.equals("fire_resistance") || tag.equals("long_fire_resistance")){
                    type = PotionType.FIRE_RESISTANCE;
                }else if(tag.equals("harming") || tag.equals("strong_harming")){
                    type = PotionType.INSTANT_DAMAGE;
                }else if(tag.equals("healing") || tag.equals("strong_healing")){
                    type = PotionType.INSTANT_HEAL;
                }else if(tag.equals("invisibility") || tag.equals("long_invisibility")){
                    type = PotionType.INVISIBILITY;
                }else if(tag.equals("leaping") || tag.equals("long_leaping") || tag.equals("strong_leaping")){
                    type = PotionType.JUMP;
                }else if(tag.equals("night_vision") || tag.equals("long_night_vision")){
                    type = PotionType.NIGHT_VISION;
                }else if(tag.equals("poison") || tag.equals("long_poison") || tag.equals("strong_poison")){
                    type = PotionType.POISON;
                }else if(tag.equals("regeneration") || tag.equals("long_regeneration") || tag.equals("strong_regeneration")){
                    type = PotionType.REGEN;
                }else if(tag.equals("slowness") || tag.equals("long_slowness")){
                    type = PotionType.SLOWNESS;
                }else if(tag.equals("swiftness") || tag.equals("long_swiftness") || tag.equals("strong_swiftness")){
                    type = PotionType.SPEED;
                }else if(tag.equals("strength") || tag.equals("long_strength") || tag.equals("strong_strength")){
                    type = PotionType.STRENGTH;
                }else if(tag.equals("water_breathing") || tag.equals("long_water_breathing")){
                    type = PotionType.WATER_BREATHING;
                }else if(tag.equals("water")){
                    type = PotionType.WATER;
                }else if(tag.equals("weakness") || tag.equals("long_weakness")){
                    type = PotionType.WEAKNESS;
                }else{
                    return chestItem;
                }
                Potion potion = new Potion(type);
                potion.setHasExtendedDuration(_long);
                potion.setLevel(strong ? 2 : 1);
                chestItem = potion.toItemStack(chestItem.getAmount());
            }
        }
    }

    return chestItem;
}
 
 类所在包
 同包方法