diff --git a/pom.xml b/pom.xml
index 1179325..839c5cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
groupId
JVote
- 1.0.1
+ 1.0.2
8
diff --git a/src/main/java/com/wkaye/jvote/JVoteCommand.java b/src/main/java/com/wkaye/jvote/JVoteCommand.java
index aac41f6..5956b4b 100644
--- a/src/main/java/com/wkaye/jvote/JVoteCommand.java
+++ b/src/main/java/com/wkaye/jvote/JVoteCommand.java
@@ -65,21 +65,46 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
return true;
}
Player player = (Player) sender;
+
if (voteStarted.get()) {
- // vote started, check that the user actually supplied a yes or no vote
- if (!("yes".contains(args[0].toLowerCase()) || "no".contains(args[0].toLowerCase()) || "ok".contains(args[0].toLowerCase()))) {
+ // vote started, check if they're voting yes/no or voting for the same type as current vote
+ String arg = args[0].toLowerCase();
+
+ // Check if they're trying to vote for the same type as the current vote
+ boolean isVotingForCurrentType = false;
+ try {
+ JVoteEnums inputVoteType = JVoteEnums.valueOf(args[0].toUpperCase());
+ // Check if the input vote type matches the current vote type
+ if (inputVoteType == currentVoteType ||
+ (inputVoteType == JVoteEnums.CLEAR && currentVoteType == JVoteEnums.SUN) ||
+ (inputVoteType == JVoteEnums.SUN && currentVoteType == JVoteEnums.CLEAR)) {
+ isVotingForCurrentType = true;
+ }
+ } catch (IllegalArgumentException e) {
+ // continue with normal yes & no check
+ }
+
+ if (isVotingForCurrentType) {
+ // They're voting for the same type as current vote, treat as "yes"
+ if (checkVote("yes", player)) {
+ doVote();
+ return true;
+ }
+ } else if ("yes".contains(arg) || "no".contains(arg) || "ok".contains(arg)) {
+ // Normal yes/no/ok voting
+ if (checkVote(args[0], player)) {
+ // vote passed, perform change and reset values
+ doVote();
+ return true;
+ }
+ } else {
// invalid usage, return false
sender.sendMessage(JVoteUtils.printMessage("A vote is already in progress"));
plugin.logger(Level.WARNING, "Attempted /vote after vote started with improper args");
return true;
}
- if (checkVote(args[0], player)) {
- // vote passed, perform change and reset values
- doVote();
- return true;
- }
-
}
+
if (!voteStarted.get()) {
try {
// this line to trigger exception if not valid
@@ -96,7 +121,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
"A vote for "
+ JVoteUtils.formatColor(currentVoteType.color())
+ JVoteUtils.formatColor(currentVoteType.toString().toLowerCase())
- + JVoteUtils.formatColor("&7 has started. Vote by doing &a/vote "));
+ + JVoteUtils.formatColor("&7 has started. Vote by doing &a/vote "));
plugin.getServer().broadcastMessage(msg);
if (checkVote("yes", player)) {
doVote();
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index d4c4353..3cec81a 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,5 +1,5 @@
name: JVote
-version: 1.0.0
+version: 1.0.2
main: com.wkaye.jvote.JVote
authors: [ xXGunner989Xx ]
description: A weather voting plugin for Minecraft Beta 1.7.3 designed for Project Poseidon w/ Fundamentals