public void onActivation(Location location, SpoutPlayer player) {
    // Setting player health
    if (player.getHealth() == 20) return;
    if (player.getHealth() >= 15) player.setHealth(20);
    else player.setHealth(player.getHealth() + 5);

    // Playing red drip particles on player location
    Location loc = player.getLocation();
    Particle healParticle = new Particle(ParticleType.DRIPWATER, loc, new Vector(0.5D, 3.0D, 0.5D));
    healParticle.setParticleBlue(0.0F).setParticleGreen(0.0F).setParticleRed(1.0F);
    healParticle.setMaxAge(40).setAmount(15).setGravity(1.1F);
    healParticle.spawn();
  }
Exemplo n.º 2
0
	@Override
	public void run() {
	    Boolean checkForZeroDamageHide = Boolean.valueOf(true);    
		int mobsHealth;
		String msg = null;
		
		
		if (le.isDead()){
	          mobsHealth = hp - damage;
	        }
	        else {
	          mobsHealth = Features.hplugin.getDamageManager().getHealth(le);
	        }
		int damageTaken = hp - mobsHealth;    	    

	    if (damageTaken > 0) {
	        checkForZeroDamageHide = Boolean.valueOf(false);
	    }else{
	        checkForZeroDamageHide = Boolean.valueOf(true);
	    }
	        
        if (!checkForZeroDamageHide.booleanValue()){
           msg = (ChatColor.RED + "-" + decFormat.format(damage) + "HP");
           new TextSpawn(sp, movement, scale, duration, msg, loc);
	        Particle part = new Particle(ParticleType.SNOWBALLPOOF, loc, new Vector(0, -0.4f, 0)).setParticleRed(1).setParticleBlue(0).setParticleGreen(0).setMaxAge(500).setGravity(1F).setScale(0.7f).setAmount(damage);
	        part.spawn();
       	
           List<Entity> list = sp.getNearbyEntities(20, 20, 20);
       	   Iterator<Entity> i = list.iterator();
   	       while(i.hasNext()){
	    	   Entity entity = i.next();
	    	       if (!(entity instanceof Player)) 
	    	       	   continue;
	    	   Player p = (Player)entity;
	    	   sp = SpoutManager.getPlayer(p);
	    	   String m = (ChatColor.YELLOW + "-" +decFormat.format(damage)+ "HP");
	    	   if((Features.hplugin.getCharacterManager().getHero(p).isVerbose()))
	    	   new TextSpawn(sp, movement, scale, duration, m, loc);
	    	       
	    	
	    }
	   }
	   else return;
		}