use of org.bukkit.entity.TippedArrow in project RedProtect by FabioZumbi12.
the class RPMine19 method onShootBow.
@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);
}
}
}
use of org.bukkit.entity.TippedArrow in project Glowstone by GlowstoneMC.
the class NormalTippedArrowStore method save.
@Override
public void save(GlowArrow entity, CompoundTag tag) {
super.save(entity, tag);
if (entity instanceof TippedArrow) {
PotionData potion = ((TippedArrow) entity).getBasePotionData();
if (potion != null) {
tag.putString(POTION, GlowMetaPotion.dataToString(potion));
}
tag.putCompoundList(CUSTOM_POTION_EFFECTS, ((TippedArrow) entity).getCustomEffects().stream().map(GlowMetaPotion::toNbt).collect(Collectors.toList()));
}
}
use of org.bukkit.entity.TippedArrow in project Glowstone by GlowstoneMC.
the class NormalTippedArrowStore method load.
@Override
public void load(GlowArrow entity, CompoundTag tag) {
super.load(entity, tag);
if (entity instanceof TippedArrow) {
TippedArrow tippedArrow = (TippedArrow) entity;
tag.readInt(COLOR, rgb -> tippedArrow.setColor(Color.fromRGB(rgb)));
// TODO: POTION
tag.readCompoundList(CUSTOM_POTION_EFFECTS, list -> list.stream().map(GlowMetaPotion::fromNbt).forEach(effect -> tippedArrow.addCustomEffect(effect, false)));
}
}
Aggregations