Class Players
- All Implemented Interfaces:
ILocatable<SquaremapOnlinePlayer>
public class Players
extends BaseCache<SquaremapOnlinePlayer>
implements ILocatable<SquaremapOnlinePlayer>
-
Field Summary
Fields inherited from interface io.github.emcw.interfaces.ILocatable
INT_ARRAY_X, INT_ARRAY_Z
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Map
<String, SquaremapOnlinePlayer> getByResidency
(boolean hasTown) Similar toBaseCache.getAll()
, this method gets all the players but only includes those that match a certain residential status indicated by thehasTown
parameter.
NOTE: If the intention is to call this method twice, once for townless and another for towned players, consider usinggetSorted()
instead to sort them in a single forEach pass and avoid unnecessary operations.getNearby
(@NotNull SquaremapLocation location, Integer xRadius, Integer zRadius) getNearby
(@NotNull SquaremapOnlinePlayer p, Integer xRadius, Integer zRadius) kotlin.Pair
<Map<String, SquaremapOnlinePlayer>, Map<String, SquaremapOnlinePlayer>> Gets online players and sorts them into two seperate maps in a single pass.
A newPair
is returned, where the first contains players with a town and the second without.Methods inherited from class io.github.emcw.caching.BaseCache
cacheIsEmpty, getAll, getMultiple, getSingle, updateCache
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.emcw.interfaces.ILocatable
getNearbyEntities, getNearbyEntities
-
Constructor Details
-
Players
-
-
Method Details
-
fetchCacheData
- Specified by:
fetchCacheData
in classBaseCache<SquaremapOnlinePlayer>
-
getByResidency
Similar toBaseCache.getAll()
, this method gets all the players but only includes those that match a certain residential status indicated by thehasTown
parameter.
NOTE: If the intention is to call this method twice, once for townless and another for towned players, consider usinggetSorted()
instead to sort them in a single forEach pass and avoid unnecessary operations.- Parameters:
hasTown
- The residential status to filter by. True for residents, false for townless.- Returns:
- The filtered map of online players that pass the hasTown value.
-
getSorted
Gets online players and sorts them into two seperate maps in a single pass.
A newPair
is returned, where the first contains players with a town and the second without. -
getNearby
-
getNearby
-
getNearby
public Map<String,SquaremapOnlinePlayer> getNearby(@NotNull @NotNull SquaremapOnlinePlayer p, Integer xRadius, Integer zRadius) -
getNearby
public Map<String,SquaremapOnlinePlayer> getNearby(@NotNull @NotNull SquaremapLocation location, Integer xRadius, Integer zRadius)
-