From f028b5fb7dc844927e58643e131a3feaa9fefe70 Mon Sep 17 00:00:00 2001 From: BlvckBytes Date: Sun, 14 Jun 2026 15:57:37 +0200 Subject: [PATCH 1/2] implemented config-option HideTopVoterIfNotPlayedBefore --- .../java/com/bencodez/votingplugin/config/Config.java | 4 ++++ .../bencodez/votingplugin/topvoter/TopVoterHandler.java | 9 +++++++++ VotingPlugin/src/main/resources/Config.yml | 3 +++ 3 files changed, 16 insertions(+) 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..9939842ea 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 -> { + var 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 From 7bf52f88926fe853b51120abb9fda90054e8fd74 Mon Sep 17 00:00:00 2001 From: BlvckBytes Date: Sun, 14 Jun 2026 16:06:27 +0200 Subject: [PATCH 2/2] substituted var declaration with explicit type --- .../com/bencodez/votingplugin/topvoter/TopVoterHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9939842ea..b3936a695 100644 --- a/VotingPlugin/src/main/java/com/bencodez/votingplugin/topvoter/TopVoterHandler.java +++ b/VotingPlugin/src/main/java/com/bencodez/votingplugin/topvoter/TopVoterHandler.java @@ -765,7 +765,7 @@ public LinkedHashMap sortByValues(LinkedHashMap { - var playerId = entry.getKey().getUser().getJavaUUID(); + UUID playerId = entry.getKey().getUser().getJavaUUID(); OfflinePlayer player = Bukkit.getOfflinePlayer(playerId); return !player.hasPlayedBefore();