]> git.defcon.no Git - YAVote/commitdiff
By request: adding "/vote storm" for starting thunder-storms.
authorJon Langseth <jon.langseth@lilug.no>
Tue, 13 Mar 2012 19:50:05 +0000 (20:50 +0100)
committerJon Langseth <jon.langseth@lilug.no>
Tue, 13 Mar 2012 19:50:05 +0000 (20:50 +0100)
plugin.yml
src/no/defcon/yavote/Votemanager.java
src/no/defcon/yavote/YAVote.java

index 3eada92d4fe2916ae4848bdc09efeca04dacbbf5..1d311de24c90dbc50e3aea633ec030b10ba40f9c 100644 (file)
@@ -12,6 +12,7 @@ commands:
       /<command> [parameter]\r
       /<command> sun    - Vote for fine weather\r
       /<command> rain   - Vote for rainy weather\r
+      /<command> storm  - Vote for thunder-storm\r
       /<command> day    - Vote to set the time to morning\r
       /<command> night  - Vote to set the time to night\r
       /<command> yes|no - Respond positive or negative to current vote\r
index cf69d7ec9b89db5cb0d9f78c5ab939571c9edf6e..2212b7a40f7c254324d65b3feecc98e994dc986e 100644 (file)
@@ -41,6 +41,7 @@ public class Votemanager {
                \r
                if ( ! (type.equalsIgnoreCase("sun") ||\r
                                type.equalsIgnoreCase("rain") ||\r
+                               type.equalsIgnoreCase("storm") ||\r
                                type.equalsIgnoreCase("day") ||\r
                                type.equalsIgnoreCase("night")  ))\r
                {\r
@@ -148,6 +149,8 @@ public class Votemanager {
                                w.setStorm(false);\r
                        else if ( voteType.equalsIgnoreCase("rain"))\r
                                w.setStorm(true);\r
+                       else if ( voteType.equalsIgnoreCase("storm"))\r
+                               w.setThundering(true);\r
                        else  if ( voteType.equalsIgnoreCase("day"))\r
                                w.setTime( plugin.getConfig().getInt("vote.time.dayStart") );\r
                        else  if ( voteType.equalsIgnoreCase("night"))\r
@@ -160,7 +163,7 @@ public class Votemanager {
        private boolean checkRatio( )\r
        {\r
                float required = 0.5F;\r
-               if ( voteType.equalsIgnoreCase("sun") || voteType.equalsIgnoreCase("rain") )\r
+               if ( voteType.equalsIgnoreCase("sun") || voteType.equalsIgnoreCase("rain") || voteType.equalsIgnoreCase("storm") )\r
                        required = (float)plugin.getConfig().getInt("vote.weather.requiredPercent") / 100.0F;\r
                else if ( voteType.equalsIgnoreCase("day") || voteType.equalsIgnoreCase("night") )\r
                        required = (float)plugin.getConfig().getInt("vote.time.requiredPercent") / 100.0F;\r
index cdb04f072afdf54bbd05d7c6ce6e850ef99bf11a..f12edb3c28b10f92a1de991585c5cbea303dc7ce 100644 (file)
@@ -95,7 +95,7 @@ public class YAVote extends JavaPlugin {
 \r
                                return notImplemented(player);\r
                        }\r
-                       else if ( voteCmd.equalsIgnoreCase("sun") || voteCmd.equalsIgnoreCase("rain") || \r
+                       else if ( voteCmd.equalsIgnoreCase("sun") || voteCmd.equalsIgnoreCase("rain") ||  voteCmd.equalsIgnoreCase("storm") ||\r
                                          voteCmd.equalsIgnoreCase("day") || voteCmd.equalsIgnoreCase("night") ) \r
                        {\r
                                if ( ! manager.isVoteRunning() )\r
@@ -163,7 +163,7 @@ public class YAVote extends JavaPlugin {
        \r
        private boolean testPermission (String cmd, String action, Player p)\r
        {\r
-               if ( ( cmd.equalsIgnoreCase("sun") ) || cmd.equalsIgnoreCase("rain") )\r
+               if ( ( cmd.equalsIgnoreCase("sun") ) || cmd.equalsIgnoreCase("rain")  || cmd.equalsIgnoreCase("storm") )\r
                {\r
                        if (  p.hasPermission("vote.weather." + action ) ) return true;\r
                        else return false;\r