Added PlayersManager#getPlayers()

#392
This commit is contained in:
Florian CUNY 2019-01-20 09:01:38 +01:00
parent aad36c100f
commit 7cbb0d6a87

View File

@ -1,5 +1,6 @@
package world.bentobox.bentobox.managers;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@ -10,6 +11,7 @@ import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.World;
import org.eclipse.jdt.annotation.NonNull;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.Database;
@ -84,6 +86,16 @@ public class PlayersManager {
return playerCache.get(uuid);
}
/**
* Returns an <strong>unmodifiable collection</strong> of all the players that are <strong>currently in the cache</strong>.
* @return unmodifiable collection containing every player in the cache.
* @since 1.1
*/
@NonNull
public Collection<Players> getPlayers() {
return Collections.unmodifiableCollection(playerCache.values());
}
/*
* Cache control methods
*/