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


Java Snowball.getShooter方法代码示例

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


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

示例1: projectilehit

import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler
public void projectilehit(EntityDamageByEntityEvent e){
	if((e.getEntity() instanceof Player) && (e.getDamager() instanceof Snowball)){
		Player hitp = (Player) e.getEntity();
		
		if(GadgetManager.isImmune(hitp.getName())){
			Snowball s = (Snowball) e.getDamager();
			Player shooter = (Player) s.getShooter();
			
			shooter.sendMessage(ChatColor.BLUE + "Hub > " 
			+ ChatColor.GRAY + "Player " + ChatColor.RED + hitp.getName() + ChatColor.GRAY
			+ " is not playing hub games!");
			return;
		}
		if(hit.contains(hitp.getName()))
				return;
		
		doSnowBallHit(hitp);
	}
}
 
开发者ID:devBuzzy,项目名称:Dexoria-Hub,代码行数:21,代码来源:SnowGun.java

示例2: onProjectileHit

import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler
public void onProjectileHit(ProjectileHitEvent event) {

	Entity entity = event.getEntity();

	// Config
	float size = plugin.getConfig().getInt("Size of Explosion");
	boolean damage = plugin.getConfig().getBoolean("Block Damage");
	boolean fire = plugin.getConfig().getBoolean("Set Fire");

	if (entity instanceof Snowball) {
		Snowball snowball = (Snowball) entity;
		Entity shooter = snowball.getShooter();

		if (shooter instanceof Player) {
			Player player = (Player) shooter;
			Location sb = snowball.getLocation();

			if (plugin.players.contains(player.getName())) {
				player.getWorld().createExplosion(sb.getX(), sb.getY(),
						sb.getZ(), size, fire, damage);
			}
		}
	}
}
 
开发者ID:ddarkpolice,项目名称:bukkit_ESB,代码行数:26,代码来源:SBListener.java

示例3: onDamage

import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onDamage(EntityDamageByEntityEvent event) {
    // 处理实体受伤是实体所为事件
    Entity entity = event.getEntity();
    Entity damager = event.getDamager();

    if(damager instanceof Snowball) {
        Snowball snowball = (Snowball) damager;
        if(snowball.getShooter() instanceof Player) {
            event.setDamage(10d);
        }
    }
}
 
开发者ID:lgou2w,项目名称:scp,代码行数:14,代码来源:PlayerInteractListener.java

示例4: onProjectileThrownEvent

import org.bukkit.entity.Snowball; //导入方法依赖的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

示例5: onTP

import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler
public void onTP(ProjectileHitEvent e){
	Projectile proj = e.getEntity();

if(this.getConfig().getBoolean("teleporting-snowballs") == true){	
	if(proj instanceof Snowball){
		Snowball sb = (Snowball) proj;
		if(sb.getShooter() instanceof Player){
			LivingEntity p = (Player) sb.getShooter();
			p.teleport(sb);
			}
	}
		}
	}
 
开发者ID:Eelek,项目名称:SnowballTeleporter,代码行数:15,代码来源:SnowballTeleporterMain.java

示例6: onSnowballHit

import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler(priority=EventPriority.LOW)
public void onSnowballHit(EntityDamageByEntityEvent event) {
	if (event.getDamager() instanceof org.bukkit.entity.Snowball && event.getEntity() instanceof Player) {
		Snowball ball = (Snowball) event.getDamager();
		if (ball.getShooter() instanceof Player) {
			Player player = (Player) ball.getShooter();
			if (isFiring.contains(player.getName()))
				event.setDamage(RodsTwo.getInstance().rodConfig.getInt(getPath("options.damage_per_shot")));
		}
	}
}
 
开发者ID:EvilKanoa,项目名称:RodsTwo,代码行数:12,代码来源:Minigun.java

示例7: onEntityDamage

import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent e) {
	if (e.getEntity() instanceof Player && e.getDamager() instanceof Snowball) {
		Player p = (Player) e.getEntity();
		Snowball s = (Snowball) e.getDamager();
		
		if (!(s.getShooter() instanceof Player)) return;
		Player shooter = (Player) s.getShooter();
		
           if (ArenaManager.getInstance().getArena(p) == null && ArenaManager.getInstance().getArena(shooter) == null) return;
           Arena a = ArenaManager.getInstance().getArena(p);
		if (a.getTeam(p) == a.getTeam(shooter)) return;
		p.damage(5.0);
	}
}
 
开发者ID:wdolezal5,项目名称:Romball,代码行数:16,代码来源:SnowballListener.java

示例8: onEntityDamage

import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@EventHandler
public void onEntityDamage(EntityDamageByEntityEvent e) {
	if (e.getEntity() instanceof Player && e.getDamager() instanceof Snowball) {
		Player p = (Player) e.getEntity();
		Snowball s = (Snowball) e.getDamager();
		
		if (!(s.getShooter() instanceof Player)) return;
		Player shooter = (Player) s.getShooter();
		
		if (ArenaManager.getInstance().getArena(p) == null && ArenaManager.getInstance().getArena(shooter) == null) return;
		Arena a = ArenaManager.getInstance().getArena(p);
		if (a.getTeam(p) == a.getTeam(shooter)) return;
		p.damage(5.0);
	}
}
 
开发者ID:nrubin29,项目名称:pogoball,代码行数:16,代码来源:SnowballListeners.java

示例9: onSnowballHit

import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onSnowballHit(ProjectileHitEvent e) {
	// If it's a snowball...
	if (e.getEntity() instanceof Snowball) {
		Snowball snowball = (Snowball) e.getEntity();

		// ...if a player threw it...
		if (snowball.getShooter() instanceof Player) {
			// Make a Player from the Entity
			Player shooter = (Player) snowball.getShooter();

			// ...if the player is in a game...
			if (shooter.hasMetadata("team")) {

				// Loop through the games
				for (Entry<String, PaintWarGame> e1 : games.entrySet()) {
					// Make a game
					PaintWarGame game = e1.getValue();

					// If the Player is in this game...
					if (game.IsInGame(shooter)) {
						// Make a WE selection
						CuboidSelection s = new CuboidSelection(game.GetWorld(), game.GetMinLocationLoc(),
								game.GetMaxLocationLoc());

						// This is used to find the right block
						BlockIterator iterator = new BlockIterator(e.getEntity().getWorld(),
								e.getEntity().getLocation().toVector(), e.getEntity().getVelocity().normalize(),
								0.0D, 4);

						// Make a block
						Block hitBlock = null;

						// Loop through possible blocks
						while (iterator.hasNext()) {
							// Set the hitBlock to the current block we're
							// checking
							hitBlock = iterator.next();

							// If it's not air, STOP!
							if (!hitBlock.getType().equals(Material.AIR)) {
								break;
							}
						}

						// If the block is on the ground of the WE
						// selection...
						if (s.contains(hitBlock.getLocation())
								&& hitBlock.getLocation().getY() == s.getMinimumPoint().getY()) {
							// Set it to stained clay
							hitBlock.setType(Material.STAINED_CLAY);

							// red = 14, blue = 11 (data values)
							// Change block to team color
							if (shooter.getMetadata("team").get(0).asString().equalsIgnoreCase("red")) {
								// Red
								hitBlock.setData((byte) 14);
								game.AddScore("red", hitBlock.getLocation());
							} else if (shooter.getMetadata("team").get(0).asString().equalsIgnoreCase("blue")) {
								// Blue
								hitBlock.setData((byte) 11);
								game.AddScore("blue", hitBlock.getLocation());
							}
						}
					}
				}
			}
		}
	}
}
 
开发者ID:JFischer00,项目名称:PaintWarPlugin,代码行数:72,代码来源:PaintWarPlugin.java

示例10: onSnowballHit

import org.bukkit.entity.Snowball; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onSnowballHit(EntityDamageByEntityEvent e){
	
	if(snowballDamage <= 0){
		return;
	}
	
	if(e.getDamager().getType() == EntityType.SNOWBALL){
		
		Snowball s = (Snowball) e.getDamager();
		
		if(s.getShooter() instanceof Player){
			
			if(e.getEntity() instanceof LivingEntity){
				
				LivingEntity victim = (LivingEntity) e.getEntity();
				
				victim.damage(snowballDamage , s.getShooter());
				
				e.setDamage(0);
				e.setCancelled(true);
				
			}
		}
		
	}
	
}
 
开发者ID:Zarkopafilis,项目名称:Random-Notes,代码行数:30,代码来源:SkillCastClass.java


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