@@ -208,9 +208,21 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
208208 {
209209 if (!canPush ) sender .sendMessage ("§cServer is in offline mode, can't notify offline operators!" );
210210 String message = messageFromCmdAgs (args );
211+
212+ int counter = 0 ;
213+
211214 for (Player p : getServer ().getOnlinePlayers ())
212- if (p .isOp ()) p .sendMessage (message );
213- push (sender .getName () + " warned: " + message , true , true );
215+ {
216+ if (p .isOp ())
217+ {
218+ p .sendMessage (sender .getName () + " warned: " + message );
219+ counter ++;
220+ }
221+ }
222+
223+ counter += push (sender .getName () + " warned: " + message , true , true );
224+
225+ sender .sendMessage ("§aWarned " + Integer .toString (counter ) + " operators." );
214226 }
215227 else if (sender .isOp ())
216228 sender .sendMessage ("§cYou are an operator yourself..." );
@@ -278,13 +290,15 @@ public void push(String message)
278290 * @param message The message to be sent. Color codes will be automatically stripped out.
279291 * @param opOnly Whether only operators should receive this message.
280292 * @param highPriority Whether this message is of high priority.
293+ * @return The amount of players notified.
281294 */
282295 @ SuppressWarnings ("SuspiciousMethodCalls" )
283- public void push (String message , boolean opOnly , boolean highPriority )
296+ public int push (String message , boolean opOnly , boolean highPriority )
284297 {
285- if (!canPush ) return ;
298+ if (!canPush ) return 0 ;
286299
287300 Map <String , Object > map = getUserKeysFileConfiguration ().getValues (false );
301+ int counter = 0 ;
288302
289303 for (String playerUuidString : map .keySet ())
290304 {
@@ -330,6 +344,7 @@ else if ( ((String) map.get(playerUuidString)).endsWith("BANNED") )
330344 pm .setPriority (MessagePriority .HIGH );
331345
332346 pushoverRestClient .pushMessage (pm .build ());
347+ counter ++;
333348 }
334349 catch (PushoverException e )
335350 {
@@ -343,6 +358,8 @@ else if ( ((String) map.get(playerUuidString)).endsWith("BANNED") )
343358 }
344359 }
345360 }
361+
362+ return counter ;
346363 }
347364
348365 public void loadUserKeysFile () {
0 commit comments