Skip to content

Commit 489e145

Browse files
Merge pull request #9 from Project-Poseidon-Plugins/voterain
Add /vote rain
2 parents aaa11b0 + 1d9fef1 commit 489e145

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/main/java/com/wkaye/jvote/JVoteCommand.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ End vote after a timer (1 minute will be baseline)
5353
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
5454
// there should be two types of votes: one where the vote is initiated, and one where the vote is yes/no
5555
if (args.length != 1) {
56-
String msg = JVoteUtils.printMessage("Proper usage is &a/vote <day/night/storm/clear>");
56+
String msg = JVoteUtils.printMessage("Proper usage is &a/vote <day/night/rain/storm/clear>");
5757
sender.sendMessage(msg);
5858
// invalid usage (should be /vote {type of vote}
5959
plugin.logger(Level.WARNING, "Attempted /vote with invalid number of args");
@@ -89,7 +89,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
8989
sender.sendMessage(JVoteUtils.printMessage("This vote is on cool down"));
9090
return true;
9191
}
92-
// TODO: fetch these from some config file. For now, only day/night and clear/storm
92+
// TODO: fetch these from some config file. For now, only day/night and clear/rain/storm
9393
// invalid usage, return false
9494
currentVoteType = JVoteEnums.valueOf(args[0].toUpperCase());
9595
String msg = JVoteUtils.printMessage(
@@ -105,7 +105,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
105105
}
106106

107107
} catch (IllegalArgumentException e) {
108-
String msg = JVoteUtils.printMessage("Proper usage is &a/vote <day/night/storm/clear>");
108+
String msg = JVoteUtils.printMessage("Proper usage is &a/vote <day/night/rain/storm/clear>");
109109
sender.sendMessage(msg);
110110
plugin.logger(Level.WARNING, "Attempted to start /vote with improper argument");
111111
return true;
@@ -173,11 +173,20 @@ private void doVote() {
173173
}
174174
}
175175
break;
176+
case RAIN:
177+
for(World world : Bukkit.getWorlds()){
178+
if (!world.hasStorm()) {
179+
world.setWeatherDuration(5);
180+
}
181+
world.setThundering(false);
182+
}
183+
break;
176184
case STORM:
177185
for(World world : Bukkit.getWorlds()){
178186
if (!world.hasStorm()) {
179187
world.setWeatherDuration(5);
180188
}
189+
world.setThundering(true);
181190
}
182191
break;
183192
default:

src/main/java/com/wkaye/jvote/JVoteEnums.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public String color() {
2222
return JVoteUtils.formatColor("&f");
2323
}
2424
},
25+
RAIN {
26+
public String color() {
27+
return JVoteUtils.formatColor("&3");
28+
}
29+
},
2530
STORM {
2631
public String color() {
2732
return JVoteUtils.formatColor("&9");

0 commit comments

Comments
 (0)