diff --git a/src/main/java/ru/bvn13/jircbot/listeners/StatisticsListener.java b/src/main/java/ru/bvn13/jircbot/listeners/StatisticsListener.java index 1970ef9..9f86f7a 100644 --- a/src/main/java/ru/bvn13/jircbot/listeners/StatisticsListener.java +++ b/src/main/java/ru/bvn13/jircbot/listeners/StatisticsListener.java @@ -89,11 +89,21 @@ public class StatisticsListener extends ImprovedListenerAdapter { event.respondChannel("Statistics is empty now"); return; } - event.respondChannel("TOP for all over time:"); - for (int i = 0; i < statistics.size(); i++) { - StatisticsDTO stats = statistics.get(i); - event.respondChannel("" + (i + 1) + ". " + stats.getUsername() + " - " + stats.getCount()); + if (statistics.size() > 10) { + event.respondPrivateMessage("TOP for all over time:"); + + for (int i = 0; i < statistics.size(); i++) { + StatisticsDTO stats = statistics.get(i); + event.respondPrivateMessage("" + (i + 1) + ". " + stats.getUsername() + " - " + stats.getCount()); + } + } else { + event.respondChannel("TOP for all over time:"); + + for (int i = 0; i < statistics.size(); i++) { + StatisticsDTO stats = statistics.get(i); + event.respondChannel("" + (i + 1) + ". " + stats.getUsername() + " - " + stats.getCount()); + } } } else if (commands.length == 3) { @@ -113,11 +123,21 @@ public class StatisticsListener extends ImprovedListenerAdapter { event.respondChannel("Statistics for "+periodInfo.period+" is empty now"); return; } - event.respondChannel("TOP for "+periodInfo.period+":"); - for (int i = 0; i < statistics.size(); i++) { - StatisticsDTO stats = statistics.get(i); - event.respondChannel("" + (i + 1) + ". " + stats.getUsername() + " - " + stats.getCount()); + if (statistics.size() > 10) { + event.respondPrivateMessage("TOP for " + periodInfo.period + ":"); + + for (int i = 0; i < statistics.size(); i++) { + StatisticsDTO stats = statistics.get(i); + event.respondPrivateMessage("" + (i + 1) + ". " + stats.getUsername() + " - " + stats.getCount()); + } + } else { + event.respondChannel("TOP for " + periodInfo.period + ":"); + + for (int i = 0; i < statistics.size(); i++) { + StatisticsDTO stats = statistics.get(i); + event.respondChannel("" + (i + 1) + ". " + stats.getUsername() + " - " + stats.getCount()); + } } } else {