本文整理汇总了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();
}
}
}
示例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();
}
}
}
示例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.
}
示例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();
}
}
示例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();
}
示例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();
}
}
}
}
示例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);
}
}
}
}
示例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();
}
}
}
}
示例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));
}
示例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();
}
}
}
}
示例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();
}
}
示例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;
}
}
示例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++;
}
}
}
}
}
示例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;
}
示例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();
}
}
}