本文整理汇总了Java中org.bukkit.event.entity.EntityShootBowEvent.getProjectile方法的典型用法代码示例。如果您正苦于以下问题:Java EntityShootBowEvent.getProjectile方法的具体用法?Java EntityShootBowEvent.getProjectile怎么用?Java EntityShootBowEvent.getProjectile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.entity.EntityShootBowEvent
的用法示例。
在下文中一共展示了EntityShootBowEvent.getProjectile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBowShot
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler
public void onBowShot(EntityShootBowEvent e) {
if (e.getEntity() instanceof Player &&
e.getProjectile() instanceof Arrow) {
Bukkit.getScheduler().runTaskLater(this, () -> {
if (!e.getProjectile().isDead()) {
EntityTrail t = new EntityTrail(this, e.getProjectile(),
new ScatteringSupplier(particles,
new Vector3(2.0f, 1.0f, 2.0f),
Vector3.ORIGIN, 5, 20, 1)
, 1);
trails.put(e.getProjectile(), t);
t.begin();
}
}, 5L);
}
}
示例2: onBowShot
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler
public void onBowShot(EntityShootBowEvent e) {
if (e.getEntity() instanceof Player &&
e.getProjectile() instanceof Arrow) {
Bukkit.getScheduler().runTaskLater(this, () -> {
if (!e.getProjectile().isDead()) {
EntityTrail t = new EntityTrail(this, e.getProjectile(),
new CircumferenceSupplier(particle, 1.2f, 0.9f, 0.0f, 1)
.rotateY(tick -> tick * (2.0f * (float) Math.PI / 20))
, 1);
trails.put(e.getProjectile(), t);
t.begin();
}
}, 5L);
}
}
示例3: onShotArrow
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler
public void onShotArrow(EntityShootBowEvent event)
{
if(event.getEntity() instanceof Player){
Player p = (Player)event.getEntity();
if(event.getProjectile() instanceof Arrow){
Arena a = am.getArena(p);
if(a!=null){
if(a.isGame()){
SPlayer player = SPlayer.getDPlayer(p);
player.addShots(1);
}
}
}
}
}
示例4: onShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的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);
}
}
}
示例5: 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()));
}
示例6: onEntityShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityShootBow (EntityShootBowEvent event)
{
if ( ! (event.getEntity() instanceof Player))
return;
if (plugin.getConfig().getBoolean("general.particle-trail")
&& event.getProjectile() instanceof Arrow)
{
plugin.addArrow((Arrow) event.getProjectile());
plugin.updateEffectMaker();
}
Player player = (Player) event.getEntity();
if ( !player.hasPermission("headshot.bypass.reload-time"))
{
long cooldown =
plugin.getConfig().getLong("general.reload-time", 0) * 50;
if (cooldown == 0)
return;
plugin.setCooldown(player, System.currentTimeMillis() + cooldown);
}
}
示例7: onEntityShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
private void onEntityShootBow(EntityShootBowEvent event) {
// Return for disabled world
if (Zones.inNoDemigodsZone(event.getEntity().getLocation())) return;
// If they right clicked a block with the ITEM in hand, do stuff
if (Items.areEqual(event.getBow(), ITEM)) {
PlayerInventory inventory = null;
Arrow startArrow = (Arrow) event.getProjectile();
startArrow.setVelocity(startArrow.getVelocity().multiply(.8));
if (event.getEntity() instanceof Player) inventory = ((Player) event.getEntity()).getInventory();
for (int i = 1; i < 3; i++) {
if (inventory != null) {
if (!inventory.contains(Material.ARROW, 1)) break;
inventory.remove(new ItemStack(Material.ARROW, 1));
}
Arrow spawnedArrow = (Arrow) event.getEntity().getWorld().spawnEntity(startArrow.getLocation(), EntityType.ARROW);
spawnedArrow.setShooter(event.getEntity());
spawnedArrow.setVelocity(startArrow.getVelocity().multiply(.9 / i));
}
}
}
示例8: trail
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler
public void trail(EntityShootBowEvent paramEntityShootBowEvent)
{
LivingEntity localLivingEntity = paramEntityShootBowEvent.getEntity();
Entity localEntity = paramEntityShootBowEvent.getProjectile();
if ((localEntity instanceof Projectile))
{
final Projectile localProjectile = (Projectile)localEntity;
if (((localProjectile instanceof Arrow)) && ((localLivingEntity instanceof Player)))
{
Player localPlayer = (Player)localLivingEntity;
Arena a = new ArenaManager().getArena(localPlayer);
if(a==null){
return;
}
if(!retornar(localPlayer)){
return;
}
ParticleEffect localParticleEffect = effect(localPlayer);
final float f1 = 0.3F;
final float f2 = 0.3F;
final float f3 = 0.3F;
final float f4 = 0.3F;
final int i = 20;
final double d = 20.0D;
ArrowTrailSender(f1, f2, f3, f4, i, i, localParticleEffect, localProjectile, d);
}
}
}
示例9: onEntityShootBow
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler
public void onEntityShootBow (EntityShootBowEvent event) {
if (event.getEntity() instanceof Player && event.getProjectile() instanceof Arrow) {
if(hitPlayers.containsKey(event.getEntity())){
hitPlayers.put((Player) event.getEntity(), hitPlayers.get(event.getEntity()) + 1);
}
else{
hitPlayers.put((Player) event.getEntity(), 1);
}
((Player) event.getEntity()).getInventory().getItemInMainHand().setDurability((short) -1);
}
}
示例10: a
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
public void a(EntityLiving entityliving, float f) {
// EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float)(14 - this.world.getDifficulty().a() * 4));
EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 0);
int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bz());
int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bz());
entityarrow.b((double)(f * 2.0F) + this.random.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().a() * 0.11F));
if(i > 0) {
entityarrow.b(entityarrow.j() + (double)i * 0.5D + 0.5D);
}
if(j > 0) {
entityarrow.setKnockbackStrength(j);
}
if(EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bz()) > 0 || this.getSkeletonType() == 1) {
EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
this.world.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()) {
entityarrow.setOnFire(event.getDuration());
}
}
EntityShootBowEvent event1 = CraftEventFactory.callEntityShootBowEvent(this, this.bz(), entityarrow, 0.8F);
if(event1.isCancelled()) {
event1.getProjectile().remove();
} else {
if(event1.getProjectile() == entityarrow.getBukkitEntity()) {
this.world.addEntity(entityarrow);
}
this.makeSound("random.bow", 1.0F, 1.0F / (this.bb().nextFloat() * 0.4F + 0.8F));
}
}
示例11: a
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
public void a(EntityLiving entityliving, float f) {
// EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float)(14 - this.world.getDifficulty().a() * 4));
EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 0);
int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bA());
int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bA());
entityarrow.b((double)(f * 2.0F) + this.random.nextGaussian() * 0.25D + (double)((float)this.world.getDifficulty().a() * 0.11F));
if(i > 0) {
entityarrow.b(entityarrow.j() + (double)i * 0.5D + 0.5D);
}
if(j > 0) {
entityarrow.setKnockbackStrength(j);
}
if(EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bA()) > 0 || this.getSkeletonType() == 1) {
EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
this.world.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()) {
entityarrow.setOnFire(event.getDuration());
}
}
EntityShootBowEvent event1 = CraftEventFactory.callEntityShootBowEvent(this, this.bA(), entityarrow, 0.8F);
if(event1.isCancelled()) {
event1.getProjectile().remove();
} else {
if(event1.getProjectile() == entityarrow.getBukkitEntity()) {
this.world.addEntity(entityarrow);
}
this.makeSound("random.bow", 1.0F, 1.0F / (this.bc().nextFloat() * 0.4F + 0.8F));
}
}
示例12: volley
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
private void volley(EntityShootBowEvent e, ItemStack item, int lvl) {
Player p = (Player) e.getEntity();
int amount = 1 + 2 * lvl; // Keep amount of arrows uneven, 2 extra arrows in a volley per level.
Arrow oldArrow = (Arrow) e.getProjectile();
int fireTicks = oldArrow.getFireTicks();
int knockbackStrength = oldArrow.getKnockbackStrength();
boolean critical = oldArrow.isCritical();
String metadata = oldArrow.getMetadata("ce.bow.enchantment").get(0).asString();
double angleBetweenArrows = (CONE_DEGREES / (amount - 1)) * Math.PI / 180;
double pitch = (p.getLocation().getPitch() + 90) * Math.PI / 180;
double yaw = (p.getLocation().getYaw() + 90 - CONE_DEGREES / 2) * Math.PI / 180;
// Starting direction values for the cone, each arrow increments it's direction on these values.
double sZ = Math.cos(pitch);
for (int i = 0; i < amount; i++) { // spawn all arrows in a cone of 90 degrees (equally distributed).;
double nX = Math.sin(pitch) * Math.cos(yaw + angleBetweenArrows * i);
double nY = Math.sin(pitch) * Math.sin(yaw + angleBetweenArrows * i);
Vector newDir = new Vector(nX, sZ, nY);
Arrow arrow = p.launchProjectile(Arrow.class);
arrow.setShooter(p);
arrow.setVelocity(newDir.normalize().multiply(oldArrow.getVelocity().length())); // Need to make sure arrow has same speed as original arrow.
arrow.setFireTicks(fireTicks); // Set the new arrows on fire if the original one was
arrow.setKnockbackStrength(knockbackStrength);
arrow.setCritical(critical);
if (i == 0) {
if (p.getGameMode().equals(GameMode.CREATIVE))
arrow.setMetadata("ce.Volley", new FixedMetadataValue(getPlugin(), null)); //Control metadata to prevent players from duplicating arrows
} else {
arrow.setMetadata("ce.Volley", new FixedMetadataValue(getPlugin(), null)); //Control metadata to prevent players from duplicating arrows
}
arrow.setMetadata("ce.bow.enchantment", new FixedMetadataValue(getPlugin(), metadata));
}
oldArrow.remove(); // Remove original arrow.
}
示例13: onShoot
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler
public void onShoot(final EntityShootBowEvent event)
{
final Entity e = event.getEntity();
final Projectile p = (Projectile) event.getProjectile();
new BukkitRunnable()
{
@Override
public void run()
{
// .-.
p.getWorld().playEffect(p.getLocation(), Effect.SMOKE, 5);
if (event.getProjectile().isOnGround() || event.getProjectile().isDead())
{
cancel(); //Cancels the timer
p.getWorld().playSound(p.getLocation(), Sound.FIZZ, 3, 1);
}
}
}.runTaskTimer(plugin, 0L /* The amount of time until the timer starts */, 2L /* The delay of each call */);
createArrows(e, p);
}
示例14: ArrowShot
import org.bukkit.event.entity.EntityShootBowEvent; //导入方法依赖的package包/类
@EventHandler
public void ArrowShot(EntityShootBowEvent event){
if ((!(event.getEntity() instanceof Player)) || (!(event.getProjectile() instanceof Arrow))) {
return;
}
Player player = (Player)event.getEntity();
Arrow arrow = (Arrow)event.getProjectile();
AbilitiesManager.runBlazingArrows(player.getUniqueId(), arrow);
}
示例15: 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 }));
}
}
}
}