Skip to content

Commit b1d8a05

Browse files
committed
Add percentage configuration #6
1 parent 308456a commit b1d8a05

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>net.moddedminecraft</groupId>
55
<artifactId>MMCReboot</artifactId>
6-
<version>1.7-API-${api}</version>
6+
<version>1.7.1-API-${api}</version>
77
<name>MMCReboot</name>
88
<description>
99
Restart plugin for sponge to allow server restart timers, countdowns and votes.

src/main/java/net/moddedminecraft/mmcreboot/Main.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import java.util.TimerTask;
4141
import java.util.concurrent.TimeUnit;
4242

43-
@Plugin(id = "mmcreboot", name = "MMCReboot", version = "1.7", authors = {"Leelawd93"})
43+
@Plugin(id = "mmcreboot", name = "MMCReboot", version = "1.7.1", authors = {"Leelawd93"})
4444
public class Main {
4545

4646
@Inject

src/main/java/net/moddedminecraft/mmcreboot/commands/RebootVote.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ public CommandResult execute(CommandSource src, CommandContext args) throws Comm
122122
Timer voteTimer = new Timer();
123123
voteTimer.schedule(new TimerTask() {
124124
public void run() {
125-
if ((plugin.yesVotes > plugin.noVotes) && plugin.voteCancel == 0 && plugin.yesVotes >= Config.timerMinplayers) {
125+
int Online = Sponge.getServer().getOnlinePlayers().size();
126+
float percentage = plugin.yesVotes/Online *100;
127+
128+
if ((plugin.yesVotes > plugin.noVotes) && (plugin.voteCancel == 0) && (plugin.yesVotes >= Config.timerMinplayers) && (percentage >= Config.timerVotepercent)) {
126129
plugin.removeScoreboard();
127130
plugin.yesVotes = 0;
128131
plugin.cdTimer = 1;

0 commit comments

Comments
 (0)