本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}