Update vote validation and argument naming

Updated the method "votePassed" in "ActiveVoteToMute" to consider a scenario where no votes have been made for muting. Also, corrected the argument name from "yesno" to "yesNo" in "VoteToMuteHelper" to match with its name in the command constructor
This commit is contained in:
2024-05-05 00:11:56 +02:00
parent f3147b3256
commit a876a9f77b
2 changed files with 2 additions and 2 deletions
@@ -197,7 +197,7 @@ public class VoteToMuteHelper {
}
}
String vote = commandContext.getArgument("yesno", String.class);
String vote = commandContext.getArgument("yesNo", String.class);
switch (vote.toLowerCase()) {
case "yes" -> activeVoteToMute.vote(source.getUniqueId(), true);
case "no" -> activeVoteToMute.vote(source.getUniqueId(), false);
@@ -127,7 +127,7 @@ public class ActiveVoteToMute {
public boolean votePassed() {
double totalVotes = (votedFor.size() + votedAgainst.size());
if (totalVotes == 0) {
if (totalVotes == 0 || votedFor.isEmpty()) {
return false;
}
if (totalVotes / totalEligibleVoters < 0.6) {