當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。