]> git.defcon.no Git - YAVote/commitdiff
Removed debugging text. Seems to work OK, bumping version to 1.5 master
authorJon Langseth <jon.langseth@hig.no>
Tue, 8 May 2012 14:35:49 +0000 (16:35 +0200)
committerJon Langseth <jon.langseth@hig.no>
Tue, 8 May 2012 14:35:49 +0000 (16:35 +0200)
plugin.yml
src/no/defcon/yavote/Votemanager.java
src/no/defcon/yavote/YAVote.java

index 0a3b638dd6850c63b38227bddb1b6027bb2954f7..20cd3c48ee22430d33510198d23c5cdea1970a17 100644 (file)
@@ -1,6 +1,6 @@
 name: YAVote\r
 main: no.defcon.yavote.YAVote\r
 name: YAVote\r
 main: no.defcon.yavote.YAVote\r
-version: 1.5-test3\r
+version: 1.5\r
 description: Yet Another Vote plugin for Bukkit\r
 website: http://minecraft.defcon.no/yavote\r
 authors:\r
 description: Yet Another Vote plugin for Bukkit\r
 website: http://minecraft.defcon.no/yavote\r
 authors:\r
index 8690db30732d35f923b6af0f8a40948c136c96ba..bacbd92940dac0aabc9537f0d53a180c09c923ef 100644 (file)
@@ -64,7 +64,6 @@ public class Votemanager {
 \r
                yesVoters.add(p.getName());\r
 \r
 \r
                yesVoters.add(p.getName());\r
 \r
-               //if ( checkRatio( ) )\r
                if ( ((float) yesVoters.size() / (float) plugin.getServer().getOnlinePlayers().length ) >= getRequired() )\r
                {\r
                        applyVote( voteType );\r
                if ( ((float) yesVoters.size() / (float) plugin.getServer().getOnlinePlayers().length ) >= getRequired() )\r
                {\r
                        applyVote( voteType );\r
@@ -107,38 +106,17 @@ public class Votemanager {
                if ( ! voteRunning || (voteType == null ) )\r
                        return;\r
 \r
                if ( ! voteRunning || (voteType == null ) )\r
                        return;\r
 \r
-               plugin.getLogger().info("Debugging removeVote() with player: " + player.getName() );\r
                if ( yesVoters.contains(player.getName()) )\r
                if ( yesVoters.contains(player.getName()) )\r
-               {\r
                        yesVoters.remove(player.getName());\r
                        yesVoters.remove(player.getName());\r
-                       plugin.getLogger().info("Debugging, removeVote() removed YES vote for " + player.getName() );\r
-               }\r
 \r
                if ( noVoters.contains(player.getName()) )\r
 \r
                if ( noVoters.contains(player.getName()) )\r
-               {\r
                        noVoters.remove(player.getName());\r
                        noVoters.remove(player.getName());\r
-                       plugin.getLogger().info("Debugging, removeVote() removed NO vote for " + player.getName() );\r
-               }\r
 \r
                if ( yesVoters.size() + noVoters.size() == 0 )\r
 \r
                if ( yesVoters.size() + noVoters.size() == 0 )\r
-               {\r
-                       plugin.getLogger().info("Debugging: No voters remaining in lists. Cancel vote.");\r
                        cancelVote();\r
                        cancelVote();\r
-                       return;\r
-               }\r
-\r
-               plugin.getLogger().info("Debugging: yesVoters.size()     = "  + yesVoters.size() );\r
-               plugin.getLogger().info("Debugging: getRequired()        = " + getRequired() );\r
-               plugin.getLogger().info("Debugging: getOnlinePlayers - 1 = " + (plugin.getServer().getOnlinePlayers().length - 1) );\r
-               plugin.getLogger().info("Debugging: ratio = " + ( (float) yesVoters.size() / (float) (plugin.getServer().getOnlinePlayers().length - 1) ) );\r
 \r
 \r
-               //if( checkRatio( ) )\r
-               if ( ((float) yesVoters.size() / (float) (plugin.getServer().getOnlinePlayers().length - 1) ) >= getRequired() )\r
-               {\r
-                       plugin.getLogger().info("Debugging: after removing vote, ratio test returns TRUE, applying vote");\r
+               else if ( ((float) yesVoters.size() / (float) (plugin.getServer().getOnlinePlayers().length - 1) ) >= getRequired() )\r
                        applyVote( voteType );\r
                        applyVote( voteType );\r
-               }\r
-               plugin.getLogger().info("Returning from removeVote()");\r
        }\r
 \r
        public boolean addVote(Player player, boolean yes) \r
        }\r
 \r
        public boolean addVote(Player player, boolean yes) \r
@@ -154,7 +132,6 @@ public class Votemanager {
                if (yes == true) yesVoters.add(player.getName());\r
                else noVoters.add(player.getName());\r
                \r
                if (yes == true) yesVoters.add(player.getName());\r
                else noVoters.add(player.getName());\r
                \r
-               //if ( (yes == true) && checkRatio( ) )\r
                if ( ( yes == true) && ( ((float) yesVoters.size() / (float) plugin.getServer().getOnlinePlayers().length ) >= getRequired() ) )\r
                {\r
                        applyVote( voteType );\r
                if ( ( yes == true) && ( ((float) yesVoters.size() / (float) plugin.getServer().getOnlinePlayers().length ) >= getRequired() ) )\r
                {\r
                        applyVote( voteType );\r
@@ -211,27 +188,6 @@ public class Votemanager {
 \r
                return req;\r
        }\r
 \r
                return req;\r
        }\r
-\r
-       /*\r
-       // Original approach...\r
-       private boolean checkRatio( )\r
-       {\r
-               float required = getRequired();\r
-               float ratio = (float) yesVoters.size() / (float) plugin.getServer().getOnlinePlayers().length;\r
-               if ( ratio >= required ) return true;\r
-               return false;\r
-       }\r
-\r
-       // Replacement code\r
-       private boolean checkRatio( )\r
-       {\r
-               if ( ((float) yesVoters.size() / (float) plugin.getServer().getOnlinePlayers().length ) >= getRequired() )\r
-                       return true;\r
-               return false;\r
-       }\r
-\r
-       // But, trying to do it inline instead\r
-       */\r
        \r
        private void clearState()\r
        {\r
        \r
        private void clearState()\r
        {\r
index 98433ba107aa0b09834bb09a930649c1b46fd49c..1e49702364c6c2127cebe0235041f61974b90190 100644 (file)
@@ -64,7 +64,6 @@ public class YAVote extends JavaPlugin implements Listener {
        @EventHandler\r
        public void onLogout(PlayerQuitEvent event)\r
        {\r
        @EventHandler\r
        public void onLogout(PlayerQuitEvent event)\r
        {\r
-               logger.info("Triggered onLogout() with " + getServer().getOnlinePlayers().length + " players online.");\r
                manager.removeVote( event.getPlayer() );\r
        }\r
        \r
                manager.removeVote( event.getPlayer() );\r
        }\r
        \r