Skip to content

Commit

Permalink
feat(SkinOverlay): getPlayer and isOnline methods
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeV220 committed Jan 19, 2023
1 parent 0621811 commit 21f78da
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/src/main/java/com/georgev22/skinoverlay/SkinOverlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,22 @@ public List<PlayerObject> onlinePlayers() {
return skinOverlay.onlinePlayers();
}

public boolean isOnline(String playerName) {
return onlinePlayers().stream().anyMatch(playerObject -> playerObject.playerName().equalsIgnoreCase(playerName));
}

public boolean isOnline(UUID uuid) {
return onlinePlayers().stream().anyMatch(playerObject -> playerObject.playerUUID().equals(uuid));
}

public Optional<PlayerObject> getPlayer(String playerName) {
return onlinePlayers().stream().filter(playerObject -> playerObject.playerName().equalsIgnoreCase(playerName)).findFirst();
}

public Optional<PlayerObject> getPlayer(UUID uuid) {
return onlinePlayers().stream().filter(playerObject -> playerObject.playerUUID().equals(uuid)).findFirst();
}

public FileConfiguration getConfig() {
return fileManager.getConfig().getFileConfiguration();
}
Expand Down

0 comments on commit 21f78da

Please sign in to comment.