本文整理匯總了Java中org.bukkit.potion.Potion.setHasExtendedDuration方法的典型用法代碼示例。如果您正苦於以下問題:Java Potion.setHasExtendedDuration方法的具體用法?Java Potion.setHasExtendedDuration怎麽用?Java Potion.setHasExtendedDuration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.potion.Potion
的用法示例。
在下文中一共展示了Potion.setHasExtendedDuration方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setMainPotionEffect
import org.bukkit.potion.Potion; //導入方法依賴的package包/類
public ItemBuilder setMainPotionEffect(PotionType type, boolean extendedDurability, int level, boolean splash) {
if (! (meta instanceof PotionMeta))
return this;
Potion potion = Potion.fromItemStack(stack);
potion.setType(type);
if (! type.isInstant())
potion.setHasExtendedDuration(extendedDurability);
potion.setLevel(level);
potion.setSplash(splash);
potion.apply(stack);
return this;
}
示例2: build
import org.bukkit.potion.Potion; //導入方法依賴的package包/類
public Potion build() {
Potion potion = new Potion(type);
potion.setLevel(this.level);
if(potion.isSplash()) {
potion.setHasExtendedDuration(this.extended);
}
return potion;
}
示例3: setPotion
import org.bukkit.potion.Potion; //導入方法依賴的package包/類
@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;
}
示例4: setPotion
import org.bukkit.potion.Potion; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public ItemStack setPotion(Material itemMaterial, Tag itemTags,
ItemStack chestItem) {
// Try some backwards compatibility with new 1.9 schematics
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;
}