Search in sources :

Example 1 with EntityPlayerHandle

use of com.bergerkiller.generated.net.minecraft.server.EntityPlayerHandle in project BKCommonLib by bergerhealer.

the class PlayerUtil method getNearbyPlayers.

/**
 * Gets a (referenced) list of all players nearby another Player
 *
 * @param player to get the nearby players of
 * @param radius to look around the player for other playrs
 * @return list of nearby players
 */
public static List<Player> getNearbyPlayers(Player player, double radius) {
    EntityPlayerHandle handle = CommonNMS.getHandle(player);
    List<?> nearbyPlayerHandles = handle.getWorld().getRawEntitiesOfType(EntityPlayerHandle.T.getType(), handle.getBoundingBox().grow(radius, radius, radius));
    return new ConvertingList<Player>(nearbyPlayerHandles, DuplexConversion.player);
}
Also used : ConvertingList(com.bergerkiller.mountiplex.conversion.util.ConvertingList) EntityPlayerHandle(com.bergerkiller.generated.net.minecraft.server.EntityPlayerHandle)

Aggregations

EntityPlayerHandle (com.bergerkiller.generated.net.minecraft.server.EntityPlayerHandle)1 ConvertingList (com.bergerkiller.mountiplex.conversion.util.ConvertingList)1