diff --git a/VotingPlugin/src/main/java/com/bencodez/votingplugin/config/Config.java b/VotingPlugin/src/main/java/com/bencodez/votingplugin/config/Config.java index 9ee64bb1c..8cc309b8b 100644 --- a/VotingPlugin/src/main/java/com/bencodez/votingplugin/config/Config.java +++ b/VotingPlugin/src/main/java/com/bencodez/votingplugin/config/Config.java @@ -491,6 +491,10 @@ public String getDiscordSRVTopVoterRankDisplay(TopVoter topVoter) { @Getter private int MaxiumNumberOfTopVotersToLoad = 1000; + @ConfigDataBoolean(path = "HideTopVoterIfNotPlayedBefore") + @Getter + private boolean HideTopVoterIfNotPlayedBefore = false; + @ConfigDataBoolean(path = "OverrideVersionDisable") @Getter private boolean overrideVersionDisable = false; diff --git a/VotingPlugin/src/main/java/com/bencodez/votingplugin/topvoter/TopVoterHandler.java b/VotingPlugin/src/main/java/com/bencodez/votingplugin/topvoter/TopVoterHandler.java index 3d02d832a..b3936a695 100644 --- a/VotingPlugin/src/main/java/com/bencodez/votingplugin/topvoter/TopVoterHandler.java +++ b/VotingPlugin/src/main/java/com/bencodez/votingplugin/topvoter/TopVoterHandler.java @@ -763,6 +763,15 @@ public LinkedHashMap sortByValues(LinkedHashMap> list = new LinkedList<>(map.entrySet()); + if (plugin.getConfigFile().isHideTopVoterIfNotPlayedBefore()) { + list.removeIf(entry -> { + UUID playerId = entry.getKey().getUser().getJavaUUID(); + OfflinePlayer player = Bukkit.getOfflinePlayer(playerId); + + return !player.hasPlayedBefore(); + }); + } + // Sorting the list based on values Collections.sort(list, new Comparator>() { @Override diff --git a/VotingPlugin/src/main/resources/Config.yml b/VotingPlugin/src/main/resources/Config.yml index 3ed6430d2..eab3b4b27 100644 --- a/VotingPlugin/src/main/resources/Config.yml +++ b/VotingPlugin/src/main/resources/Config.yml @@ -467,6 +467,9 @@ LoadTopVoter: # Set to -1 for no limit MaxiumNumberOfTopVotersToLoad: 1000 +# Whether to remove voters from the top-list if they have not joined the server yet +HideTopVoterIfNotPlayedBefore: false + # When top voter awards are given (even if there are none listed) it will store top voters # Files will created in TopVoters folder. # Monthly top voters are always saved by default now