\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 ( ! voteRunning || (voteType == null ) )\r
return;\r
\r
- plugin.getLogger().info("Debugging removeVote() with player: " + player.getName() );\r
if ( yesVoters.contains(player.getName()) )\r
- {\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
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
- plugin.getLogger().info("Debugging: No voters remaining in lists. Cancel vote.");\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
- //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
- }\r
- plugin.getLogger().info("Returning from removeVote()");\r
}\r
\r
public boolean addVote(Player player, boolean yes) \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
\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