From ac632f1a071b3a9d84681041420c260be9d9f1d2 Mon Sep 17 00:00:00 2001 From: Jon Langseth Date: Tue, 13 Mar 2012 20:50:05 +0100 Subject: [PATCH] By request: adding "/vote storm" for starting thunder-storms. --- plugin.yml | 1 + src/no/defcon/yavote/Votemanager.java | 5 ++++- src/no/defcon/yavote/YAVote.java | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugin.yml b/plugin.yml index 3eada92..1d311de 100644 --- a/plugin.yml +++ b/plugin.yml @@ -12,6 +12,7 @@ commands: / [parameter] / sun - Vote for fine weather / rain - Vote for rainy weather + / storm - Vote for thunder-storm / day - Vote to set the time to morning / night - Vote to set the time to night / yes|no - Respond positive or negative to current vote diff --git a/src/no/defcon/yavote/Votemanager.java b/src/no/defcon/yavote/Votemanager.java index cf69d7e..2212b7a 100644 --- a/src/no/defcon/yavote/Votemanager.java +++ b/src/no/defcon/yavote/Votemanager.java @@ -41,6 +41,7 @@ public class Votemanager { if ( ! (type.equalsIgnoreCase("sun") || type.equalsIgnoreCase("rain") || + type.equalsIgnoreCase("storm") || type.equalsIgnoreCase("day") || type.equalsIgnoreCase("night") )) { @@ -148,6 +149,8 @@ public class Votemanager { w.setStorm(false); else if ( voteType.equalsIgnoreCase("rain")) w.setStorm(true); + else if ( voteType.equalsIgnoreCase("storm")) + w.setThundering(true); else if ( voteType.equalsIgnoreCase("day")) w.setTime( plugin.getConfig().getInt("vote.time.dayStart") ); else if ( voteType.equalsIgnoreCase("night")) @@ -160,7 +163,7 @@ public class Votemanager { private boolean checkRatio( ) { float required = 0.5F; - if ( voteType.equalsIgnoreCase("sun") || voteType.equalsIgnoreCase("rain") ) + if ( voteType.equalsIgnoreCase("sun") || voteType.equalsIgnoreCase("rain") || voteType.equalsIgnoreCase("storm") ) required = (float)plugin.getConfig().getInt("vote.weather.requiredPercent") / 100.0F; else if ( voteType.equalsIgnoreCase("day") || voteType.equalsIgnoreCase("night") ) required = (float)plugin.getConfig().getInt("vote.time.requiredPercent") / 100.0F; diff --git a/src/no/defcon/yavote/YAVote.java b/src/no/defcon/yavote/YAVote.java index cdb04f0..f12edb3 100644 --- a/src/no/defcon/yavote/YAVote.java +++ b/src/no/defcon/yavote/YAVote.java @@ -95,7 +95,7 @@ public class YAVote extends JavaPlugin { return notImplemented(player); } - else if ( voteCmd.equalsIgnoreCase("sun") || voteCmd.equalsIgnoreCase("rain") || + else if ( voteCmd.equalsIgnoreCase("sun") || voteCmd.equalsIgnoreCase("rain") || voteCmd.equalsIgnoreCase("storm") || voteCmd.equalsIgnoreCase("day") || voteCmd.equalsIgnoreCase("night") ) { if ( ! manager.isVoteRunning() ) @@ -163,7 +163,7 @@ public class YAVote extends JavaPlugin { private boolean testPermission (String cmd, String action, Player p) { - if ( ( cmd.equalsIgnoreCase("sun") ) || cmd.equalsIgnoreCase("rain") ) + if ( ( cmd.equalsIgnoreCase("sun") ) || cmd.equalsIgnoreCase("rain") || cmd.equalsIgnoreCase("storm") ) { if ( p.hasPermission("vote.weather." + action ) ) return true; else return false; -- 2.39.2