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


Java PotionEffectType.getByName方法代码示例

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


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

示例1: craftPotionEffect

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
public static PotionEffect craftPotionEffect(String name, ConfigurationSection section) {
	if(section == null){
		Error.MISSING.add();
		return null;
	}
	PotionEffectType effect = PotionEffectType.getByName(name);
	if( effect == null ) {
		ErrorLogger.addError(name + " is not a valid potion effect type !");
		return null;
	}
	int duration = section.getInt(Node.DURATION.get(), 120)*20;
	int amplifier = section.getInt(Node.LEVEL.get(), 1) - 1;
	boolean ambient = section.getBoolean(Node.AMBIANT.get(), true);
	boolean particles = section.getBoolean(Node.PARTICLE.get(), true);
	return new PotionEffect(effect, duration, amplifier, ambient, particles);
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:17,代码来源:MinecraftUtils.java

示例2: parsePotionEffect

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
private PotionEffect parsePotionEffect(JsonObject jsonObject) {
    PotionEffectType type = PotionEffectType.getByName(Strings.getTechnicalName(jsonObject.get("type").getAsString()));

    int duration = 30;
    int amplifier = 0;
    boolean ambient = true;
    boolean particles = true;
    //Color color = null;

    if (jsonObject.has("duration")) { // Ticks
        duration = jsonObject.get("duration").getAsInt();
    }

    if (jsonObject.has("amplifier")) {
        amplifier = jsonObject.get("amplifier").getAsInt();
    }

    if (jsonObject.has("ambient")) {
        ambient = jsonObject.get("ambient").getAsBoolean();
    }

    if (jsonObject.has("particles")) {
        particles = jsonObject.get("particles").getAsBoolean();
    }

    //if (jsonObject.has("color")) color = Color.jsonObject.get("color")

    return new PotionEffect(type, duration, amplifier, ambient, particles, null);
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:30,代码来源:EffectKitNodeParser.java

示例3: parsePotionEffectType

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
public static PotionEffectType parsePotionEffectType(Node node, String text) throws InvalidXMLException {
    PotionEffectType type = PotionEffectType.getByName(text.toUpperCase().replace(" ", "_"));
    if(type == null) type = Bukkit.potionEffectRegistry().get(parseKey(node, text));
    if(type == null) {
        throw new InvalidXMLException("Unknown potion effect '" + node.getValue() + "'", node);
    }
    return type;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:9,代码来源:XMLUtils.java

示例4: deserializePotionEffect

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
public static PotionEffect deserializePotionEffect(String raw) {
	String[] arr = raw.split(",");
	PotionEffectType type = PotionEffectType.getByName(arr[0].toUpperCase());
	int level = Integer.parseInt(arr[1]);
	int duration = 2147483647;
	if (arr.length > 2)
		duration = Integer.parseInt(arr[2]);
	
	return new PotionEffect(type, duration, level - 1);
}
 
开发者ID:thekeenant,项目名称:mczone,代码行数:11,代码来源:ItemUtil.java

示例5: getPotionEffects

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
public static List<PotionEffect> getPotionEffects(int food) {
	List<PotionEffect> effects = new ArrayList<PotionEffect>();
	String[] e;
	PotionEffectType eft;
	int duration;
	int amplifier;
	for(String eff : config.getStringList(String.valueOf(food) + ".effects")){
		e = eff.split(", ");
		eft = PotionEffectType.getByName(e[0]);
		duration = Integer.parseInt(e[1]) * 20;
		amplifier = Integer.parseInt(e[2]) - 1;
		effects.add(new PotionEffect(eft, duration, amplifier));
	}
	return effects;
}
 
开发者ID:benNek,项目名称:AsgardAscension,代码行数:16,代码来源:GodFoodFile.java

示例6: getPotionEffect

import org.bukkit.potion.PotionEffectType; //导入方法依赖的package包/类
public PotionEffect getPotionEffect() {
    return new PotionEffect(PotionEffectType.getByName(type), duration, amplifier);
}
 
开发者ID:IzzelAliz,项目名称:TalentZzzz,代码行数:4,代码来源:ItemManager.java


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