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


Java Arrow.getShooter方法代码示例

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


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

示例1: onDamage

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onDamage(EntityDamageByEntityEvent event)
{
	Player player = null;
	
	if(!(event.getDamager() instanceof Player))
	{
		if(event.getDamager() instanceof Arrow)
		{
			Arrow arrow = (Arrow) event.getDamager();
			
			if(arrow.getShooter() instanceof Player)
			{
				player = (Player) arrow.getShooter();
			}
		}else return;
	}else player = (Player) event.getDamager();
	
	if(player != null && (userManager.get(player.getUniqueId()).isFrozen() || (!options.modeDamage && modeCoordinator.isInMode(player.getUniqueId()))))
	{
		event.setCancelled(true);
	}
}
 
开发者ID:Shortninja66,项目名称:StaffPlus,代码行数:24,代码来源:EntityDamageByEntity.java

示例2: onDamage

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onDamage(EntityDamageByEntityEvent event) {
	if ((event.getEntity() instanceof Player)) {
		if ((event.getDamager() instanceof Player)) {
			playerAttacksPlayer((Player) event.getEntity(),
					(Player) event.getDamager());
			return;
		}
		if ((event.getDamager() instanceof Arrow)) {
			Arrow a = (Arrow) event.getDamager();
			if ((a.getShooter() instanceof Player)) {
				playerAttacksPlayer((Player) event.getEntity(),
						(Player) a.getShooter());
				return;
			}
		}
		this.n = null;
	}
}
 
开发者ID:Blackixx,项目名称:CommandRank,代码行数:20,代码来源:PlayerListener.java

示例3: onPlayerShoot

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerShoot(EntityDamageByEntityEvent evt) {

	Player damager = null;
	
	if (evt.getDamager() instanceof Arrow) {
		Arrow arrow = (Arrow)evt.getDamager();
					
		if (arrow.getShooter() instanceof Player) {
			damager = (Player)arrow.getShooter();
		}
	} else if (evt.getDamager() instanceof Player) {
		damager = (Player)evt.getDamager();
	}
	
	if (damager != null && perkService.playerHasPerk(damager, ArcherTree.FindWeaknessId)) {
		if (evt.getEntity() instanceof LivingEntity) {
			LivingEntity le = (LivingEntity)evt.getEntity();					
			le.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 5*20, 1));
		}
	}
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:23,代码来源:FindWeaknessPerk.java

示例4: onShoot

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled=1, priority=EventPriority.MONITOR)
public void onShoot(ProjectileLaunchEvent e) {
    Player player;
    Arrow arrow;
    if (e.getEntity() instanceof Arrow && (arrow = (Arrow)e.getEntity()).getShooter() != null && arrow.getShooter() instanceof Player && this.bowPull.containsKey((player = (Player)arrow.getShooter()).getUniqueId())) {
        Long time = System.currentTimeMillis() - this.bowPull.get(player.getUniqueId());
        double power = arrow.getVelocity().length();
        Long timeLimit = 300;
        int ping = this.getJanitor().lag.getPing(player);
        if (ping > 400) {
            timeLimit = 150;
        }
        if (power > 2.5 && time < timeLimit) {
            this.getJanitor().logCheat(this, player, null, new String[0]);
        }
    }
}
 
开发者ID:cumpe,项目名称:Janitor,代码行数:18,代码来源:FastBow.java

示例5: onDefense

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@Override
public void onDefense(EntityDamageByEntityEvent event) {
	double damage = event.getDamage();
	
	damage -= this.defense;
	if (damage < 0.5) {
		damage = 0.0;
		
		Player player = null;
		if (event.getDamager() instanceof Arrow) {
			Arrow arrow = (Arrow)event.getDamager();
			if (arrow.getShooter() instanceof Player) {
				player = (Player)arrow.getShooter();
			}
		} else if (event.getDamager() instanceof Player){
			player = (Player)event.getDamager();
		}
		
		if (player != null) {
			CivMessage.send(player, CivColor.LightGray+"Our attack was ineffective");
		}
	}
	event.setDamage(damage);
}
 
开发者ID:netizen539,项目名称:civcraft,代码行数:25,代码来源:MobComponentDefense.java

示例6: 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

示例7: 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

示例8: arrowFireEvent

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void arrowFireEvent(ProjectileLaunchEvent event){
	if(event.getEntity() instanceof Arrow){
		Arrow arrow = (Arrow) event.getEntity();
		if(arrow.getShooter() instanceof Player){
			Player player = (Player) arrow.getShooter();
			ItemStack item = player.getInventory().getItemInMainHand();
			if(new ItemType(item).getType().equals(ItemTypes.BOW)){
				Bow detailItem = new Bow(item);
					if(detailItem.getEnchantsAndLevel() != null){
						HashMap<Enchantments, Integer> enchantments = detailItem.getEnchantsAndLevel();
						if(enchantments.containsKey(Enchantments.VOLLEY)){
							for(int i = 0; i < 10; i++){
								Arrow newArrow = player.getWorld().spawnArrow(
										player.getLocation().add(player.getLocation().getDirection()).add(0, 2, 0),
										player.getLocation().getDirection().normalize().multiply(2),
										(float) 2,
										12);
								if(arrow.isCritical()){
									newArrow.setCritical(true);
								}
							}
						}
						return;
					}
			}
		}
	}
}
 
开发者ID:DamoclesProject,项目名称:Damocles,代码行数:30,代码来源:Volley.java

示例9: onPlayerShoot

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerShoot(EntityDamageByEntityEvent evt) {
	Player damager = null;
	
	if (evt.getDamager() instanceof Arrow) {
		Arrow arrow = (Arrow)evt.getDamager();
		if (arrow.getShooter() instanceof Player) {
			damager = (Player)arrow.getShooter();
		}
	}
	
	if (damager != null) {// && perkService.playerHasPerk((Player)damager, ArcherTree.LeatherExpertId)) {
		PlayerInventory inventory = damager.getInventory();
		ItemStack[] armorContents = inventory.getArmorContents();
		
		double damageBoost = 1;
		
		for(ItemStack armor : armorContents) {
			if (armor.getType().equals(Material.LEATHER_BOOTS)) {
				damageBoost += 0.10;
			} else if (armor.getType().equals(Material.LEATHER_CHESTPLATE)) {
				damageBoost += 0.10;
			} else if (armor.getType().equals(Material.LEATHER_HELMET)) {
				damageBoost += 0.10;
			} else if (armor.getType().equals(Material.LEATHER_LEGGINGS)) {
				damageBoost += 0.10;
			}
		}
		
		if (damageBoost == 0.4) {
			damageBoost = 0.5;
		}
		
		int baseDamage = evt.getDamage();
		int finalDamage = (int) (baseDamage * damageBoost); 
		evt.setDamage(finalDamage);
	}
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:39,代码来源:LeatherExpertPerk.java

示例10: onPlayerShoot

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL)
public void onPlayerShoot(EntityDamageByEntityEvent evt) {

	if (evt.getDamager() instanceof Arrow) {
		Arrow arrow = (Arrow)evt.getDamager();
		
		if (arrow.getShooter() instanceof Player && perkService.playerHasPerk((Player)arrow.getShooter(), ArcherTree.PoisonedArrowId)) {
			if (evt.getEntity() instanceof LivingEntity) {
				LivingEntity le = (LivingEntity)evt.getEntity();					
				le.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 5*20, 1));
			}
		}
	}
	
}
 
开发者ID:Allov,项目名称:world-of-icerealm,代码行数:16,代码来源:PoisonedArrowPerk.java

示例11: onProjectileThrownEvent

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onProjectileThrownEvent(ProjectileLaunchEvent e) {
	  if((e.getEntity() instanceof Snowball)){
		  Snowball snowball = (Snowball) e.getEntity();
		  if(!(snowball.getShooter() instanceof Player)) return;
		  snowballs.get(snowball.getShooter()).addSnowball(snowball);
	  }
	  else if (e.getEntity() instanceof Arrow) {
		Arrow a = (Arrow) e.getEntity();
		if(!(a.getShooter() instanceof Player)) return;
		arrows.add(a);
	}
	  return;
	  
}
 
开发者ID:letsgo00,项目名称:CubeKrowd-Icerunner,代码行数:16,代码来源:Game.java

示例12: onEntityInteract

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onEntityInteract(EntityInteractEvent event){
	if(event.getBlock().getType() == Material.WOOD_BUTTON){
		if(event.getEntity() instanceof Arrow){
			Arrow a = (Arrow) event.getEntity();
			if(a.getShooter() instanceof Player){
				Player p = (Player) a.getShooter();
				if(!canBuild(p, event.getBlock())){
					event.setCancelled(true);
				}
			}
		}
		
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:16,代码来源:ButtonBlocker.java

示例13: onArrowHit

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onArrowHit(EntityDamageByEntityEvent event){
	if(event.getDamager() instanceof Arrow){
		Arrow a = (Arrow) event.getDamager();
		if(a.getShooter() instanceof Skeleton && event.getEntity() instanceof Skeleton){
			Skeleton s1 = (Skeleton) a.getShooter();
			Skeleton s2 = (Skeleton) event.getEntity();
			if(DroneShocktroop.isPossiblyShocktroop(s1) && DroneShocktroop.isPossiblyShocktroop(s2)){
				event.setCancelled(true);
			}
		}
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:14,代码来源:SQSkywatch.java

示例14: onEntityDamageByEntity

import org.bukkit.entity.Arrow; //导入方法依赖的package包/类
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) { // Triggered whenever an entity damages another entity
    if(!(e.getEntity() instanceof Player)) {
        // Victim is not a player
        return;
    }
 
    // Cast victim
    Player victim = (Player) e.getEntity();
 
    // Create an empty player object to store attacker
    Player attacker = null;
 
    if(e.getDamager() instanceof Player) {
        // Attacker is a player (melee damage)
        attacker = (Player) e.getDamager();
    } else if(e.getDamager() instanceof Arrow) {
        // Attacker is an arrow (projectile damage)
        Arrow arrow = (Arrow) e.getDamager();
        if(!(arrow.getShooter() instanceof Player)) {
            // Arrow was not fired by a player
            return;
        }
        // Cast attacker
        attacker = (Player) arrow.getShooter();
    } 
 
    // Check the teams
    if(sameTeam(victim, attacker)) {
        e.setCancelled(true);
    }
}
 
开发者ID:BlackPenSoftware,项目名称:ClanVsClan,代码行数:33,代码来源:clan.java

示例15: 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


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