当前位置: 首页>>代码示例>>Java>>正文


Java Arrow.remove方法代码示例

本文整理汇总了Java中org.bukkit.entity.Arrow.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Arrow.remove方法的具体用法?Java Arrow.remove怎么用?Java Arrow.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.entity.Arrow的用法示例。


在下文中一共展示了Arrow.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleFriendlyFire

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void handleFriendlyFire(EntityDamageByEntityEvent event) {
    if(event.isCancelled() && event.getDamager() instanceof Arrow) {
        Arrow arrow = (Arrow) event.getDamager();
        if(arrow.getPickupRule() == Arrow.PickupRule.ALLOWED && arrow.getShooter() != null && arrow.getShooter() instanceof Player){
            Player owner = (Player) arrow.getShooter();
            owner.getInventory().addItem(new ItemStack(Material.ARROW));
            arrow.remove();
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:12,代码来源:FriendlyFireRefundMatchModule.java

示例2: onProjectileHit

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onProjectileHit(ProjectileHitEvent event) {
    Entity entity = event.getEntity();
    if (entity instanceof Arrow) {
        Arrow arrow = (Arrow) entity;
        if (!(arrow.getShooter() instanceof Player) || ((CraftArrow) arrow).getHandle().fromPlayer == 2) {
            arrow.remove();
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:11,代码来源:InfinityArrowFixListener.java

示例3: volley

import org.bukkit.entity.Arrow; //导入方法依赖的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.
}
 
开发者ID:Taiterio,项目名称:ce,代码行数:40,代码来源:Volley.java

示例4: antiArrowSpam

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void antiArrowSpam(ProjectileHitEvent event) {

    // Destroys the Arrows of the Minigun
    if (event.getEntityType().equals(EntityType.ARROW)) {
        Arrow arrow = (Arrow) event.getEntity();
        ProjectileSource shooter = arrow.getShooter();
        if (shooter instanceof Player)
            if (arrow.hasMetadata("ce.minigunarrow"))
                if (((Player) shooter).getGameMode().equals(GameMode.CREATIVE))
                    arrow.remove();
    }

}
 
开发者ID:Taiterio,项目名称:ce,代码行数:15,代码来源:CEListener.java

示例5: onArrowHitBlock

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
private void onArrowHitBlock(HitBlockEvent e) {
	if(!(e.getArrow().getLocation().getWorld().getName() == "Christmas")){
		return;
	}
	Arrow arrow = e.getArrow();
	Bukkit.getWorld("Christmas").playEffect(arrow.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
	arrow.remove();
}
 
开发者ID:EmilHernvall,项目名称:tregmine,代码行数:10,代码来源:GrinchListener.java

示例6: projectiles

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void projectiles(ProjectileHitEvent e) {
	if(e.getEntity() instanceof Arrow) {
		Arrow arrow = (Arrow) e.getEntity();
		if(arrow.getShooter() instanceof Player) {
			if(hasAttachedGlass(arrow.getLocation().getBlock())) {
				storeGlasses(arrow.getLocation().getBlock());
				arrow.remove();
				destroyRandomGlasses();
			}
		}
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:14,代码来源:RealisticGlassEvent.java

示例7: onDamage

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onDamage(EntityDamageByEntityEvent e) {
	if(e.getDamager() instanceof Player) {
		if(e.getEntity() instanceof Player) {
			//Player damager = (Player) e.getDamager();
			//damager.sendMessage(ChatColor.RED + "you are not allowed to pvp on this server!");
			if(!pl.getConfiguration().getPvpConfig().isFakePvpEnabled()) {
				e.setCancelled(true);
			}
		}
	} else if(e.getDamager() instanceof Arrow) {
		Arrow arrow = (Arrow) e.getDamager();
		if(arrow.getShooter() instanceof Player) {
			if(e.getEntity() instanceof Player) {
				//Player damager = (Player) arrow.getShooter();
				//damager.sendMessage(ChatColor.RED + "you are not allowed to pvp on this server!");
				arrow.remove();
				e.setCancelled(true);
			}
		}
	} else if(e.getDamager() instanceof ThrownPotion) {
		ThrownPotion pot = (ThrownPotion) e.getDamager();
		if(pot.getShooter() instanceof Player) {
			if(e.getEntity() instanceof Player) {
				//Player damager = (Player) pot.getShooter();
				//damager.sendMessage(ChatColor.RED + "you are not allowed to pvp on this server!");
				pot.remove();
				e.setCancelled(true);
			}
		}
	}
}
 
开发者ID:xEssentials,项目名称:xEssentials-deprecated-bukkit,代码行数:33,代码来源:PvpEvent.java

示例8: projectiles

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void projectiles(ProjectileHitEvent e) {
	if(e.getEntity() instanceof Arrow) {
		Arrow arrow = (Arrow) e.getEntity();
		if(arrow.getShooter() instanceof Player) {
			if(hasAttachedGlass(arrow.getLocation().getBlock())) {
				storeGlasses(arrow.getLocation().getBlock());
				arrow.remove();
				destroyRandomGlasses();
				startRegen();
			}
		}
	}
}
 
开发者ID:xize,项目名称:xEssentials_old_Source,代码行数:15,代码来源:realisticGlass.java

示例9: perform

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@Override
public void perform()
{
	Block block = getTargetBlock(player, 10);
	if (block == null)
	{
		err(getMessage("chair_no_block"));
		return;
	}

	String seat = FormatUtil.getFriendlyName(block.getType());
	if (! seat.contains("Step") && ! seat.contains("Stair"))
	{
		err(getMessage("chair_not_chair"));
		return;
	}

	PlayerData data = getPlayerData(player);
	data.setPreviousLocation(player.getLocation().clone());
	data.setSatRecently(true);

	Location location = block.getLocation().clone();
	location.add(0.5D, 0.0D, 0.5D);
	location.setPitch(0F);
	location.setYaw(0F);

	Arrow it = (Arrow) player.getWorld().spawnEntity(location, EntityType.ARROW);
	if (! it.addPassenger(player))
	{
		it.remove();
		data.setPreviousLocation(null);
		err(getMessage("chair_error"));
		return;
	}

	sendpMessage(getMessage("chair_now_sitting"), seat);
	sendpMessage(getMessage("chair_standup"), new CmdStandup(plugin).getUsageTemplate(false));
}
 
开发者ID:dmulloy2,项目名称:SwornRPG,代码行数:39,代码来源:CmdSitdown.java

示例10: projectileHit

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
public static void projectileHit(ProjectileHitEvent event) {
	Projectile projectile = event.getEntity();
	if (!(projectile instanceof Arrow)) {
		return;
	}

	Arrow arrow = (Arrow) projectile;
	if (!(arrow.getShooter() instanceof Player)) {
		return;
	}

	if (!arrow.hasMetadata("miningLaser")) {
		return;
	}

	World world = arrow.getWorld();
	BlockIterator iterator = new BlockIterator(world, arrow.getLocation()
			.toVector(), arrow.getVelocity().normalize(), 0, 4);
	Block hitBlock = null;

	while (iterator.hasNext()) {
		hitBlock = iterator.next();
		if (!hitBlock.getType().equals(Material.AIR)) {
			break;
		}
		hitBlock = null;
	}
	if (hitBlock != null) {
		arrow.remove();
		if (!hitBlock.getType().equals(Material.BEDROCK)) {
			if (!ProtectedBlock.protect(hitBlock)) {
				hitBlock.breakNaturally();
			}
		}
	}
}
 
开发者ID:mineglow-network,项目名称:HyperDriveCraft,代码行数:37,代码来源:ParticleCondenserItem.java

示例11: repeat

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@Repeatable(interval = @Time(seconds = 1))
public void repeat() {
    for(Arrow arrow : getMatch().getWorld().getEntitiesByClass(Arrow.class)) {
        if(arrow.getTicksLived() >= this.maxTicks && arrow.getPickupRule() != Arrow.PickupRule.ALLOWED) arrow.remove();
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:ArrowRemovalMatchModule.java

示例12: onCombust

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onCombust(EntityCombustByEntityEvent e) {
	if(!(e.getCombuster() instanceof Arrow)) {
		return;
	}
	Arrow proj = (Arrow) e.getCombuster();
	try {
		KingdomFactionsPlayer player = PlayerModule.getInstance().getPlayer(e.getEntity());
		KingdomFactionsPlayer other = PlayerModule.getInstance().getPlayer(proj.getShooter());
		
		
		if(!WarModule.getInstance().isWarActive()) {
            if(other.getCurrentNexus() instanceof CapitalNexus || player.getCurrentNexus() instanceof CapitalNexus) {
            	e.setCancelled(true);
            	return;
            }
			}
		
		
		
		if (player.hasFaction()) {
			if (other.hasFaction()) {
				if (player.getFaction() == other.getFaction()) {
					e.setCancelled(true);
				 proj.remove();
				} else {
					 player.getCombatTracker().resetCombat();
					 other.getCombatTracker().resetCombat();
					return;
				}
			}
		} else {
			if (other.hasFaction()) {
				return;
			} else {
				if (player.getKingdom() == other.getKingdom()) {
					e.setCancelled(true);
					 proj.remove();
				} else {
					 player.getCombatTracker().resetCombat();
					 other.getCombatTracker().resetCombat();
					return;
				}
			}
		}
	} catch (PlayerException e1) {
		return;
}
}
 
开发者ID:ThEWiZ76,项目名称:KingdomFactions,代码行数:50,代码来源:PvPManager.java

示例13: onProjectileHit

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onProjectileHit(ProjectileHitEvent event) { // RageArrow
														// explosion event
	if (event.getEntity() instanceof Arrow) {
		Arrow arrow = (Arrow) event.getEntity();
		if (arrow.getShooter() instanceof Player) {
			Player shooter = (Player) arrow.getShooter();
			if (PlayerList.isPlayerPlaying(shooter.getUniqueId().toString())) {
				if (waitingGames.containsKey(PlayerList.getPlayersGame(shooter))) {
					if (waitingGames.get(PlayerList.getPlayersGame(shooter))) {
						return;
					}
				}

				Location location = arrow.getLocation();
				World world = arrow.getWorld();
				double x = location.getX();
				double y = location.getY();
				double z = location.getZ();

				List<Entity> nears = arrow.getNearbyEntities(10, 10, 10);

				world.createExplosion(x, y, z, 2f, false, false); // original
																	// 4f
				arrow.remove();

				int i = 0;
				int imax = nears.size();
				while (i < imax) {
					if (nears.get(
							i) instanceof Player /*
													 * && !nears.get(i).
													 * getUniqueId().
													 * toString().equals(
													 * shooter.getUniqueId()
													 * .toString())
													 */) {
						Player near = (Player) nears.get(i);
						if (explosionVictims != null) {
							if (explosionVictims.containsKey(near.getUniqueId())) {
								explosionVictims.remove(near.getUniqueId());
								explosionVictims.put(near.getUniqueId(), shooter.getUniqueId());
							}
						}
						explosionVictims.put(near.getUniqueId(), shooter.getUniqueId());
					}
					i++;
				}
			}
		}
	}
}
 
开发者ID:KWStudios,项目名称:RageMode,代码行数:53,代码来源:EventListener.java

示例14: destroy

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
public void destroy(Arrow arrow) {
	arrow.remove();
	this.arrow = null;
	CivCache.arrowsFired.remove(this.getUUID());
	this.uuid = null;
}
 
开发者ID:netizen539,项目名称:civcraft,代码行数:7,代码来源:ArrowFiredCache.java

示例15: onEntityDamageByEntity

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {		
	
	if (event.getDamager().getType().equals(EntityType.ARROW)) {
		
		Arrow arrow = (Arrow) event.getDamager();

		if (arrow.hasMetadata("no_pickup")) {
			
			double damage = 0;
			
			boolean anyDamage = false;
			
			List<MetadataValue> values = arrow.getMetadata("damage");
			
			for (MetadataValue value : values) {
				
				if (value.getOwningPlugin() == Main.getPluginMain()) {
					
					damage = Double.parseDouble(value.value().toString());
					
					anyDamage = true;
					
				}
				
			}
			
			if (anyDamage) {
				
				event.setDamage(damage);
				
			}
			
			arrow.remove();
			
		}
		
	}
	
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:41,代码来源:Events.java


注:本文中的org.bukkit.entity.Arrow.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。