当前位置: 首页>>代码示例>>Java>>正文


Java PotionType.valueOf方法代码示例

本文整理汇总了Java中org.bukkit.potion.PotionType.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java PotionType.valueOf方法的具体用法?Java PotionType.valueOf怎么用?Java PotionType.valueOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.potion.PotionType的用法示例。


在下文中一共展示了PotionType.valueOf方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addPotion

import org.bukkit.potion.PotionType; //导入方法依赖的package包/类
/**
 * Turn an ItemStack with a Material of POTION into a functional potion
 * @param typeName PotionType string representing the potion type. (Matches Bukkit PotionType enum.)
 * @param upgraded Boolean specifying a level two potion if true
 * @param extended Is this an extended duration potion?
 */
public void addPotion(String typeName, boolean upgraded, boolean extended) {
    Material mat = this.item.getType();
    Set<Material> types = new HashSet<>();
    types.add(Material.POTION);
    types.add(Material.SPLASH_POTION);
    types.add(Material.LINGERING_POTION);
    types.add(Material.TIPPED_ARROW);
    if (!types.contains(mat)) return;
    try {
        PotionType type = PotionType.valueOf(typeName.toUpperCase());
        PotionData pd = new PotionData(type, extended, upgraded);
        PotionMeta meta = (PotionMeta) this.item.getItemMeta();
        meta.setBasePotionData(pd);
        this.item.setItemMeta(meta);
    } catch (Exception ex) {
        Bukkit.getLogger().warning(String.format("Kit configuration error: %s", ex.getMessage()));
    }
}
 
开发者ID:redwallhp,项目名称:AthenaGM,代码行数:25,代码来源:MapInfoKitItem.java

示例2: read

import org.bukkit.potion.PotionType; //导入方法依赖的package包/类
@Override
public void read(DataInputStream input) throws IOException {
    PotionType type = PotionType.valueOf(input.readUTF());
    boolean extended = input.readBoolean();
    boolean upgraded = input.readBoolean();
    
    setValue(new PotionData(type, extended, upgraded));
}
 
开发者ID:OrigamiDream,项目名称:Leveled-Storage,代码行数:9,代码来源:PotionDataStorage.java

示例3: setType

import org.bukkit.potion.PotionType; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:Co0sh,项目名称:BetonQuest,代码行数:9,代码来源:PotionHandler.java

示例4: build

import org.bukkit.potion.PotionType; //导入方法依赖的package包/类
@Override
public ItemStack build(ItemStack stack) {
  if(valid) {
    PotionMeta meta = (PotionMeta)stack.getItemMeta();
    if(color != null) meta.setColor(color);
    customEffects.forEach((effect)->meta.addCustomEffect(effect, true));
    PotionData data = new PotionData(PotionType.valueOf(type), extended, upgraded);
    meta.setBasePotionData(data);
    stack.setItemMeta(meta);
  }
  return stack;
}
 
开发者ID:TheNewEconomy,项目名称:TNE-Bukkit,代码行数:13,代码来源:SerialPotionData.java

示例5: getBukkitPotionType

import org.bukkit.potion.PotionType; //导入方法依赖的package包/类
public PotionType getBukkitPotionType() {
    return PotionType.valueOf(this.name());
}
 
开发者ID:AlexMl,项目名称:ZvP,代码行数:4,代码来源:KEssentialsKit.java


注:本文中的org.bukkit.potion.PotionType.valueOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。