本文整理汇总了Java中org.bukkit.entity.TippedArrow类的典型用法代码示例。如果您正苦于以下问题:Java TippedArrow类的具体用法?Java TippedArrow怎么用?Java TippedArrow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TippedArrow类属于org.bukkit.entity包,在下文中一共展示了TippedArrow类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onShootBow
import org.bukkit.entity.TippedArrow; //导入依赖的package包/类
@EventHandler
public void onShootBow(EntityShootBowEvent e){
if (e.isCancelled() || !(e.getEntity() instanceof Player)){
return;
}
Player p = (Player) e.getEntity();
Entity proj = e.getProjectile();
List<String> Pots = RPConfig.getStringList("server-protection.deny-potions");
if (proj != null && (proj instanceof TippedArrow)){
TippedArrow arr = (TippedArrow) proj;
if (Pots.contains(arr.getBasePotionData().getType().name())){
RPLang.sendMessage(p, "playerlistener.denypotion");
e.setCancelled(true);
}
}
}
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:19,代码来源:RPMine19.java
示例2: get
import org.bukkit.entity.TippedArrow; //导入依赖的package包/类
@Nullable
@Override
protected PotionEffect[] get(Event e) {
Entity ent = entity.getSingle(e);
if (ent == null) {
return null;
}
if (ent instanceof ThrownPotion) {
return ((ThrownPotion) ent).getEffects().stream().toArray(PotionEffect[]::new);
} else if (ent instanceof TippedArrow) {
return ((TippedArrow) ent).getCustomEffects().stream().toArray(PotionEffect[]::new);
}
return null;
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:15,代码来源:SExprThrownPotionEffects.java
示例3: effects
import org.bukkit.entity.TippedArrow; //导入依赖的package包/类
public static Collection<PotionEffect> effects(TippedArrow arrow) {
return effects(arrow.getBasePotionData(), arrow.getCustomEffects());
}
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:PotionUtils.java
示例4: change
import org.bukkit.entity.TippedArrow; //导入依赖的package包/类
@Override
public void change(Event e, Object[] delta, @NotNull Changer.ChangeMode mode) {
Entity ent = entity.getSingle(e);
if (ent == null) {
return;
}
if (PotionUtils.isEntityThrownPotion(ent)) {
ItemStack item = ((ThrownPotion) ent).getItem();
PotionMeta potionMeta = ((PotionMeta) ((ThrownPotion) ent).getItem().getItemMeta());
switch (mode) {
case ADD:
Arrays.asList((PotionEffect[]) delta).forEach(eff -> potionMeta.addCustomEffect(eff, true));
break;
case SET:
potionMeta.clearCustomEffects();
Arrays.asList((PotionEffect[]) delta).forEach(eff -> potionMeta.addCustomEffect(eff, true));
break;
case REMOVE:
potionMeta.removeCustomEffect((PotionEffectType) delta[0]);
break;
case DELETE:
potionMeta.clearCustomEffects();
break;
}
item.setItemMeta(potionMeta);
((ThrownPotion) ent).setItem(item);
} else if (ent.getType() == EntityType.TIPPED_ARROW) {
TippedArrow tippedArrow = (TippedArrow) ent;
switch (mode) {
case ADD:
Arrays.asList(((PotionEffect[]) delta)).forEach(eff -> tippedArrow.addCustomEffect(eff, true));
break;
case SET:
tippedArrow.clearCustomEffects();
Arrays.asList(((PotionEffect[]) delta)).forEach(eff -> tippedArrow.addCustomEffect(eff, true));
break;
case REMOVE:
tippedArrow.removeCustomEffect((PotionEffectType) delta[0]);
break;
case DELETE:
tippedArrow.clearCustomEffects();
break;
}
}
}
开发者ID:Syst3ms,项目名称:QuarSK,代码行数:46,代码来源:SExprThrownPotionEffects.java
注:本文中的org.bukkit.entity.TippedArrow类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论