// Path: src/main/java/com/kit/api/collection/Filter.java
// public interface Filter<T> {
// 
//     /**
//      * Filter function
//      *
//      * @param acceptable an item that can be filtered
//      * @return true if item should be retained, false otherwise.
//      */
//     boolean accept(T acceptable);
// 
//     static <T> Filter<T> collapse(List<Filter<T>> filters) {
//         return acceptable -> {
//             for (Filter<T> filter : filters) {
//                 if (!filter.accept(acceptable)) {
//                     return false;
//                 }
//             }
//             return true;
//         };
//     }
// 
// }
// 
// Path: src/main/java/com/kit/api/collection/queries/PlayerQuery.java
// public class PlayerQuery extends EntityQuery<Player, PlayerQuery> {
// 
//     public PlayerQuery(MethodContext context) {
//         super(context);
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public Player single() {
//         List<Player> players = asList();
//         return !players.isEmpty() ? players.get(0) : null;
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public List<Player> asList() {
//         List<Player> all = context.players.getAll(filters);
//         Collections.sort(all, new Comparator<Player>() {
//             @Override
//             public int compare(Player o1, Player o2) {
//                 int dist1 = o1.distanceTo(context.players.getLocal());
//                 int dist2 = o2.distanceTo(context.players.getLocal());
//                 return dist1 - dist2;
//             }
//         });
//         return all;
//     }
// 
//     public PlayerQuery levelBetween(int lower, int higher) {
//         addCondition(acceptable -> acceptable.getCombatLevel() >= lower && acceptable.getCombatLevel() <= higher);
//         return this;
//     }
// }


import com.kit.api.collection.Filter;
import com.kit.api.collection.queries.PlayerQuery;
import com.kit.api.wrappers.Player;
import com.kit.api.wrappers.Region;
import java.util.List;
package com.kit.api;



/**
 * Methods for dealing with Players in the game.
 *
 */
public interface Players {

    /**
     * Gets the currently logged in player
     *
     * @return local player
     */
    Player getLocal();

    /**
     * Gets all players within the current region.
     *
     * @return players
     */
    List<Player> getAll();

    /**
     * Gets a new PlayerQuery which can be used for
     * finding and selecting players matching certain
     * conditions.
     *
     * @return query
     */
    PlayerQuery find();

    /**
     * Creates a query using a Player's most basic attribute, being it's name.
     *
     * @return query
     */
    PlayerQuery find(String... names);

    void loadPlayerPositions();

// Path: src/main/java/com/kit/api/collection/Filter.java
// public interface Filter<T> {
// 
//     /**
//      * Filter function
//      *
//      * @param acceptable an item that can be filtered
//      * @return true if item should be retained, false otherwise.
//      */
//     boolean accept(T acceptable);
// 
//     static <T> Filter<T> collapse(List<Filter<T>> filters) {
//         return acceptable -> {
//             for (Filter<T> filter : filters) {
//                 if (!filter.accept(acceptable)) {
//                     return false;
//                 }
//             }
//             return true;
//         };
//     }
// 
// }
// 
// Path: src/main/java/com/kit/api/collection/queries/PlayerQuery.java
// public class PlayerQuery extends EntityQuery<Player, PlayerQuery> {
// 
//     public PlayerQuery(MethodContext context) {
//         super(context);
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public Player single() {
//         List<Player> players = asList();
//         return !players.isEmpty() ? players.get(0) : null;
//     }
// 
//     /**
//      * {@inheritDoc}
//      */
//     @Override
//     public List<Player> asList() {
//         List<Player> all = context.players.getAll(filters);
//         Collections.sort(all, new Comparator<Player>() {
//             @Override
//             public int compare(Player o1, Player o2) {
//                 int dist1 = o1.distanceTo(context.players.getLocal());
//                 int dist2 = o2.distanceTo(context.players.getLocal());
//                 return dist1 - dist2;
//             }
//         });
//         return all;
//     }
// 
//     public PlayerQuery levelBetween(int lower, int higher) {
//         addCondition(acceptable -> acceptable.getCombatLevel() >= lower && acceptable.getCombatLevel() <= higher);
//         return this;
//     }
// }


// Path: src/main/java/com/kit/api/Players.java
import com.kit.api.collection.Filter;
import com.kit.api.collection.queries.PlayerQuery;
import com.kit.api.wrappers.Player;
import com.kit.api.wrappers.Region;
import java.util.List;

package com.kit.api;



/**
 * Methods for dealing with Players in the game.
 *
 */
public interface Players {

    /**
     * Gets the currently logged in player
     *
     * @return local player
     */
    Player getLocal();

    /**
     * Gets all players within the current region.
     *
     * @return players
     */
    List<Player> getAll();

    /**
     * Gets a new PlayerQuery which can be used for
     * finding and selecting players matching certain
     * conditions.
     *
     * @return query
     */
    PlayerQuery find();

    /**
     * Creates a query using a Player's most basic attribute, being it's name.
     *
     * @return query
     */
    PlayerQuery find(String... names);

    void loadPlayerPositions();

    List<Player> getAll(List<Filter<Player>> filters);