Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.class
.DS_STORE

# Mobile Tools for Java (J2ME)
.mtj.tmp/
Expand Down Expand Up @@ -32,4 +33,4 @@ pom.xml

## gradle ##
/build/
/.gradle/
/.gradle/
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Dec 03 15:34:04 GMT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
Empty file modified gradlew
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public Messages(Main main) throws IOException, ObjectMappingException {

//general
private static String restartCancel = "&3Restarts have been canceled.";
private static String restartPassed = "Players have voted to restart the server.";
private static String restartPassed = "&aPlayers have voted to restart the server.";
private static String restartVoteNotEnoughVoted = "&3The server will not be restarted. Not enough people have voted.";
private static String votedYes = "You Voted Yes!";
private static String votedNo = "You Voted No!";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Permissions {
public static final String COMMAND_NOW = "mmcreboot.reboot.now";
public static final String COMMAND_START = "mmcreboot.reboot.start";
public static final String COMMAND_CANCEL = "mmcreboot.reboot.cancel";
public static final String CANCEL_VOTE = "mmcreboot.reboot.cancel.vote";
public static final String TOGGLE_VOTE = "mmcreboot.reboot.toggle.vote";
public static final String BYPASS = "mmcreboot.reboot.bypass";
}
14 changes: 4 additions & 10 deletions src/main/java/net/moddedminecraft/mmcreboot/EventListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

import net.moddedminecraft.mmcreboot.Config.Config;
import net.moddedminecraft.mmcreboot.Config.Messages;
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.filter.cause.Root;
import org.spongepowered.api.event.network.ClientConnectionEvent;
import org.spongepowered.api.service.pagination.PaginationService;
import org.spongepowered.api.service.pagination.PaginationList;
import org.spongepowered.api.text.Text;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
Expand All @@ -24,12 +22,9 @@ public EventListener(Main instance) {
}

@Listener
public void onPlayerLogin(ClientConnectionEvent.Join event, @Root Player player) throws IOException, ObjectMappingException {
public void onPlayerLogin(ClientConnectionEvent.Join event, @Root Player player) {
if (plugin.voteStarted) {
Sponge.getScheduler().createTaskBuilder().execute(new Runnable() {

public void run() {
PaginationService paginationService = Sponge.getServiceManager().provide(PaginationService.class).get();
Sponge.getScheduler().createTaskBuilder().execute(() -> {
List<Text> contents = new ArrayList<>();
if (Config.timerUseVoteScoreboard) {
plugin.displayVotes();
Expand All @@ -40,13 +35,12 @@ public void run() {
}

if (!contents.isEmpty()) {
paginationService.builder()
PaginationList.builder()
.title(plugin.fromLegacy("Restart"))
.contents(contents)
.padding(Text.of("="))
.sendTo(player);
}
}
}).delay(3, TimeUnit.SECONDS).name("mmcreboot-s-sendVoteOnLogin").submit(plugin);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/moddedminecraft/mmcreboot/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class Main {
public boolean voteStarted = false;
public int yesVotes = 0;
public int noVotes = 0;
public ArrayList<Player> hasVoted = new ArrayList<Player>();
public ArrayList<UUID> hasVoted = new ArrayList<UUID>();
public static ArrayList<Integer> realTimeTimes = new ArrayList<Integer>();

public int voteSeconds;
Expand Down Expand Up @@ -314,7 +314,7 @@ public void action() {
displayRestart(nextRealTimeRestart);
}
}
if (voteStarted && voteCancel && Config.timerUseVoteScoreboard) {
if (voteStarted && !voteCancel && Config.timerUseVoteScoreboard) {
displayVotes();
}
}
Expand Down
Loading