本文整理汇总了Java中org.bukkit.event.entity.EntityShootBowEvent.getBow方法的典型用法代码示例。如果您正苦于以下问题:Java EntityShootBowEvent.getBow方法的具体用法?Java EntityShootBowEvent.getBow怎么用?Java EntityShootBowEvent.getBow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.entity.EntityShootBowEvent
的用法示例。
在下文中一共展示了EntityShootBowEvent.getBow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEntityShootBowEvent
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onEntityShootBowEvent(EntityShootBowEvent event) {
if ((event.getBow().hasItemMeta() && event.getBow().getItemMeta().getDisplayName().equals("Ender bow")) || event
.getBow() instanceof EnderBowPlugin.EnderBow) {
// Create custom event
EntityShootEnderBowEvent entityShootEnderBowEvent = new EntityShootEnderBowEvent(event);
// Call the custom event
EnderBowPlugin.getInstance().getServer().getPluginManager().callEvent(entityShootEnderBowEvent);
// Do the following, if it wasn't cancelled
if (!entityShootEnderBowEvent.isCancelled()) {
// Fire an ender pearl
event.getEntity().launchProjectile(EnderPearl.class).setVelocity(event.getProjectile().getVelocity());
// Play the 'ENDERMAN_TELEPORT' sound
event.getEntity().getWorld().playSound(event.getEntity().getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1);
}
// Cancel the original Event, so no arrows are fired
event.setCancelled(true);
}
}
示例2: onEntityShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityShootBow(EntityShootBowEvent event) {
Entity projectile = event.getProjectile();
if (!(projectile instanceof Arrow)) {
return;
}
ItemStack bow = event.getBow();
if (bow != null && bow.containsEnchantment(Enchantment.ARROW_INFINITE)) {
projectile.setMetadata(mcMMO.infiniteArrowKey, mcMMO.metadataValue);
}
projectile.setMetadata(mcMMO.bowForceKey, new FixedMetadataValue(plugin, Math.min(event.getForce() * AdvancedConfig.getInstance().getForceMultiplier(), 1.0)));
projectile.setMetadata(mcMMO.arrowDistanceKey, new FixedMetadataValue(plugin, projectile.getLocation()));
}
示例3: entityShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler
private void entityShootBow(EntityShootBowEvent event) {
if (event.getEntity() instanceof Player) {
Player player = (Player) event.getEntity();
CustomItem customItem = CustomItemManager.getCustomItem(event.getBow());
if (verifyCustomItem(customItem, player, false)) {
DelayedPlayerDetails details = new DelayedPlayerDetails(event.getBow(), player);
((CustomBow) customItem).onShootBow(event, details);
if (!event.isCancelled() && event.getProjectile() instanceof Projectile) {
details.lock();
event.getProjectile().setMetadata("CustomItem-bow", new FixedMetadataValue(CustomItemManager._plugin, new Object[] { customItem, details }));
}
}
}
}
示例4: onShoot
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler
public void onShoot(EntityShootBowEvent event)
{
if(event.getEntity() instanceof Player)
{
Player player = (Player)event.getEntity();
ItemStack mainItem = event.getBow();
if(mainItem.getItemMeta().getLore() != null)
{
Random rand = new Random();
if(event.getForce() >= 1.0F)
{
final Entity arrow = event.getProjectile();
final Vector velocity = player.getLocation().getDirection().add(new Vector(0, 0.025, 0)).multiply(4);
arrow.setVelocity(velocity);
player.getWorld().playSound(player.getLocation(), Sound.BLOCK_LEVER_CLICK, 1.0F, rand.nextFloat() * 0.4F + 0.8F);
player.getWorld().playSound(player.getLocation(), Sound.ENTITY_SHULKER_BULLET_HURT, 0.5F, rand.nextFloat() * 0.4F + 0.8F);
final Runnable task = new Runnable()
{
int times = 4;
public void run()
{
if(!arrow.isOnGround())
{
arrow.setVelocity(velocity);
if(times-- > 0)
Bukkit.getScheduler().scheduleSyncDelayedTask(Survival.instance, this, 5);
}
}
};
Bukkit.getScheduler().scheduleSyncDelayedTask(Survival.instance, task, -1);
}
else
{
event.setCancelled(true);
player.getWorld().playSound(player.getLocation(), Sound.BLOCK_LEVER_CLICK, 0.5F, rand.nextFloat() * 0.4F + 0.8F);
}
}
}
}
示例5: EntityShootEnderBowEvent
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
public EntityShootEnderBowEvent(EntityShootBowEvent event) {
this(event.getEntity(), event.getBow(), event.getForce());
}
示例6: onEntityBowShoot
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityBowShoot(EntityShootBowEvent event) {
if (event.getBow() != null && event.getBow().containsEnchantment(Enchantment.ARROW_DAMAGE) && event.getBow().getEnchantmentLevel(Enchantment.ARROW_DAMAGE) > 1) {
event.getProjectile().setMetadata("rage", new FixedMetadataValue(GameHandler.getGameHandler().getPlugin(), true));
}
}