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


Java Player.isDead方法代码示例

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


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

示例1: run

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void run() {
	Set<UUID> players=rs.getPlayerDatas().keySet();
	for(UUID ps:players){
		Player p = rs.getServer().getPlayer(ps);
		if(p==null||p.isDead())continue;
	      if ((p.hasPermission("RealSurvival.unlimited")||p.hasPermission("RealSurvival.Admin"))&&!TestCMD.contains(p)) 
	    	  continue;
	      PlayerData pd=rs.getPlayerData(p);
	      if(p==null||p.isDead())continue;
	      
	      Iterator<Map.Entry<String, Object[]>> ite = pd.getSickKindMap().entrySet().iterator();  
	      try{
			while(ite.hasNext()){
				Entry<String, Object[]> entity = ite.next();
				if(Boolean.parseBoolean(entity.getValue()[3].toString())){
					pd.changeDuration(1, entity.getKey());
					pd.changeRecovery(Double.parseDouble(entity.getValue()[2].toString()), entity.getKey());
				}else if(Double.parseDouble(entity.getValue()[2].toString())>0)
					pd.changeRecovery(-Double.parseDouble(entity.getValue()[2].toString()), entity.getKey());
				else pd.changeRecovery(Double.parseDouble(entity.getValue()[2].toString()), entity.getKey());
			}
	      }catch(Exception e){};
	}
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:26,代码来源:SickTask.java

示例2: handlePlayerMove

import org.bukkit.entity.Player; //导入方法依赖的package包/类
private void handlePlayerMove(Player player, Location to) {
    if(TGM.get().getModule(SpectatorModule.class).isSpectating(player)) return;

    if (!player.isDead() && region.contains(to)) {
        playersOnPoint.add(player);
    } else {
        playersOnPoint.remove(player);
    }
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:10,代码来源:ControlPoint.java

示例3: onDrop

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onDrop(PlayerDropItemEvent evt) {
    if(ConfigPatch.fixDupeDropItem){
        Player player = evt.getPlayer();
        if (AzurePlayerList.contains(player) && player.isDead()) evt.setCancelled(true);
    }
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:8,代码来源:AntiDupeDropItem.java

示例4: run

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void run() {
    if(ConfigPatch.noFakedeath){
        List<Player> players = AzurePlayerList.players();
        int ps = players.size();
        for(int i = 0;i<ps;i++){
            Player player = players.get(i);
            if(player.getHealth() <= 0 && !player.isDead()){
                player.setHealth(0.0);
                player.kickPlayer(ConfigPatch.messageFakedeath);
            }
        }
    }
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:15,代码来源:AntiFakeDeath.java

示例5: onPlayerDamage

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerDamage(EntityDamageEvent event) {
    if(event.getDamage() <= 0) return;

    if(!(event.getEntity() instanceof Player)) return;
    Player player = (Player) event.getEntity();

    if(player.getGameMode() == GameMode.CREATIVE) return;

    if(player.isDead()) return;

    if(player.getNoDamageTicks() > 0) return;

    if(getResistanceFactor(player) <= 0) return;

    switch(event.getCause()) {
        case ENTITY_EXPLOSION:
        case BLOCK_EXPLOSION:
        case CUSTOM:
        case FALL:
        case FALLING_BLOCK:
        case LIGHTNING:
        case MELTING:
        case SUICIDE:
        case THORNS:
            return; // Skip damage causes that are not particularly likely to be followed by more damage

        case FIRE:
        case FIRE_TICK:
        case LAVA:
            if(hasFireResistance(player)) return;
            break;
    }

    // Record the player's damage with a timestamp
    this.recentDamage.put(player, new Damage(Instant.now(), event));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:38,代码来源:CombatLogTracker.java

示例6: run

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void run() {
	Set<UUID> players=rs.getPlayerDatas().keySet();
	for(UUID ps:players){
	  Player p = rs.getServer().getPlayer(ps);
	  if(p==null||p.isDead())continue;
      if ((p.hasPermission("RealSurvival.unlimited")||p.hasPermission("RealSurvival.Admin"))&&!TestCMD.contains(p)) 
    	  continue;
      PlayerData pd=rs.getPlayerData(p);
   	  pd.changeThirst(-rs.getThirstSub());
	  continue;
    }
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:14,代码来源:ThirstTask.java

示例7: run

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void run() {
	Set<UUID> players=rs.getPlayerDatas().keySet();
	for(UUID ps:players){
		Player p = rs.getServer().getPlayer(ps);
		if(p==null||p.isDead())continue;
      if ((p.hasPermission("RealSurvival.unlimited")||p.hasPermission("RealSurvival.Admin"))&&!TestCMD.contains(p)) 
    	  continue;
      PlayerData pd=rs.getPlayerData(p);
      if(pd.isSleep())
      {
    	  byte lightLevel=pd.getLight();
    	  if(lightLevel>10){
    		  pd.changeSleep(rs.getSleepAdd()*0.3);
    		  continue;
    	  }
    	  else if(lightLevel>5){
    		  pd.changeSleep(rs.getSleepAdd()*0.6);
    		  continue;
    	  }
    	  pd.changeSleep(rs.getSleepAdd());
   		  continue; 
      }else{
    	  pd.changeSleep(-rs.getSleepSub());
   		  continue;
      }
    }
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:29,代码来源:SleepTask.java

示例8: run

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void run() {
	Set<UUID> players=rs.getPlayerDatas().keySet();
	for(UUID ps:players){
		Player p = rs.getServer().getPlayer(ps);
		if(p==null||p.isDead())continue;
		if ((p.hasPermission("RealSurvival.unlimited")||p.hasPermission("RealSurvival.Admin"))&&!TestCMD.contains(p)) 
	    	  continue;
	      PlayerData pd=rs.getPlayerData(p);
	      if(p.isSneaking())
	    	  if(pd.getPhysical_strength()<rs.getSneaking())
	    		  p.setSneaking(false);
	    	  else{
	    		  pd.changePS(-rs.getSneaking());
	    		  continue;
	    	  }
	      else if(p.isSprinting())
	    	  if(pd.getPhysical_strength()<rs.getSprinting())
	    		  p.setSprinting(false);
	    	  else{
	    		  pd.changePS(-rs.getSprinting());
	    		  continue;
	    	  }
	      else
	    	  pd.changePS(rs.getPhysical_strength_add());
	    }
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:28,代码来源:PhysicalStrengthTask.java

示例9: getImminentDeath

import org.bukkit.entity.Player; //导入方法依赖的package包/类
/**
 * Get the cause of the player's imminent death, or null if they are not about to die
 * NOTE: not idempotent, has the side effect of clearing the recentDamage cache
 */
public @Nullable ImminentDeath getImminentDeath(Player player) {
    // If the player is already dead or in creative mode, we don't care
    if(player.isDead() || player.getGameMode() == GameMode.CREATIVE) return null;

    // If the player was on the ground, or is flying, or is able to fly, they are fine
    if(!(player.isOnGround() || player.isFlying() || player.getAllowFlight())) {
        // If the player is falling, detect an imminent falling death
        double fallDistance = player.getFallDistance();
        Block landingBlock = null;
        int waterDepth = 0;
        Location location = player.getLocation();

        if(location.getY() > 256) {
            // If player is above Y 256, assume they fell at least to there
            fallDistance += location.getY() - 256;
            location.setY(256);
        }

        // Search the blocks directly beneath the player until we find what they would have landed on
        Block block = null;
        for(; location.getY() >= 0; location.add(0, -1, 0)) {
            block = location.getBlock();
            if(block != null) {
                landingBlock = block;

                if(Materials.isWater(landingBlock.getType())) {
                    // If the player falls through water, reset fall distance and inc the water depth
                    fallDistance = -1;
                    waterDepth += 1;

                    // Break if they have fallen through enough water to stop falling
                    if(waterDepth >= BREAK_FALL_WATER_DEPTH) break;
                } else {
                    // If the block is not water, reset the water depth
                    waterDepth = 0;

                    if(Materials.isColliding(landingBlock.getType()) || Materials.isLava(landingBlock.getType())) {
                        // Break if the player hits a solid block or lava
                        break;
                    } else if(landingBlock.getType() == Material.WEB) {
                        // If they hit web, reset their fall distance, but assume they keep falling
                        fallDistance = -1;
                    }
                }
            }

            fallDistance += 1;
        }

        double resistanceFactor = getResistanceFactor(player);
        boolean fireResistance = hasFireResistance(player);

        // Now decide if the landing would have killed them
        if(location.getBlockY() < 0) {
            // The player would have fallen into the void
            return new ImminentDeath(EntityDamageEvent.DamageCause.VOID, location, null, false);
        } else if(landingBlock != null) {
            if(Materials.isColliding(landingBlock.getType()) && player.getHealth() <= resistanceFactor * (fallDistance - SAFE_FALL_DISTANCE)) {
                // The player would have landed on a solid block and taken enough fall damage to kill them
                return new ImminentDeath(EntityDamageEvent.DamageCause.FALL, landingBlock.getLocation().add(0, 0.5, 0), null, false);
            } else if (Materials.isLava(landingBlock.getType()) && resistanceFactor > 0 && !fireResistance) {
                // The player would have landed in lava, and we give the lava the benefit of the doubt
                return new ImminentDeath(EntityDamageEvent.DamageCause.LAVA, landingBlock.getLocation(), landingBlock, false);
            }
        }
    }

    // If we didn't predict a falling death, detect combat log due to recent damage
    Damage damage = this.recentDamage.remove(player);
    if(damage != null && damage.time.plus(RECENT_DAMAGE_THRESHOLD).isAfter(Instant.now())) {
        // Player logged out too soon after taking damage
        return new ImminentDeath(damage.event.getCause(), player.getLocation(), null, true);
    }

    return null;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:81,代码来源:CombatLogTracker.java

示例10: run

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void run() {
	Set<UUID> players=rs.getPlayerDatas().keySet();
	for(UUID ps:players){
		Player p = rs.getServer().getPlayer(ps);
		if(p==null||p.isDead())continue;
	      if ((p.hasPermission("RealSurvival.unlimited")||p.hasPermission("RealSurvival.Admin"))&&!TestCMD.contains(p)) 
	    	  continue;
	      PlayerData pd=rs.getPlayerData(p);
	      //Sleep
	      sleep=pd.getSleep();
	      if(sleep>=rs.getSleepMax()*0.8)
	    	  Utils.addPotionEffect(p, rs.getEffects("SleepMax"));
	      else if(sleep<=rs.getSleepMin())
	    	  Utils.addPotionEffect(p,rs.getEffects("SleepMin"));
	      
	      //Thirst
	      thirst=pd.getThirst();
	      if(thirst>=rs.getThirstMax()*0.8)
	    	  Utils.addPotionEffect(p, rs.getEffects("ThirstMax"));
	      else if(thirst<=rs.getThirstMin())
	    	  Utils.addPotionEffect(p, rs.getEffects("ThirstMin"));
	      
	      //Temperature
	      temperature=pd.getTemperature();
	      if(temperature>38)
	    	  Utils.addPotionEffect(p, rs.getEffects("Fever"));
	      else if(temperature<36)
	    	  Utils.addPotionEffect(p, rs.getEffects("Cold"));
	      
	      //PhysicalStrength
	      if(pd.getPhysical_strength()==0)
	    	  Utils.addPotionEffect(p, rs.getEffects("PhysicalStrengthMin"));
	      
	      //Sick
	      if(pd.isSick())
	    	  for(String sick:pd.getSickKindList())
	    		  Utils.addPotionEffect(p, rs.getEffects(sick));
	      
	      
	      //weight
	      if(pd.getWeight()>rs.getWeight()){
	    	  Utils.addPotionEffect(p, rs.getEffects("Weight"));
	    	  p.setSprinting(false);
	      }
	}
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:48,代码来源:EffectTask.java

示例11: run

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void run() {
	double _temper=-0.1;
	long time;
	Set<UUID> players=rs.getPlayerDatas().keySet();
	for(UUID ps:players){
		  Player p = rs.getServer().getPlayer(ps);
		  if(p==null||p.isDead())continue;
	      if ((p.hasPermission("RealSurvival.unlimited")||p.hasPermission("RealSurvival.Admin"))&&!TestCMD.contains(p)) 
	    	  continue;
	      PlayerData pd=rs.getPlayerData(p);
	      _temper=p.getWorld().getTemperature(p.getLocation().getBlockX(), p.getLocation().getBlockZ());
	      time=p.getWorld().getTime();
	      //12000-13800 ����
	      //13800-22200 ��ҹ
	      //22200-0          �ճ�
	      //0-12000          ����
	      //Material.
	      if(_temper>=0.5)
	    	  _temper-=0.5;
	      else _temper-=0.5;
	      if(time>=12000L&&time<22200L)
	    	  _temper-=Math.random()*0.5;
	      else
	    	  _temper+=Math.random()*0.5;
	      if(p.getWorld().hasStorm())
	    	  _temper-=Math.random()*0.5;
	      _temper+=getBlocks(p.getLocation());
	      _temper+=getInv(p);
	      if(p.getWorld().getBlockAt(p.getLocation()).getLightLevel()<=5)
	    	  _temper-=0.5*(5-p.getWorld().getBlockAt(p.getLocation()).getLightLevel()*0.1);
	      if(p.isSprinting())
	    	  _temper+=Math.random()*0.02;
	      
	      /*if(_temper>0.2)
	    	  pd.changeTemperature(0.2);
	      else if(_temper<0.2)
	    	  pd.changeTemperature(-0.2);
	      else*/
	    	  pd.changeTemperature(_temper*0.02);
	      continue;
    }
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:44,代码来源:TemperatureTask.java

示例12: onPlayerQuit

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled=true, priority=EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event)
{
    final Player player = event.getPlayer();
    UUID uuid = player.getUniqueId();
    boolean result = this.safelyDisconnected.remove(uuid);
    if ((!result) && (player.getGameMode() != GameMode.CREATIVE) && (!player.isDead()))
    {
        if (this.loggers.containsKey(player.getUniqueId())) {
            return;
        }
        if (this.plugin.getTimerManager().getInvincibilityTimer().getRemaining(uuid) > 0L) {
            return;
        }
        Location location = player.getLocation();
        if (this.plugin.getFactionManager().getFactionAt(location).isSafezone()) {
            return;
        }
        if ((this.plugin.getSotwTimer().getSotwRunnable() != null) || (this.plugin.getTimerManager().getTeleportTimer().getNearbyEnemies(player, 64) <= 0)) {
            return;
        }
        final LoggerEntity loggerEntity = new LoggerEntityHuman(player, location.getWorld());

        LoggerSpawnEvent calledEvent = new LoggerSpawnEvent(loggerEntity);
        Bukkit.getPluginManager().callEvent(calledEvent);
        if (!calledEvent.isCancelled())
        {
            this.loggers.put(player.getUniqueId(), loggerEntity);

            new BukkitRunnable()
            {
                public void run()
                {
                    if (!player.isOnline()) {
                        loggerEntity.postSpawn(CombatLogListener.this.plugin);
                    }
                }
            }

                    .runTaskLater(this.plugin, 1L);
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:44,代码来源:CombatLogListener.java


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