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


Java Player.getHumans方法代码示例

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


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

示例1: getNearestAvailablePlayer

import net.gtaun.shoebill.object.Player; //导入方法依赖的package包/类
/**
 * get nearest player with free slots of a location depends on a maximal distance between players and location
 * @param location the main / origin location
 * @param maxDistance the maximal distance / range
 * @return Player the nearest player
 */
public static Player getNearestAvailablePlayer(AngledLocation location, float maxDistance) {
	float min = -1;
	Player nearestPlayer = null;
    for (Player player : Player.getHumans()) {
    	AngledLocation slotLocation = LocationSlot.getNearestSlotLocation(location, player.getLocation(), EventNPCFunctions.maxDistance, true);
    	if(slotLocation != null) {
         float distance = location.distance(player.getLocation());
         if (distance <= maxDistance && distance < min || distance <= maxDistance && min == -1) {
             nearestPlayer = player;
             min = distance;
         }
    	}
    }
    return nearestPlayer;
}
 
开发者ID:Alf21,项目名称:event-system,代码行数:22,代码来源:EventFunctions.java

示例2: eventsweather

import net.gtaun.shoebill.object.Player; //导入方法依赖的package包/类
@Command
@CommandHelp("/eventsweather [id]")
public boolean eventsweather(Player player, int weather) {
	for(Player pl : Player.getHumans()) {
		pl.setWeather(weather);
	}
	return true;
}
 
开发者ID:Alf21,项目名称:event-system,代码行数:9,代码来源:Commands.java

示例3: getNearbyPlayers

import net.gtaun.shoebill.object.Player; //导入方法依赖的package包/类
/**
* Created by marvin on 10.01.15 in project roleplay.
* Copyright (c) 2015 Marvin Haschker. All rights reserved.
* get nearest players of a location depends on a maximal distance between players and location
* @param location the main / origin location
* @param maxDistance the maximal distance / range
* @return ArrayList of Player
*/
  public static ArrayList<Player> getNearbyPlayers(Location location, float maxDistance) {
      ArrayList<Player> players = new ArrayList<>();
      for (Player player : Player.getHumans()) {
          float distance = player.getLocation().distance(location);
          if (distance <= maxDistance) {
              players.add(player);
          }
      }
      return players;
  }
 
开发者ID:Alf21,项目名称:event-system,代码行数:19,代码来源:EventFunctions.java

示例4: getNearestPlayer

import net.gtaun.shoebill.object.Player; //导入方法依赖的package包/类
/**
 * get nearest player of a location depends on a maximal distance between players and location
 * @param location the main / origin location
 * @return Player the nearest player
 */
public static Player getNearestPlayer(Location location) {
	float min = -1;
	Player nearestPlayer = null;
    for (Player player : Player.getHumans()) {
        float distance = location.distance(player.getLocation());
        if (distance < min || min == -1) {
            nearestPlayer = player;
            min = distance;
        }
    }
    return nearestPlayer;
}
 
开发者ID:Alf21,项目名称:event-system,代码行数:18,代码来源:EventFunctions.java


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