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


Java PotionMeta类代码示例

本文整理汇总了Java中org.bukkit.inventory.meta.PotionMeta的典型用法代码示例。如果您正苦于以下问题:Java PotionMeta类的具体用法?Java PotionMeta怎么用?Java PotionMeta使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: parse

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
@Override
public @Nullable ItemModifyModule parse(MapModuleContext context, Logger logger, Document doc) throws InvalidXMLException {
    List<ItemRule> rules = new ArrayList<>();
    for(Element elRule : XMLUtils.flattenElements(doc.getRootElement(), "item-mods", "rule")) {
        MaterialMatcher items = XMLUtils.parseMaterialMatcher(XMLUtils.getRequiredUniqueChild(elRule, "match"));

        // Always use a PotionMeta so the rule can have potion effects, though it will only apply those to potion items
        final Element elModify = XMLUtils.getRequiredUniqueChild(elRule, "modify");
        final PotionMeta meta = (PotionMeta) Bukkit.getItemFactory().getItemMeta(Material.POTION);
        context.needModule(ItemParser.class).parseItemMeta(elModify, meta);
        final boolean defaultAttributes = XMLUtils.parseBoolean(elModify.getAttribute("default-attributes"), false);

        ItemRule rule = new ItemRule(items, meta, defaultAttributes);
        rules.add(rule);
    }

    return rules.isEmpty() ? null : new ItemModifyModule(rules);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:19,代码来源:ItemModifyModule.java

示例2: get

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
@Nullable
@Override
protected Number[] get(Event e) {
	ItemStack i = item.getSingle(e);
	if (i == null) {
		return null;
	}
	if (PotionUtils.isPotionItem(i)) {
		PotionMeta meta = (PotionMeta) i.getItemMeta();
		PotionEffect eff = PotionUtils.getEffectByEffectType(meta, effectType.getSingle(e));
		if (eff == null) {
			return null;
		}
		return new Number[]{eff.getAmplifier()};
	}
	return null;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:18,代码来源:SExprItemEffectTypeAmplifier.java

示例3: get

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
@Nullable
@Override
protected Timespan[] get(Event e) {
	ItemStack i = item.getSingle(e);
	if (i == null) {
		return null;
	}
	if (PotionUtils.isPotionItem(i)) {
		PotionMeta meta = (PotionMeta) i.getItemMeta();
		PotionEffect eff = PotionUtils.getEffectByEffectType(meta, effectType.getSingle(e));
		if (eff == null) {
			return null;
		}
		return new Timespan[]{Timespan.fromTicks_i(eff.getDuration())};
	}
	return null;
}
 
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:18,代码来源:SExprItemEffectTypeDuration.java

示例4: getSeaWater

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
/**
 * l.add("��2��ˮ,����...");
	l.add("��4�������ܽ��,��l���м�������!");
	l.add("��b��Ҫ�þ�ˮװ�����������������!");
 * @return ��ˮ
 */
public static ItemStack getSeaWater(){
	ItemStack sw=new ItemStack(Material.POTION);
	PotionMeta im = (PotionMeta) sw.getItemMeta();
	im.setColor(Color.fromRGB(15, 103, 219));
	im.setDisplayName("��1��l��ˮ");
	List<String> l=new LinkedList<String>();
	l.add("��a��l"+rs.getLoreTabel("Thirst")+": ��b��l-"+Utils.random(2, 20)+"%");
	l.add("��2��l"+rs.getLoreTabel("SickKind")+": ��c��l"+rs.defSick.split(";")[(int)Utils.random(0, rs.defSick.split(";").length)]);
	l.add("��2��l"+rs.getLoreTabel("Sickness")+": ��c��l"+Utils.random(20, 30)+"%");
	l.add("");
	l.add("��7��l"+rs.getLoreTabel("Weight")+": 1");
	l.add("");
	l.add("��2��ˮ,����...");
	l.add("��4�������ܽ��,��l���м�������!");
	l.add("��b��Ҫ�þ�ˮװ�����������������!");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:26,代码来源:Items.java

示例5: getLakeWater

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
/**
 * l.add("��2��ˮ,�����ճɿ�ˮ");
	l.add("��4��lֱ�Ӻ��м�������!");
	l.add("��b��Ҫ�á�e��l��ˮװ�á�b���������������!");
 * @return��ˮ
 */
public static ItemStack getLakeWater(){
	ItemStack sw=new ItemStack(Material.POTION);
	PotionMeta im = (PotionMeta) sw.getItemMeta();
	im.setColor(Color.fromRGB(36, 165, 229));
	im.setDisplayName("��2��l��ˮ");
	List<String> l=new LinkedList<String>();
	l.add("��2��l"+rs.getLoreTabel("Thirst")+": ��b��l"+Utils.random(5, 20)+"%");
	l.add("��2��l"+rs.getLoreTabel("SickKind")+": ��c��l"+rs.defSick.split(";")[(int)Utils.random(0, rs.defSick.split(";").length)]);
	l.add("��2��l"+rs.getLoreTabel("Sickness")+": ��c��l"+Utils.random(5, 15)+"%");
	l.add("");
	l.add("��7��l"+rs.getLoreTabel("Weight")+": 1");
	l.add("");
	l.add("��4��lֱ�Ӻ��м�������!");
	l.add("��b��Ҫ�á�e��l��ˮװ�á�b���������������!");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:25,代码来源:Items.java

示例6: getHotWater

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
/**
 * l.add("��2����ֱ������");
	l.add("��a��l���Ի������Ƽ���!");
	l.add("��c������ů����!");
 * @return ��ˮ
 */
public static ItemStack getHotWater(){
	ItemStack sw=new ItemStack(Material.POTION);
	PotionMeta im = (PotionMeta) sw.getItemMeta();
	im.setColor(Color.fromRGB(36, 165, 229));
	im.setDisplayName("��d��l��ˮ");
	List<String> l=new LinkedList<String>();
	l.add("��a��l"+rs.getLoreTabel("Thirst")+": ��b��l"+Utils.random(10, 25)+"%");
	l.add("��c��l"+rs.getLoreTabel("Tem")+": ��b��l"+Utils.random(0.1, 1.5));
	l.add("");
	l.add("��7��l"+rs.getLoreTabel("Weight")+": 1");
	l.add("");
	l.add("��2����ֱ������");
	l.add("��a��l���Ի������Ƽ���!");
	l.add("��c������ů����!");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:25,代码来源:Items.java

示例7: getIceWater

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
/**
 * l.add("��2����ֱ������");
	l.add("��b��l���Ը����彵��!");
 * @return ��ˮ
 */
public static ItemStack getIceWater(){
	ItemStack sw=new ItemStack(Material.POTION);
	PotionMeta im = (PotionMeta) sw.getItemMeta();
	im.setColor(Color.fromRGB(36, 165, 229));
	im.setDisplayName("��3��l��ˮ");
	List<String> l=new LinkedList<String>();
	l.add("��a��l"+rs.getLoreTabel("Thirst")+": ��b��l"+Utils.random(10, 25)+"%");
	l.add("��3��l"+rs.getLoreTabel("Tem")+": ��c��l-"+Utils.random(0.1, 1.5)+"%");
	l.add("");
	l.add("��7��l"+rs.getLoreTabel("Weight")+": 1");
	l.add("");
	l.add("��2����ֱ������");
	l.add("��b��l���Ը����彵��!");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:23,代码来源:Items.java

示例8: getFreshWater

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
/**
 * l.add("��2����ֱ������");
 * @return ��ˮ
 */
public static ItemStack getFreshWater(){
	ItemStack sw=new ItemStack(Material.POTION);
	PotionMeta im = (PotionMeta) sw.getItemMeta();
	im.setColor(Color.fromRGB(36, 165, 229));
	im.setDisplayName("��3��l��ˮ");
	List<String> l=new LinkedList<String>();
	l.add("��a��l"+rs.getLoreTabel("Thirst")+": ��b��l"+Utils.random(10, 25)+"%");
	l.add("");
	l.add("��7��l"+rs.getLoreTabel("Weight")+": 1");
	l.add("");
	l.add("��2����ֱ������");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:20,代码来源:Items.java

示例9: getSwamplandWater

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
/**
 *l.add("��2��Ȼ���Խ��,����...");
	l.add("��e���������....");
 * @return ����ˮ
 */
public static ItemStack getSwamplandWater(){
	ItemStack sw=new ItemStack(Material.POTION);
	PotionMeta im = (PotionMeta) sw.getItemMeta();
	im.setColor(Color.fromRGB(50, 69, 107));
	im.setDisplayName("��8��l����ˮ");
	List<String> l=new LinkedList<String>();
	l.add("��a��l"+rs.getLoreTabel("Thirst")+": ��b��l"+Utils.random(2, 15)+"%");
	l.add("��2��l"+rs.getLoreTabel("SickKind")+": ��c��l"+rs.defSick.split(";")[(int)Utils.random(0, rs.defSick.split(";").length)]);
	l.add("��2��l"+rs.getLoreTabel("Sickness")+": ��c��l"+Utils.random(30, 50)+"%");
	l.add("");
	l.add("��7��l"+rs.getLoreTabel("Weight")+": 1");
	l.add("");
	l.add("��2��Ȼ���Խ��,����...");
	l.add("��e���������....");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:24,代码来源:Items.java

示例10: getRainwater

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
/**
	l.add("��2��ˮ�����˵���DZȽϸɾ���");
	l.add("��b���ǻ����н�С���ʵò�");
 * @return ��ˮ
 */
public static ItemStack getRainwater(){
	ItemStack sw=new ItemStack(Material.POTION);
	PotionMeta im = (PotionMeta) sw.getItemMeta();
	im.setColor(Color.fromRGB(36, 165, 229));
	im.setDisplayName("��b��l��ˮ");
	List<String> l=new LinkedList<String>();
	l.add("��a��l"+rs.getLoreTabel("Thirst")+": ��b��l"+Utils.random(5, 25)+"%");
	l.add("��2��l"+rs.getLoreTabel("SickKind")+": ��c��l"+rs.defSick.split(";")[(int)Utils.random(0, rs.defSick.split(";").length)]);
	l.add("��2��l"+rs.getLoreTabel("Sickness")+": ��c��l"+Utils.random(2, 10)+"%");
	l.add("");
	l.add("��7��l"+rs.getLoreTabel("Weight")+": 1");
	l.add("");
	l.add("��2��ˮ�����˵���DZȽϸɾ���");
	l.add("��b���ǻ����н�С���ʵò�");
	im.setLore(l);
	sw.setItemMeta(im);
	return sw;
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:24,代码来源:Items.java

示例11: addPotion

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的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

示例12: onPlayerItemConsumeEvent

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerItemConsumeEvent(PlayerItemConsumeEvent event)
{
	Player player = event.getPlayer();
	
	if (!WorldGuardUtils.hasBypass(player))
	{
		ItemMeta itemMeta = event.getItem().getItemMeta();
		if (itemMeta instanceof PotionMeta)
		{
			WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getSessionManager().get(player).getHandler(GiveEffectsFlag.class).drinkPotion(player, Potion.fromItemStack(event.getItem()).getEffects());
		}
		else
		{
			Material material = event.getItem().getType();
			if (material == Material.MILK_BUCKET)
			{
				WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getSessionManager().get(player).getHandler(GiveEffectsFlag.class).drinkMilk(player);
			}
		}
	}
}
 
开发者ID:isokissa3,项目名称:WorldGuardExtraFlagsPlugin,代码行数:23,代码来源:PlayerListener.java

示例13: parse

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
public static ItemMeta parse(Element xml, ItemMeta source) {
    if (source instanceof BannerMeta) {
        return parseBanner(xml, (BannerMeta) source);
    } else if (source instanceof BookMeta) {
        return parseBook(xml, (BookMeta) source);
    } else if (source instanceof EnchantmentStorageMeta) {
        return parseEnchantmentStorage(xml, (EnchantmentStorageMeta) source);
    } else if (source instanceof FireworkMeta) {
        return parseFirework(xml, (FireworkMeta) source);
    } else if (source instanceof FireworkEffectMeta) {
        return parseFireworkEffect(xml, (FireworkEffectMeta) source);
    } else if (source instanceof LeatherArmorMeta) {
        return parseLeatherArmor(xml, (LeatherArmorMeta) source);
    } else if (source instanceof MapMeta) {
        return parseMap(xml, (MapMeta) source);
    } else if (source instanceof PotionMeta) {
        return parsePotion(xml, (PotionMeta) source);
    } else if (source instanceof SkullMeta) {
        return parseSkull(xml, (SkullMeta) source);
    } else if (source instanceof SpawnEggMeta) {
        return parseSpawnEgg(xml, (SpawnEggMeta) source);
    }

    return source;
}
 
开发者ID:ShootGame,项目名称:Arcade2,代码行数:26,代码来源:XMLItemMeta.java

示例14: LuckyPotion

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
public void LuckyPotion(BlockBreakEvent event){
    Location loc = event.getBlock().getLocation();
    World world = loc.getWorld();
    ItemStack energyPotion = new ItemStack(Material.POTION, 1);
    PotionMeta energyPotionMeta = (PotionMeta) energyPotion.getItemMeta();
    energyPotionMeta.setDisplayName("§6Lucky Potion");
    List<String> lore = new ArrayList<String>();
    lore.add("§6"+ LuckyBlocksMainController.instance.language.getString("POTION_DURATION"));
    energyPotionMeta.setLore(lore);
    energyPotionMeta.addCustomEffect(new PotionEffect(PotionEffectType.SPEED, 20*60, 1), true);
    energyPotionMeta.addCustomEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 20*60, 1), true);
    energyPotionMeta.addCustomEffect(new PotionEffect(PotionEffectType.ABSORPTION, 20*60, 1), true);
    energyPotionMeta.addCustomEffect(new PotionEffect(PotionEffectType.HEAL, 20*60, 1), true);
    energyPotionMeta.addCustomEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, 20*60, 1), true);
    energyPotionMeta.addCustomEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20*60, 1), true);
    energyPotionMeta.addCustomEffect(new PotionEffect(PotionEffectType.JUMP, 20*60, 3), true);
    energyPotionMeta.addCustomEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, 20*60, 3), true);
    energyPotion.setItemMeta(energyPotionMeta);
    Potion po = new Potion((byte) 8258);
    po.apply(energyPotion);
    world.dropItemNaturally(loc,energyPotion);
}
 
开发者ID:josegrobles,项目名称:LuckyBlocksBukkit,代码行数:23,代码来源:LuckyBlocksActionController.java

示例15: denyPotion

import org.bukkit.inventory.meta.PotionMeta; //导入依赖的package包/类
public static boolean denyPotion(ItemStack result, Player p){
	List<String> Pots = RPConfig.getStringList("server-protection.deny-potions");
	if (result != null && Pots.size() > 0 && (result.getType().name().contains("POTION") || result.getType().name().contains("TIPPED"))){
		String potname = "";
		if (RedProtect.get().version >= 190){
			PotionMeta pot = (PotionMeta) result.getItemMeta();
			potname = pot.getBasePotionData().getType().name();
		}
		if (RedProtect.get().version <= 180 && Potion.fromItemStack(result) != null){
			potname = Potion.fromItemStack(result).getType().name();
		}    		
		if (Pots.contains(potname)){    			
			RPLang.sendMessage(p, "playerlistener.denypotion");
			return true;
		}        	    		
	}
	return false;
}
 
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:19,代码来源:RPUtil.java


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