@@ -158,7 +158,7 @@ public NamelessPlayer getPlayer(UUID uuid) throws NamelessException {
158158 return new NamelessPlayer (uuid , apiUrl );
159159 }
160160
161- public Map <UUID , String > getRegisteredUsers () throws NamelessException {
161+ public Map <UUID , String > getRegisteredUsers (boolean hideInactive , boolean hideBanned ) throws NamelessException {
162162 Request request = new Request (apiUrl , Action .LIST_USERS );
163163 request .connect ();
164164 if (request .hasError ()) {
@@ -170,15 +170,25 @@ public Map<UUID, String> getRegisteredUsers() throws NamelessException {
170170 request .getResponse ().get ("users" ).getAsJsonArray ().forEach (userJsonElement -> {
171171 final String uuid = userJsonElement .getAsJsonObject ().get ("uuid" ).getAsString ();
172172 final String username = userJsonElement .getAsJsonObject ().get ("username" ).getAsString ();
173+ final int active = userJsonElement .getAsJsonObject ().get ("active" ).getAsInt ();
174+ final int banned = userJsonElement .getAsJsonObject ().get ("active" ).getAsInt ();
175+
176+ if (hideInactive && active == 0 ) {
177+ return ;
178+ }
179+
180+ if (hideBanned && banned == 1 ) {
181+ return ;
182+ }
173183
174184 users .put (websiteUuidToJavaUuid (uuid ), username );
175185 });
176186
177187 return users ;
178188 }
179189
180- public List <NamelessPlayer > getRegisteredUsersAsNamelessPlayerList () throws NamelessException {
181- Map <UUID , String > users = getRegisteredUsers ();
190+ public List <NamelessPlayer > getRegisteredUsersAsNamelessPlayerList (boolean hideInactive , boolean hideBanned ) throws NamelessException {
191+ Map <UUID , String > users = getRegisteredUsers (hideInactive , hideBanned );
182192 List <NamelessPlayer > namelessPlayers = new ArrayList <>();
183193
184194 for (UUID userUuid : users .keySet ()) {
0 commit comments